1 From https://ftp.gnu.org/gnu/bash/bash-4.4-patches/bash44-007
3 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
11 Bug-Reported-by: Jens Heyens <jens.heyens@cispa.saarland>
13 Bug-Reference-URL: https://savannah.gnu.org/support/?109224
17 When performing filename completion, bash dequotes the directory name being
18 completed, which can result in match failures and potential unwanted
21 Patch (apply with `patch -p0'):
23 *** bash-4.4-patched/bashline.c 2016-08-05 21:44:05.000000000 -0400
24 --- b/bashline.c 2017-01-19 13:15:51.000000000 -0500
27 static void restore_directory_hook __P((rl_icppfunc_t));
29 ! static int directory_exists __P((const char *));
31 static void cleanup_expansion_error __P((void));
33 static void restore_directory_hook __P((rl_icppfunc_t));
35 ! static int directory_exists __P((const char *, int));
37 static void cleanup_expansion_error __P((void));
42 ! /* Check whether not the (dequoted) version of DIRNAME, with any trailing slash
45 ! directory_exists (dirname)
52 ! /* Check whether not DIRNAME, with any trailing slash removed, exists. If
53 ! SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */
55 ! directory_exists (dirname, should_dequote)
64 ! /* First, dequote the directory name */
65 ! new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character);
66 dirlen = STRLEN (new_dirname);
67 if (new_dirname[dirlen - 1] == '/')
71 ! /* We save the string and chop the trailing slash because stat/lstat behave
72 ! inconsistently if one is present. */
73 ! new_dirname = should_dequote ? bash_dequote_filename ((char *)dirname, rl_completion_quote_character) : savestring (dirname);
74 dirlen = STRLEN (new_dirname);
75 if (new_dirname[dirlen - 1] == '/')
78 should_expand_dirname = '`';
80 ! if (should_expand_dirname && directory_exists (local_dirname))
81 should_expand_dirname = 0;
84 should_expand_dirname = '`';
86 ! if (should_expand_dirname && directory_exists (local_dirname, 0))
87 should_expand_dirname = 0;
91 global_nounset = unbound_vars_is_error;
92 unbound_vars_is_error = 0;
93 ! wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
94 unbound_vars_is_error = global_nounset;
97 global_nounset = unbound_vars_is_error;
98 unbound_vars_is_error = 0;
99 ! wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */
100 unbound_vars_is_error = global_nounset;
106 ! if (should_expand_dirname && directory_exists (local_dirname))
107 should_expand_dirname = 0;
112 ! if (should_expand_dirname && directory_exists (local_dirname, 1))
113 should_expand_dirname = 0;
118 new_dirname = savestring (local_dirname);
119 ! wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
124 new_dirname = savestring (local_dirname);
125 ! wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */
128 *** bash-4.4/subst.c 2016-08-30 16:46:38.000000000 -0400
129 --- b/subst.c 2017-01-19 07:09:57.000000000 -0500
133 if (word->flags & W_COMPLETE)
134 tword->flags |= W_COMPLETE; /* for command substitutions */
135 + if (word->flags & W_NOCOMSUB)
136 + tword->flags |= W_NOCOMSUB;
137 + if (word->flags & W_NOPROCSUB)
138 + tword->flags |= W_NOPROCSUB;
141 *** bash-4.4/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
142 --- b/patchlevel.h 2016-10-01 11:01:28.000000000 -0400
145 looks for to find the patch level (for the sccs version string). */
147 ! #define PATCHLEVEL 6
149 #endif /* _PATCHLEVEL_H_ */
151 looks for to find the patch level (for the sccs version string). */
153 ! #define PATCHLEVEL 7
155 #endif /* _PATCHLEVEL_H_ */