*** ../bash-20120224/bashline.c 2012-01-14 19:29:09.000000000 -0500 --- bashline.c 2012-03-05 20:50:46.000000000 -0500 *************** *** 257,260 **** --- 257,261 ---- /* Expand directory names during word/filename completion. */ int dircomplete_expand = 0; + int dircomplete_expand_relpath = 0; /* When non-zero, perform `normal' shell quoting on completed filenames *************** *** 2859,2863 **** d = savestring (*dirname); ! if ((rl_directory_rewrite_hook) && (*rl_directory_rewrite_hook) (&d)) { free (*dirname); --- 2860,2864 ---- d = savestring (*dirname); ! if ((rl_directory_rewrite_hook) && (*rl_directory_rewrite_hook) (&d)) { free (*dirname); *************** *** 3085,3088 **** --- 3086,3100 ---- } + /* no_symbolic_links == 0 -> use (default) logical view of the file system. + local_dirname[0] == '.' && local_dirname[1] == '/' means files in the + current directory (./). + local_dirname[0] == '.' && local_dirname[1] == 0 means relative pathnames + in the current directory (e.g., lib/sh). + XXX - should we do spelling correction on these? */ + + /* This is test as it was in bash-4.2: skip relative pathnames in current + directory. Change test to + (local_dirname[0] != '.' || (local_dirname[1] && local_dirname[1] != '/')) + if we want to skip paths beginning with ./ also. */ if (no_symbolic_links == 0 && (local_dirname[0] != '.' || local_dirname[1])) { *************** *** 3090,3093 **** --- 3102,3114 ---- int len1, len2; + /* If we have a relative path + (local_dirname[0] != '/' && local_dirname[0] != '.') + that is canonical after appending it to the current directory, then + temp1 = temp2+'/' + That is, + strcmp (temp1, temp2) == 0 + after adding a slash to temp2 below. It should be safe to not + change those. + */ t = get_working_directory ("symlink-hook"); temp1 = make_absolute (local_dirname, t); *************** *** 3124,3128 **** } } ! return_value |= STREQ (local_dirname, temp2) == 0; free (local_dirname); *dirname = temp2; --- 3145,3157 ---- } } ! ! /* dircomplete_expand_relpath == 0 means we want to leave relative ! pathnames that are unchanged by canonicalization alone. ! *local_dirname != '/' && *local_dirname != '.' == relative pathname ! (consistent with general.c:absolute_pathname()) ! temp1 == temp2 (after appending a slash to temp2) means the pathname ! is not changed by canonicalization as described above. */ ! if (dircomplete_expand_relpath || ((local_dirname[0] != '/' && local_dirname[0] != '.') && STREQ (temp1, temp2) == 0)) ! return_value |= STREQ (local_dirname, temp2) == 0; free (local_dirname); *dirname = temp2;