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