|
|
462fb2 |
BASH PATCH REPORT
|
|
|
462fb2 |
=================
|
|
|
462fb2 |
|
|
|
462fb2 |
Bash-Release: 4.2
|
|
|
462fb2 |
Patch-ID: bash42-029
|
|
|
462fb2 |
|
|
|
462fb2 |
Bug-Reported-by: "Michael Kalisz" <michael@kalisz.homelinux.net>
|
|
|
462fb2 |
Bug-Reference-ID: <50241.78.69.11.112.1298585641.squirrel@kalisz.homelinux.net>
|
|
|
462fb2 |
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00274.html
|
|
|
462fb2 |
|
|
|
462fb2 |
Bug-Description:
|
|
|
462fb2 |
|
|
|
462fb2 |
Bash-4.2 tries to leave completed directory names as the user typed them,
|
|
|
462fb2 |
without expanding them to a full pathname. One effect of this is that
|
|
|
462fb2 |
shell variables used in pathnames being completed (e.g., $HOME) are left
|
|
|
462fb2 |
unchanged, but the `$' is quoted by readline because it is a special
|
|
|
462fb2 |
character to the shell.
|
|
|
462fb2 |
|
|
|
462fb2 |
This patch introduces two things:
|
|
|
462fb2 |
|
|
|
462fb2 |
1. A new shell option, `direxpand', which, if set, attempts to emulate the
|
|
|
462fb2 |
bash-4.1 behavior of expanding words to full pathnames during
|
|
|
462fb2 |
completion;
|
|
|
462fb2 |
2. A set of heuristics that reduce the number of times special characters
|
|
|
462fb2 |
such as `$' are quoted when the directory name is not expanded.
|
|
|
462fb2 |
|
|
|
462fb2 |
Patch (apply with `patch -p0'):
|
|
|
462fb2 |
|
|
|
462fb2 |
diff -NrC 2 ../bash-4.2-patched/bashline.c ./bashline.c
|
|
|
462fb2 |
*** ../bash-4.2-patched/bashline.c 2011-01-16 15:32:47.000000000 -0500
|
|
|
462fb2 |
--- ./bashline.c 2012-05-07 16:27:18.000000000 -0400
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 122,125 ****
|
|
|
462fb2 |
--- 122,128 ----
|
|
|
462fb2 |
static int bash_push_line __P((void));
|
|
|
462fb2 |
|
|
|
462fb2 |
+ static rl_icppfunc_t *save_directory_hook __P((void));
|
|
|
462fb2 |
+ static void reset_directory_hook __P((rl_icppfunc_t *));
|
|
|
462fb2 |
+
|
|
|
462fb2 |
static void cleanup_expansion_error __P((void));
|
|
|
462fb2 |
static void maybe_make_readline_line __P((char *));
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 244,251 ****
|
|
|
462fb2 |
--- 247,261 ----
|
|
|
462fb2 |
int dircomplete_spelling = 0;
|
|
|
462fb2 |
|
|
|
462fb2 |
+ /* Expand directory names during word/filename completion. */
|
|
|
462fb2 |
+ int dircomplete_expand = 0;
|
|
|
462fb2 |
+ int dircomplete_expand_relpath = 0;
|
|
|
462fb2 |
+
|
|
|
462fb2 |
static char *bash_completer_word_break_characters = " \t\n\"'@><=;|&(:";
|
|
|
462fb2 |
static char *bash_nohostname_word_break_characters = " \t\n\"'><=;|&(:";
|
|
|
462fb2 |
/* )) */
|
|
|
462fb2 |
|
|
|
462fb2 |
+ static const char *default_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:{~"; /*}*/
|
|
|
462fb2 |
+ static char *custom_filename_quote_characters = 0;
|
|
|
462fb2 |
+
|
|
|
462fb2 |
static rl_hook_func_t *old_rl_startup_hook = (rl_hook_func_t *)NULL;
|
|
|
462fb2 |
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 502,506 ****
|
|
|
462fb2 |
/* Tell the completer that we might want to follow symbolic links or
|
|
|
462fb2 |
do other expansion on directory names. */
|
|
|
462fb2 |
! rl_directory_rewrite_hook = bash_directory_completion_hook;
|
|
|
462fb2 |
|
|
|
462fb2 |
rl_filename_rewrite_hook = bash_filename_rewrite_hook;
|
|
|
462fb2 |
--- 512,516 ----
|
|
|
462fb2 |
/* Tell the completer that we might want to follow symbolic links or
|
|
|
462fb2 |
do other expansion on directory names. */
|
|
|
462fb2 |
! set_directory_hook ();
|
|
|
462fb2 |
|
|
|
462fb2 |
rl_filename_rewrite_hook = bash_filename_rewrite_hook;
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 530,534 ****
|
|
|
462fb2 |
|
|
|
462fb2 |
/* characters that need to be quoted when appearing in filenames. */
|
|
|
462fb2 |
! rl_filename_quote_characters = " \t\n\\\"'@<>=;|&()#$`?*[!:{~"; /*}*/
|
|
|
462fb2 |
|
|
|
462fb2 |
rl_filename_quoting_function = bash_quote_filename;
|
|
|
462fb2 |
--- 540,544 ----
|
|
|
462fb2 |
|
|
|
462fb2 |
/* characters that need to be quoted when appearing in filenames. */
|
|
|
462fb2 |
! rl_filename_quote_characters = default_filename_quote_characters;
|
|
|
462fb2 |
|
|
|
462fb2 |
rl_filename_quoting_function = bash_quote_filename;
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 565,570 ****
|
|
|
462fb2 |
rl_attempted_completion_function = attempt_shell_completion;
|
|
|
462fb2 |
rl_completion_entry_function = NULL;
|
|
|
462fb2 |
- rl_directory_rewrite_hook = bash_directory_completion_hook;
|
|
|
462fb2 |
rl_ignore_some_completions_function = filename_completion_ignore;
|
|
|
462fb2 |
}
|
|
|
462fb2 |
|
|
|
462fb2 |
--- 575,582 ----
|
|
|
462fb2 |
rl_attempted_completion_function = attempt_shell_completion;
|
|
|
462fb2 |
rl_completion_entry_function = NULL;
|
|
|
462fb2 |
rl_ignore_some_completions_function = filename_completion_ignore;
|
|
|
462fb2 |
+ rl_filename_quote_characters = default_filename_quote_characters;
|
|
|
462fb2 |
+
|
|
|
462fb2 |
+ set_directory_hook ();
|
|
|
462fb2 |
}
|
|
|
462fb2 |
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 1280,1283 ****
|
|
|
462fb2 |
--- 1292,1298 ----
|
|
|
462fb2 |
rl_ignore_some_completions_function = filename_completion_ignore;
|
|
|
462fb2 |
|
|
|
462fb2 |
+ rl_filename_quote_characters = default_filename_quote_characters;
|
|
|
462fb2 |
+ set_directory_hook ();
|
|
|
462fb2 |
+
|
|
|
462fb2 |
/* Determine if this could be a command word. It is if it appears at
|
|
|
462fb2 |
the start of the line (ignoring preceding whitespace), or if it
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 1592,1595 ****
|
|
|
462fb2 |
--- 1607,1616 ----
|
|
|
462fb2 |
else
|
|
|
462fb2 |
{
|
|
|
462fb2 |
+ if (dircomplete_expand && dot_or_dotdot (filename_hint))
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ dircomplete_expand = 0;
|
|
|
462fb2 |
+ set_directory_hook ();
|
|
|
462fb2 |
+ dircomplete_expand = 1;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
mapping_over = 4;
|
|
|
462fb2 |
goto inner;
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 1792,1795 ****
|
|
|
462fb2 |
--- 1813,1819 ----
|
|
|
462fb2 |
inner:
|
|
|
462fb2 |
val = rl_filename_completion_function (filename_hint, istate);
|
|
|
462fb2 |
+ if (mapping_over == 4 && dircomplete_expand)
|
|
|
462fb2 |
+ set_directory_hook ();
|
|
|
462fb2 |
+
|
|
|
462fb2 |
istate = 1;
|
|
|
462fb2 |
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 2694,2697 ****
|
|
|
462fb2 |
--- 2718,2767 ----
|
|
|
462fb2 |
}
|
|
|
462fb2 |
|
|
|
462fb2 |
+ /* Functions to save and restore the appropriate directory hook */
|
|
|
462fb2 |
+ /* This is not static so the shopt code can call it */
|
|
|
462fb2 |
+ void
|
|
|
462fb2 |
+ set_directory_hook ()
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ if (dircomplete_expand)
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ rl_directory_completion_hook = bash_directory_completion_hook;
|
|
|
462fb2 |
+ rl_directory_rewrite_hook = (rl_icppfunc_t *)0;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+ else
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ rl_directory_rewrite_hook = bash_directory_completion_hook;
|
|
|
462fb2 |
+ rl_directory_completion_hook = (rl_icppfunc_t *)0;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+
|
|
|
462fb2 |
+ static rl_icppfunc_t *
|
|
|
462fb2 |
+ save_directory_hook ()
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ rl_icppfunc_t *ret;
|
|
|
462fb2 |
+
|
|
|
462fb2 |
+ if (dircomplete_expand)
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ ret = rl_directory_completion_hook;
|
|
|
462fb2 |
+ rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+ else
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ ret = rl_directory_rewrite_hook;
|
|
|
462fb2 |
+ rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+
|
|
|
462fb2 |
+ return ret;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+
|
|
|
462fb2 |
+ static void
|
|
|
462fb2 |
+ restore_directory_hook (hookf)
|
|
|
462fb2 |
+ rl_icppfunc_t *hookf;
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ if (dircomplete_expand)
|
|
|
462fb2 |
+ rl_directory_completion_hook = hookf;
|
|
|
462fb2 |
+ else
|
|
|
462fb2 |
+ rl_directory_rewrite_hook = hookf;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+
|
|
|
462fb2 |
/* Handle symbolic link references and other directory name
|
|
|
462fb2 |
expansions while hacking completion. This should return 1 if it modifies
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 2703,2720 ****
|
|
|
462fb2 |
{
|
|
|
462fb2 |
char *local_dirname, *new_dirname, *t;
|
|
|
462fb2 |
! int return_value, should_expand_dirname;
|
|
|
462fb2 |
WORD_LIST *wl;
|
|
|
462fb2 |
struct stat sb;
|
|
|
462fb2 |
|
|
|
462fb2 |
! return_value = should_expand_dirname = 0;
|
|
|
462fb2 |
local_dirname = *dirname;
|
|
|
462fb2 |
|
|
|
462fb2 |
! if (mbschr (local_dirname, '$'))
|
|
|
462fb2 |
! should_expand_dirname = 1;
|
|
|
462fb2 |
else
|
|
|
462fb2 |
{
|
|
|
462fb2 |
t = mbschr (local_dirname, '`');
|
|
|
462fb2 |
if (t && unclosed_pair (local_dirname, strlen (local_dirname), "`") == 0)
|
|
|
462fb2 |
! should_expand_dirname = 1;
|
|
|
462fb2 |
}
|
|
|
462fb2 |
|
|
|
462fb2 |
--- 2773,2801 ----
|
|
|
462fb2 |
{
|
|
|
462fb2 |
char *local_dirname, *new_dirname, *t;
|
|
|
462fb2 |
! int return_value, should_expand_dirname, nextch, closer;
|
|
|
462fb2 |
WORD_LIST *wl;
|
|
|
462fb2 |
struct stat sb;
|
|
|
462fb2 |
|
|
|
462fb2 |
! return_value = should_expand_dirname = nextch = closer = 0;
|
|
|
462fb2 |
local_dirname = *dirname;
|
|
|
462fb2 |
|
|
|
462fb2 |
! if (t = mbschr (local_dirname, '$'))
|
|
|
462fb2 |
! {
|
|
|
462fb2 |
! should_expand_dirname = '$';
|
|
|
462fb2 |
! nextch = t[1];
|
|
|
462fb2 |
! /* Deliberately does not handle the deprecated $[...] arithmetic
|
|
|
462fb2 |
! expansion syntax */
|
|
|
462fb2 |
! if (nextch == '(')
|
|
|
462fb2 |
! closer = ')';
|
|
|
462fb2 |
! else if (nextch == '{')
|
|
|
462fb2 |
! closer = '}';
|
|
|
462fb2 |
! else
|
|
|
462fb2 |
! nextch = 0;
|
|
|
462fb2 |
! }
|
|
|
462fb2 |
else
|
|
|
462fb2 |
{
|
|
|
462fb2 |
t = mbschr (local_dirname, '`');
|
|
|
462fb2 |
if (t && unclosed_pair (local_dirname, strlen (local_dirname), "`") == 0)
|
|
|
462fb2 |
! should_expand_dirname = '`';
|
|
|
462fb2 |
}
|
|
|
462fb2 |
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 2740,2743 ****
|
|
|
462fb2 |
--- 2821,2841 ----
|
|
|
462fb2 |
dispose_words (wl);
|
|
|
462fb2 |
local_dirname = *dirname;
|
|
|
462fb2 |
+ /* XXX - change rl_filename_quote_characters here based on
|
|
|
462fb2 |
+ should_expand_dirname/nextch/closer. This is the only place
|
|
|
462fb2 |
+ custom_filename_quote_characters is modified. */
|
|
|
462fb2 |
+ if (rl_filename_quote_characters && *rl_filename_quote_characters)
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ int i, j, c;
|
|
|
462fb2 |
+ i = strlen (default_filename_quote_characters);
|
|
|
462fb2 |
+ custom_filename_quote_characters = xrealloc (custom_filename_quote_characters, i+1);
|
|
|
462fb2 |
+ for (i = j = 0; c = default_filename_quote_characters[i]; i++)
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ if (c == should_expand_dirname || c == nextch || c == closer)
|
|
|
462fb2 |
+ continue;
|
|
|
462fb2 |
+ custom_filename_quote_characters[j++] = c;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+ custom_filename_quote_characters[j] = '\0';
|
|
|
462fb2 |
+ rl_filename_quote_characters = custom_filename_quote_characters;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
}
|
|
|
462fb2 |
else
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 2759,2762 ****
|
|
|
462fb2 |
--- 2857,2871 ----
|
|
|
462fb2 |
}
|
|
|
462fb2 |
|
|
|
462fb2 |
+ /* no_symbolic_links == 0 -> use (default) logical view of the file system.
|
|
|
462fb2 |
+ local_dirname[0] == '.' && local_dirname[1] == '/' means files in the
|
|
|
462fb2 |
+ current directory (./).
|
|
|
462fb2 |
+ local_dirname[0] == '.' && local_dirname[1] == 0 means relative pathnames
|
|
|
462fb2 |
+ in the current directory (e.g., lib/sh).
|
|
|
462fb2 |
+ XXX - should we do spelling correction on these? */
|
|
|
462fb2 |
+
|
|
|
462fb2 |
+ /* This is test as it was in bash-4.2: skip relative pathnames in current
|
|
|
462fb2 |
+ directory. Change test to
|
|
|
462fb2 |
+ (local_dirname[0] != '.' || (local_dirname[1] && local_dirname[1] != '/'))
|
|
|
462fb2 |
+ if we want to skip paths beginning with ./ also. */
|
|
|
462fb2 |
if (no_symbolic_links == 0 && (local_dirname[0] != '.' || local_dirname[1]))
|
|
|
462fb2 |
{
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 2764,2767 ****
|
|
|
462fb2 |
--- 2873,2885 ----
|
|
|
462fb2 |
int len1, len2;
|
|
|
462fb2 |
|
|
|
462fb2 |
+ /* If we have a relative path
|
|
|
462fb2 |
+ (local_dirname[0] != '/' && local_dirname[0] != '.')
|
|
|
462fb2 |
+ that is canonical after appending it to the current directory, then
|
|
|
462fb2 |
+ temp1 = temp2+'/'
|
|
|
462fb2 |
+ That is,
|
|
|
462fb2 |
+ strcmp (temp1, temp2) == 0
|
|
|
462fb2 |
+ after adding a slash to temp2 below. It should be safe to not
|
|
|
462fb2 |
+ change those.
|
|
|
462fb2 |
+ */
|
|
|
462fb2 |
t = get_working_directory ("symlink-hook");
|
|
|
462fb2 |
temp1 = make_absolute (local_dirname, t);
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 2798,2802 ****
|
|
|
462fb2 |
}
|
|
|
462fb2 |
}
|
|
|
462fb2 |
! return_value |= STREQ (local_dirname, temp2) == 0;
|
|
|
462fb2 |
free (local_dirname);
|
|
|
462fb2 |
*dirname = temp2;
|
|
|
462fb2 |
--- 2916,2928 ----
|
|
|
462fb2 |
}
|
|
|
462fb2 |
}
|
|
|
462fb2 |
!
|
|
|
462fb2 |
! /* dircomplete_expand_relpath == 0 means we want to leave relative
|
|
|
462fb2 |
! pathnames that are unchanged by canonicalization alone.
|
|
|
462fb2 |
! *local_dirname != '/' && *local_dirname != '.' == relative pathname
|
|
|
462fb2 |
! (consistent with general.c:absolute_pathname())
|
|
|
462fb2 |
! temp1 == temp2 (after appending a slash to temp2) means the pathname
|
|
|
462fb2 |
! is not changed by canonicalization as described above. */
|
|
|
462fb2 |
! if (dircomplete_expand_relpath || ((local_dirname[0] != '/' && local_dirname[0] != '.') && STREQ (temp1, temp2) == 0))
|
|
|
462fb2 |
! return_value |= STREQ (local_dirname, temp2) == 0;
|
|
|
462fb2 |
free (local_dirname);
|
|
|
462fb2 |
*dirname = temp2;
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 3003,3012 ****
|
|
|
462fb2 |
orig_func = rl_completion_entry_function;
|
|
|
462fb2 |
orig_attempt_func = rl_attempted_completion_function;
|
|
|
462fb2 |
- orig_dir_func = rl_directory_rewrite_hook;
|
|
|
462fb2 |
orig_ignore_func = rl_ignore_some_completions_function;
|
|
|
462fb2 |
orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
|
|
|
462fb2 |
rl_completion_entry_function = rl_filename_completion_function;
|
|
|
462fb2 |
rl_attempted_completion_function = (rl_completion_func_t *)NULL;
|
|
|
462fb2 |
- rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
|
|
|
462fb2 |
rl_ignore_some_completions_function = filename_completion_ignore;
|
|
|
462fb2 |
rl_completer_word_break_characters = " \t\n\"\'";
|
|
|
462fb2 |
--- 3129,3139 ----
|
|
|
462fb2 |
orig_func = rl_completion_entry_function;
|
|
|
462fb2 |
orig_attempt_func = rl_attempted_completion_function;
|
|
|
462fb2 |
orig_ignore_func = rl_ignore_some_completions_function;
|
|
|
462fb2 |
orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
|
|
|
462fb2 |
+
|
|
|
462fb2 |
+ orig_dir_func = save_directory_hook ();
|
|
|
462fb2 |
+
|
|
|
462fb2 |
rl_completion_entry_function = rl_filename_completion_function;
|
|
|
462fb2 |
rl_attempted_completion_function = (rl_completion_func_t *)NULL;
|
|
|
462fb2 |
rl_ignore_some_completions_function = filename_completion_ignore;
|
|
|
462fb2 |
rl_completer_word_break_characters = " \t\n\"\'";
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 3016,3023 ****
|
|
|
462fb2 |
rl_completion_entry_function = orig_func;
|
|
|
462fb2 |
rl_attempted_completion_function = orig_attempt_func;
|
|
|
462fb2 |
- rl_directory_rewrite_hook = orig_dir_func;
|
|
|
462fb2 |
rl_ignore_some_completions_function = orig_ignore_func;
|
|
|
462fb2 |
rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
|
|
|
462fb2 |
|
|
|
462fb2 |
return r;
|
|
|
462fb2 |
}
|
|
|
462fb2 |
--- 3143,3151 ----
|
|
|
462fb2 |
rl_completion_entry_function = orig_func;
|
|
|
462fb2 |
rl_attempted_completion_function = orig_attempt_func;
|
|
|
462fb2 |
rl_ignore_some_completions_function = orig_ignore_func;
|
|
|
462fb2 |
rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
|
|
|
462fb2 |
|
|
|
462fb2 |
+ restore_directory_hook (orig_dir_func);
|
|
|
462fb2 |
+
|
|
|
462fb2 |
return r;
|
|
|
462fb2 |
}
|
|
|
462fb2 |
diff -NrC 2 ../bash-4.2-patched/bashline.h ./bashline.h
|
|
|
462fb2 |
*** ../bash-4.2-patched/bashline.h 2009-01-04 14:32:22.000000000 -0500
|
|
|
462fb2 |
--- ./bashline.h 2012-05-07 16:27:18.000000000 -0400
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 34,41 ****
|
|
|
462fb2 |
--- 34,46 ----
|
|
|
462fb2 |
extern int bash_re_edit __P((char *));
|
|
|
462fb2 |
|
|
|
462fb2 |
+ extern void bashline_set_event_hook __P((void));
|
|
|
462fb2 |
+ extern void bashline_reset_event_hook __P((void));
|
|
|
462fb2 |
+
|
|
|
462fb2 |
extern int bind_keyseq_to_unix_command __P((char *));
|
|
|
462fb2 |
|
|
|
462fb2 |
extern char **bash_default_completion __P((const char *, int, int, int, int));
|
|
|
462fb2 |
|
|
|
462fb2 |
+ void set_directory_hook __P((void));
|
|
|
462fb2 |
+
|
|
|
462fb2 |
/* Used by programmable completion code. */
|
|
|
462fb2 |
extern char *command_word_completion_function __P((const char *, int));
|
|
|
462fb2 |
diff -NrC 2 ../bash-4.2-patched/builtins/shopt.def ./builtins/shopt.def
|
|
|
462fb2 |
*** ../bash-4.2-patched/builtins/shopt.def 2010-07-02 22:42:44.000000000 -0400
|
|
|
462fb2 |
--- ./builtins/shopt.def 2012-05-07 16:27:18.000000000 -0400
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 62,65 ****
|
|
|
462fb2 |
--- 62,69 ----
|
|
|
462fb2 |
#include "bashgetopt.h"
|
|
|
462fb2 |
|
|
|
462fb2 |
+ #if defined (READLINE)
|
|
|
462fb2 |
+ # include "../bashline.h"
|
|
|
462fb2 |
+ #endif
|
|
|
462fb2 |
+
|
|
|
462fb2 |
#if defined (HISTORY)
|
|
|
462fb2 |
# include "../bashhist.h"
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 95,99 ****
|
|
|
462fb2 |
extern int no_empty_command_completion;
|
|
|
462fb2 |
extern int force_fignore;
|
|
|
462fb2 |
! extern int dircomplete_spelling;
|
|
|
462fb2 |
|
|
|
462fb2 |
extern int enable_hostname_completion __P((int));
|
|
|
462fb2 |
--- 99,103 ----
|
|
|
462fb2 |
extern int no_empty_command_completion;
|
|
|
462fb2 |
extern int force_fignore;
|
|
|
462fb2 |
! extern int dircomplete_spelling, dircomplete_expand;
|
|
|
462fb2 |
|
|
|
462fb2 |
extern int enable_hostname_completion __P((int));
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 122,125 ****
|
|
|
462fb2 |
--- 126,133 ----
|
|
|
462fb2 |
#endif
|
|
|
462fb2 |
|
|
|
462fb2 |
+ #if defined (READLINE)
|
|
|
462fb2 |
+ static int shopt_set_complete_direxpand __P((char *, int));
|
|
|
462fb2 |
+ #endif
|
|
|
462fb2 |
+
|
|
|
462fb2 |
static int shopt_login_shell;
|
|
|
462fb2 |
static int shopt_compat31;
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 151,154 ****
|
|
|
462fb2 |
--- 159,163 ----
|
|
|
462fb2 |
{ "compat41", &shopt_compat41, set_compatibility_level },
|
|
|
462fb2 |
#if defined (READLINE)
|
|
|
462fb2 |
+ { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
|
|
|
462fb2 |
{ "dirspell", &dircomplete_spelling, (shopt_set_func_t *)NULL },
|
|
|
462fb2 |
#endif
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 536,539 ****
|
|
|
462fb2 |
--- 545,559 ----
|
|
|
462fb2 |
}
|
|
|
462fb2 |
|
|
|
462fb2 |
+ #if defined (READLINE)
|
|
|
462fb2 |
+ static int
|
|
|
462fb2 |
+ shopt_set_complete_direxpand (option_name, mode)
|
|
|
462fb2 |
+ char *option_name;
|
|
|
462fb2 |
+ int mode;
|
|
|
462fb2 |
+ {
|
|
|
462fb2 |
+ set_directory_hook ();
|
|
|
462fb2 |
+ return 0;
|
|
|
462fb2 |
+ }
|
|
|
462fb2 |
+ #endif
|
|
|
462fb2 |
+
|
|
|
462fb2 |
#if defined (RESTRICTED_SHELL)
|
|
|
462fb2 |
/* Don't allow the value of restricted_shell to be modified. */
|
|
|
462fb2 |
Binary files ../bash-4.2-patched/doc/._bashref.pdf and ./doc/._bashref.pdf differ
|
|
|
462fb2 |
diff -NrC 2 ../bash-4.2-patched/doc/bash.1 ./doc/bash.1
|
|
|
462fb2 |
*** ../bash-4.2-patched/doc/bash.1 2011-01-16 15:31:39.000000000 -0500
|
|
|
462fb2 |
--- ./doc/bash.1 2012-05-07 16:27:18.000000000 -0400
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 8949,8952 ****
|
|
|
462fb2 |
--- 8949,8962 ----
|
|
|
462fb2 |
The default bash behavior remains as in previous versions.
|
|
|
462fb2 |
.TP 8
|
|
|
462fb2 |
+ .B direxpand
|
|
|
462fb2 |
+ If set,
|
|
|
462fb2 |
+ .B bash
|
|
|
462fb2 |
+ replaces directory names with the results of word expansion when performing
|
|
|
462fb2 |
+ filename completion. This changes the contents of the readline editing
|
|
|
462fb2 |
+ buffer.
|
|
|
462fb2 |
+ If not set,
|
|
|
462fb2 |
+ .B bash
|
|
|
462fb2 |
+ attempts to preserve what the user typed.
|
|
|
462fb2 |
+ .TP 8
|
|
|
462fb2 |
.B dirspell
|
|
|
462fb2 |
If set,
|
|
|
462fb2 |
diff -NrC 2 ../bash-4.2-patched/doc/bashref.texi ./doc/bashref.texi
|
|
|
462fb2 |
*** ../bash-4.2-patched/doc/bashref.texi 2011-01-16 15:31:57.000000000 -0500
|
|
|
462fb2 |
--- ./doc/bashref.texi 2012-05-07 16:27:18.000000000 -0400
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 4536,4539 ****
|
|
|
462fb2 |
--- 4536,4546 ----
|
|
|
462fb2 |
The default Bash behavior remains as in previous versions.
|
|
|
462fb2 |
|
|
|
462fb2 |
+ @item direxpand
|
|
|
462fb2 |
+ If set, Bash
|
|
|
462fb2 |
+ replaces directory names with the results of word expansion when performing
|
|
|
462fb2 |
+ filename completion. This changes the contents of the readline editing
|
|
|
462fb2 |
+ buffer.
|
|
|
462fb2 |
+ If not set, Bash attempts to preserve what the user typed.
|
|
|
462fb2 |
+
|
|
|
462fb2 |
@item dirspell
|
|
|
462fb2 |
If set, Bash
|
|
|
462fb2 |
diff -NrC 2 ../bash-4.2-patched/tests/shopt.right ./tests/shopt.right
|
|
|
462fb2 |
*** ../bash-4.2-patched/tests/shopt.right 2010-07-02 23:36:30.000000000 -0400
|
|
|
462fb2 |
--- ./tests/shopt.right 2012-05-07 16:27:18.000000000 -0400
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 13,16 ****
|
|
|
462fb2 |
--- 13,17 ----
|
|
|
462fb2 |
shopt -u compat40
|
|
|
462fb2 |
shopt -u compat41
|
|
|
462fb2 |
+ shopt -u direxpand
|
|
|
462fb2 |
shopt -u dirspell
|
|
|
462fb2 |
shopt -u dotglob
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 69,72 ****
|
|
|
462fb2 |
--- 70,74 ----
|
|
|
462fb2 |
shopt -u compat40
|
|
|
462fb2 |
shopt -u compat41
|
|
|
462fb2 |
+ shopt -u direxpand
|
|
|
462fb2 |
shopt -u dirspell
|
|
|
462fb2 |
shopt -u dotglob
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 102,105 ****
|
|
|
462fb2 |
--- 104,108 ----
|
|
|
462fb2 |
compat40 off
|
|
|
462fb2 |
compat41 off
|
|
|
462fb2 |
+ direxpand off
|
|
|
462fb2 |
dirspell off
|
|
|
462fb2 |
dotglob off
|
|
|
462fb2 |
*** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010
|
|
|
462fb2 |
--- patchlevel.h Thu Feb 24 21:41:34 2011
|
|
|
462fb2 |
***************
|
|
|
462fb2 |
*** 26,30 ****
|
|
|
462fb2 |
looks for to find the patch level (for the sccs version string). */
|
|
|
462fb2 |
|
|
|
462fb2 |
! #define PATCHLEVEL 28
|
|
|
462fb2 |
|
|
|
462fb2 |
#endif /* _PATCHLEVEL_H_ */
|
|
|
462fb2 |
--- 26,30 ----
|
|
|
462fb2 |
looks for to find the patch level (for the sccs version string). */
|
|
|
462fb2 |
|
|
|
462fb2 |
! #define PATCHLEVEL 29
|
|
|
462fb2 |
|
|
|
462fb2 |
#endif /* _PATCHLEVEL_H_ */
|