On 4/23/14, 11:21 PM, Clark Wang wrote: > See following example with bash-4.3.11: > > [STEP 101] $ mkdir -p "foo's dir/dir1/dir2" > [STEP 102] $ complete -d cd > [STEP 103] $ cd <TAB> > [STEP 103] $ cd foo\'s\ dir/<TAB> > > The 1st <TAB> worked fine but the 2nd failed to work. Bash 4.2.47 and 4.1.9 > behaved the same.
Thanks for the report. The problem is that in this case, the directory name is dequoted twice. In most cases, it doesn't matter, but it will fail if the directory name has a backslash-quoted quote, as in your example. The attached patch will fix it. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.3-patched/bashline.c 2014-02-09 19:56:58.000000000 -0500 --- bashline.c 2014-04-25 14:57:52.000000000 -0400 *************** *** 4168,4174 **** qc = rl_dispatching ? rl_completion_quote_character : 0; ! dfn = bash_dequote_filename ((char *)text, qc); m1 = rl_completion_matches (dfn, rl_filename_completion_function); ! free (dfn); if (m1 == 0 || m1[0] == 0) --- 4209,4222 ---- qc = rl_dispatching ? rl_completion_quote_character : 0; ! /* If rl_completion_found_quote != 0, rl_completion_matches will call the ! filename dequoting function, causing the directory name to be dequoted ! twice. */ ! if (rl_dispatching && rl_completion_found_quote == 0) ! dfn = bash_dequote_filename ((char *)text, qc); ! else ! dfn = (char *)text; m1 = rl_completion_matches (dfn, rl_filename_completion_function); ! if (dfn != text) ! free (dfn); if (m1 == 0 || m1[0] == 0)