]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/bash/bash50-001
Merge branch 'next'
[people/pmueller/ipfire-2.x.git] / src / patches / bash / bash50-001
1 BASH PATCH REPORT
2 =================
3
4 Bash-Release: 5.0
5 Patch-ID: bash50-001
6
7 Bug-Reported-by: axel@freakout.de
8 Bug-Reference-ID: <201901082050.x08KoShS006731@bongo.freakout.de>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00079.html
10
11 Bug-Description:
12
13 Under certain circumstances, the glob expansion code did not remove
14 backslashes escaping characters in directory names (or portions of a
15 pattern preceding a slash).
16
17 Patch (apply with `patch -p0'):
18
19 *** ../bash-5.0/bashline.c 2018-11-27 13:20:16.000000000 -0500
20 --- bashline.c 2019-01-16 16:06:03.000000000 -0500
21 ***************
22 *** 232,235 ****
23 --- 232,236 ----
24 static int bash_possible_command_completions __P((int, int));
25
26 + static int completion_glob_pattern __P((char *));
27 static char *glob_complete_word __P((const char *, int));
28 static int bash_glob_completion_internal __P((int));
29 ***************
30 *** 1742,1746 ****
31 /* This could be a globbing pattern, so try to expand it using pathname
32 expansion. */
33 ! if (!matches && glob_pattern_p (text))
34 {
35 matches = rl_completion_matches (text, glob_complete_word);
36 --- 1743,1747 ----
37 /* This could be a globbing pattern, so try to expand it using pathname
38 expansion. */
39 ! if (!matches && completion_glob_pattern ((char *)text))
40 {
41 matches = rl_completion_matches (text, glob_complete_word);
42 ***************
43 *** 1851,1855 ****
44 }
45
46 ! globpat = glob_pattern_p (hint_text);
47
48 /* If this is an absolute program name, do not check it against
49 --- 1852,1856 ----
50 }
51
52 ! globpat = completion_glob_pattern ((char *)hint_text);
53
54 /* If this is an absolute program name, do not check it against
55 ***************
56 *** 3714,3717 ****
57 --- 3715,3773 ----
58 }
59
60 + static int
61 + completion_glob_pattern (string)
62 + char *string;
63 + {
64 + register int c;
65 + char *send;
66 + int open;
67 +
68 + DECLARE_MBSTATE;
69 +
70 + open = 0;
71 + send = string + strlen (string);
72 +
73 + while (c = *string++)
74 + {
75 + switch (c)
76 + {
77 + case '?':
78 + case '*':
79 + return (1);
80 +
81 + case '[':
82 + open++;
83 + continue;
84 +
85 + case ']':
86 + if (open)
87 + return (1);
88 + continue;
89 +
90 + case '+':
91 + case '@':
92 + case '!':
93 + if (*string == '(') /*)*/
94 + return (1);
95 + continue;
96 +
97 + case '\\':
98 + if (*string == 0)
99 + return (0);
100 + }
101 +
102 + /* Advance one fewer byte than an entire multibyte character to
103 + account for the auto-increment in the loop above. */
104 + #ifdef HANDLE_MULTIBYTE
105 + string--;
106 + ADVANCE_CHAR_P (string, send - string);
107 + string++;
108 + #else
109 + ADVANCE_CHAR_P (string, send - string);
110 + #endif
111 + }
112 + return (0);
113 + }
114 +
115 static char *globtext;
116 static char *globorig;
117 ***************
118 *** 3878,3882 ****
119 }
120
121 ! if (t && glob_pattern_p (t) == 0)
122 rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
123 FREE (t);
124 --- 3934,3938 ----
125 }
126
127 ! if (t && completion_glob_pattern (t) == 0)
128 rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
129 FREE (t);
130 *** ../bash-5.0/lib/glob/glob_loop.c 2018-12-31 13:35:15.000000000 -0500
131 --- lib/glob/glob_loop.c 2019-01-09 09:44:36.000000000 -0500
132 ***************
133 *** 55,59 ****
134
135 case L('\\'):
136 - #if 0
137 /* Don't let the pattern end in a backslash (GMATCH returns no match
138 if the pattern ends in a backslash anyway), but otherwise return 1,
139 --- 55,58 ----
140 ***************
141 *** 61,69 ****
142 and it can be removed. */
143 return (*p != L('\0'));
144 - #else
145 - /* The pattern may not end with a backslash. */
146 - if (*p++ == L('\0'))
147 - return 0;
148 - #endif
149 }
150
151 --- 60,63 ----
152 *** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
153 --- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
154 ***************
155 *** 26,30 ****
156 looks for to find the patch level (for the sccs version string). */
157
158 ! #define PATCHLEVEL 0
159
160 #endif /* _PATCHLEVEL_H_ */
161 --- 26,30 ----
162 looks for to find the patch level (for the sccs version string). */
163
164 ! #define PATCHLEVEL 1
165
166 #endif /* _PATCHLEVEL_H_ */