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
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).
17 Patch (apply with `patch -p0'):
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
24 static int bash_possible_command_completions __P((int, int));
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));
31 /* This could be a globbing pattern, so try to expand it using pathname
33 ! if (!matches && glob_pattern_p (text))
35 matches = rl_completion_matches (text, glob_complete_word);
37 /* This could be a globbing pattern, so try to expand it using pathname
39 ! if (!matches && completion_glob_pattern ((char *)text))
41 matches = rl_completion_matches (text, glob_complete_word);
46 ! globpat = glob_pattern_p (hint_text);
48 /* If this is an absolute program name, do not check it against
52 ! globpat = completion_glob_pattern ((char *)hint_text);
54 /* If this is an absolute program name, do not check it against
61 + completion_glob_pattern (string)
71 + send = string + strlen (string);
73 + while (c = *string++)
93 + if (*string == '(') /*)*/
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
106 + ADVANCE_CHAR_P (string, send - string);
109 + ADVANCE_CHAR_P (string, send - string);
115 static char *globtext;
116 static char *globorig;
121 ! if (t && glob_pattern_p (t) == 0)
122 rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
127 ! if (t && completion_glob_pattern (t) == 0)
128 rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
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
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,
142 and it can be removed. */
143 return (*p != L('\0'));
145 - /* The pattern may not end with a backslash. */
146 - if (*p++ == L('\0'))
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
156 looks for to find the patch level (for the sccs version string). */
158 ! #define PATCHLEVEL 0
160 #endif /* _PATCHLEVEL_H_ */
162 looks for to find the patch level (for the sccs version string). */
164 ! #define PATCHLEVEL 1
166 #endif /* _PATCHLEVEL_H_ */