recipes: shells/bash: upgraded to version 5.0
[dragora.git] / patches / bash / bash44-007
blob5fb55ca4073b7f61b1a55722f824f6697970e338
1                              BASH PATCH REPORT
2                              =================
4 Bash-Release:   4.4
5 Patch-ID:       bash44-007
7 Bug-Reported-by:        Jens Heyens <jens.heyens@cispa.saarland>
8 Bug-Reference-ID:       
9 Bug-Reference-URL:      https://savannah.gnu.org/support/?109224
11 Bug-Description:
13 When performing filename completion, bash dequotes the directory name being
14 completed, which can result in match failures and potential unwanted
15 expansion.
17 Patch (apply with `patch -p0'):
19 *** ../bash-4.4-patched/bashline.c      2016-08-05 21:44:05.000000000 -0400
20 --- bashline.c  2017-01-19 13:15:51.000000000 -0500
21 ***************
22 *** 143,147 ****
23   static void restore_directory_hook __P((rl_icppfunc_t));
24   
25 ! static int directory_exists __P((const char *));
26   
27   static void cleanup_expansion_error __P((void));
28 --- 144,148 ----
29   static void restore_directory_hook __P((rl_icppfunc_t));
30   
31 ! static int directory_exists __P((const char *, int));
32   
33   static void cleanup_expansion_error __P((void));
34 ***************
35 *** 3103,3111 ****
36   }
37   
38 ! /* Check whether not the (dequoted) version of DIRNAME, with any trailing slash
39 !    removed, exists. */
40   static int
41 ! directory_exists (dirname)
42        const char *dirname;
43   {
44     char *new_dirname;
45 --- 3107,3116 ----
46   }
47   
48 ! /* Check whether not DIRNAME, with any trailing slash removed, exists.  If
49 !    SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */
50   static int
51 ! directory_exists (dirname, should_dequote)
52        const char *dirname;
53 +      int should_dequote;
54   {
55     char *new_dirname;
56 ***************
57 *** 3113,3118 ****
58     struct stat sb;
59   
60 !   /* First, dequote the directory name */
61 !   new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character);
62     dirlen = STRLEN (new_dirname);
63     if (new_dirname[dirlen - 1] == '/')
64 --- 3118,3124 ----
65     struct stat sb;
66   
67 !   /* We save the string and chop the trailing slash because stat/lstat behave
68 !      inconsistently if one is present. */
69 !   new_dirname = should_dequote ? bash_dequote_filename ((char *)dirname, rl_completion_quote_character) : savestring (dirname);
70     dirlen = STRLEN (new_dirname);
71     if (new_dirname[dirlen - 1] == '/')
72 ***************
73 *** 3146,3150 ****
74       should_expand_dirname = '`';
75   
76 !   if (should_expand_dirname && directory_exists (local_dirname))
77       should_expand_dirname = 0;
78     
79 --- 3152,3156 ----
80       should_expand_dirname = '`';
81   
82 !   if (should_expand_dirname && directory_exists (local_dirname, 0))
83       should_expand_dirname = 0;
84     
85 ***************
86 *** 3156,3160 ****
87         global_nounset = unbound_vars_is_error;
88         unbound_vars_is_error = 0;
89 !       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE);      /* does the right thing */
90         unbound_vars_is_error = global_nounset;
91         if (wl)
92 --- 3162,3166 ----
93         global_nounset = unbound_vars_is_error;
94         unbound_vars_is_error = 0;
95 !       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE);  /* does the right thing */
96         unbound_vars_is_error = global_nounset;
97         if (wl)
98 ***************
99 *** 3245,3249 ****
100       }
101   
102 !   if (should_expand_dirname && directory_exists (local_dirname))
103       should_expand_dirname = 0;
104   
105 --- 3262,3266 ----
106       }
107   
108 !   if (should_expand_dirname && directory_exists (local_dirname, 1))
109       should_expand_dirname = 0;
110   
111 ***************
112 *** 3251,3255 ****
113       {
114         new_dirname = savestring (local_dirname);
115 !       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE);      /* does the right thing */
116         if (wl)
117         {
118 --- 3268,3272 ----
119       {
120         new_dirname = savestring (local_dirname);
121 !       wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE);  /* does the right thing */
122         if (wl)
123         {
124 *** ../bash-4.4/subst.c 2016-08-30 16:46:38.000000000 -0400
125 --- subst.c     2017-01-19 07:09:57.000000000 -0500
126 ***************
127 *** 9459,9462 ****
128 --- 9459,9466 ----
129               if (word->flags & W_COMPLETE)
130                 tword->flags |= W_COMPLETE;     /* for command substitutions */
131 +             if (word->flags & W_NOCOMSUB)
132 +               tword->flags |= W_NOCOMSUB;
133 +             if (word->flags & W_NOPROCSUB)
134 +               tword->flags |= W_NOPROCSUB;
135   
136               temp = (char *)NULL;
137 *** ../bash-4.4/patchlevel.h    2016-06-22 14:51:03.000000000 -0400
138 --- patchlevel.h        2016-10-01 11:01:28.000000000 -0400
139 ***************
140 *** 26,30 ****
141      looks for to find the patch level (for the sccs version string). */
142   
143 ! #define PATCHLEVEL 6
144   
145   #endif /* _PATCHLEVEL_H_ */
146 --- 26,30 ----
147      looks for to find the patch level (for the sccs version string). */
148   
149 ! #define PATCHLEVEL 7
150   
151   #endif /* _PATCHLEVEL_H_ */