From: Chet Ramey Date: Sat, 3 Dec 2011 18:49:10 +0000 (-0500) Subject: commit bash-20050728 snapshot X-Git-Tag: bash-3.1-alpha~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d763f92d00437cbd2f9177ad9c727921f5e9370;p=thirdparty%2Fbash.git commit bash-20050728 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index d28a1e359..4b6f60da4 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -11783,3 +11783,20 @@ lib/readline/display.c ---- doc/{bash.1,bashref.texi} - document that the shell uses $TMPDIR when creating temporary files + + 7/20 + ---- +[bash-3.1-alpha1 frozen] + + 7/29 + ---- +builtins/evalstring.c + - make sure that parse_and_execute saves and restores the value of + loop_level, so loops in sourced scripts and eval'd strings don't + mess up the shell's parser state + +bashline.c + - change command_subst_completion_function to suppress appending + any character to a unique completion, instead of a space, unless + the last word in the quoted command substitution completes to a + directory name. In that case we append the expected slash diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index 028131836..608dadce9 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -11527,7 +11527,7 @@ lib/readline/readline.c to use it - rudimentary support for supporting the existing recursion using a stack of contexts, each with a reference to the previous - - fix so that ^G works when in callback mode + - fix so that ^G works when in callback mode lib/readline/callback.c - call the appropriate multiple-key sequence callback if the state is @@ -11783,3 +11783,20 @@ lib/readline/display.c ---- doc/{bash.1,bashref.texi} - document that the shell uses $TMPDIR when creating temporary files + + 7/20 + ---- +[bash-3.1-alpha1 frozen] + + 7/29 + ---- +builtins/evalstring.c + - make sure that parse_and_execute saves and restores the value of + loop_level, so loops in sourced scripts and eval'd strings don't + mess up the shell's parser state + +bashline.c + - change command_subst_completion_function to suppress appending + any character to a unique completion, instead of a space, which + can be misleading when the last word in the quoted command + substitution completes to a directory name diff --git a/bashline.c b/bashline.c index 6af64d9f6..ed33b5322 100644 --- a/bashline.c +++ b/bashline.c @@ -1,6 +1,6 @@ /* bashline.c -- Bash's interface to the readline library. */ -/* Copyright (C) 1987-2004 Free Software Foundation, Inc. +/* Copyright (C) 1987-2005 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -1521,6 +1521,13 @@ command_subst_completion_function (text, state) /* If there is more than one match, rl_completion_matches has already put the lcd in matches[0]. Skip over it. */ cmd_index = matches && matches[0] && matches[1]; + + /* If there's a single match and it's a directory, set the append char + to the expected `/'. Otherwise, don't append anything. */ + if (matches && matches[0] && matches[1] == 0 && test_for_directory (matches[0])) + rl_completion_append_character = '/'; + else + rl_completion_suppress_append = 1; } if (!matches || !matches[cmd_index]) diff --git a/bashline.c~ b/bashline.c~ index 7d641613c..76d0f189f 100644 --- a/bashline.c~ +++ b/bashline.c~ @@ -1,6 +1,6 @@ /* bashline.c -- Bash's interface to the readline library. */ -/* Copyright (C) 1987-2004 Free Software Foundation, Inc. +/* Copyright (C) 1987-2005 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -100,7 +100,7 @@ static int history_and_alias_expand_line __P((int, int)); #endif /* Helper functions for Readline. */ -static int bash_directory_expansion __P((char **)); +static void bash_directory_expansion __P((char **)); static int bash_directory_completion_hook __P((char **)); static int filename_completion_ignore __P((char **)); static int bash_push_line __P((void)); @@ -1073,7 +1073,7 @@ attempt_shell_completion (text, start, end) s = find_cmd_start (start); e = find_cmd_end (end); n = find_cmd_name (s); - if (e > s) + if (e > s && assignment (n, 0) == 0) prog_complete_matches = programmable_completions (n, text, s, e, &foundcs); else foundcs = 0; @@ -1521,6 +1521,11 @@ command_subst_completion_function (text, state) /* If there is more than one match, rl_completion_matches has already put the lcd in matches[0]. Skip over it. */ cmd_index = matches && matches[0] && matches[1]; + + if (matches && matches[0] && matches[1] == 0 && test_for_directory (matches[0])) + rl_completion_append_character = '/'; + else + rl_completion_suppress_append = 1; } if (!matches || !matches[cmd_index]) @@ -1905,7 +1910,7 @@ tcsh_magic_space (count, ignore) else return (1); } -#endif +#endif /* BANG_HISTORY */ /* History and alias expand the line. */ static int @@ -1914,7 +1919,10 @@ history_and_alias_expand_line (count, ignore) { char *new_line; + new_line = 0; +#if defined (BANG_HISTORY) new_line = history_expand_line_internal (rl_line_buffer); +#endif #if defined (ALIAS) if (new_line) @@ -1950,7 +1958,10 @@ shell_expand_line (count, ignore) char *new_line; WORD_LIST *expanded_string; + new_line = 0; +#if defined (BANG_HISTORY) new_line = history_expand_line_internal (rl_line_buffer); +#endif #if defined (ALIAS) if (new_line) @@ -2207,7 +2218,7 @@ bash_ignore_everything (names) /* Simulate the expansions that will be performed by rl_filename_completion_function. This must be called with the address of a pointer to malloc'd memory. */ -static int +static void bash_directory_expansion (dirname) char **dirname; { @@ -2303,9 +2314,12 @@ bash_directory_completion_hook (dirname) if (temp1[len1 - 1] == '/') { len2 = strlen (temp2); - temp2 = (char *)xrealloc (temp2, len2 + 2); - temp2[len2] = '/'; - temp2[len2 + 1] = '\0'; + if (len2 > 2) /* don't append `/' to `/' or `//' */ + { + temp2 = (char *)xrealloc (temp2, len2 + 2); + temp2[len2] = '/'; + temp2[len2 + 1] = '\0'; + } } free (local_dirname); *dirname = temp2; diff --git a/builtins/evalstring.c b/builtins/evalstring.c index f9e161343..636c0f883 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -58,6 +58,7 @@ extern int indirection_level, startup_state, subshell_environment; extern int line_number; extern int last_command_exit_value; extern int running_trap; +extern int loop_level; extern int posixly_correct; int parse_and_execute_level = 0; @@ -105,6 +106,7 @@ parse_and_execute (string, from_file, flags) unwind_protect_jmp_buf (top_level); unwind_protect_int (indirection_level); unwind_protect_int (line_number); + unwind_protect_int (loop_level); if (flags & (SEVAL_NONINT|SEVAL_INTERACT)) unwind_protect_int (interactive); diff --git a/builtins/evalstring.c~ b/builtins/evalstring.c~ index 9c8a4a2ab..f9e161343 100644 --- a/builtins/evalstring.c~ +++ b/builtins/evalstring.c~ @@ -233,7 +233,8 @@ parse_and_execute (string, from_file, flags) * parse_and_execute has not been called recursively AND * we have parsed the full command (string == '\0') AND * we have a simple command without redirections AND - * the command is not being timed + * the command is not being timed AND + * the command's return status is not being inverted * THEN * tell the execution code that we don't need to fork */ diff --git a/jobs.c b/jobs.c index 373cf773d..3f84ad0cc 100644 --- a/jobs.c +++ b/jobs.c @@ -3104,10 +3104,10 @@ set_job_status_and_cleanup (job) if (temp_handler == trap_handler && signal_is_trapped (SIGINT) == 0) temp_handler = trap_to_sighandler (SIGINT); restore_sigint_handler (); - if (temp_handler == SIG_DFL) - termination_unwind_protect (SIGINT); - else if (temp_handler != SIG_IGN) - (*temp_handler) (SIGINT); + if (temp_handler == SIG_DFL) + termination_unwind_protect (SIGINT); + else if (temp_handler != SIG_IGN) + (*temp_handler) (SIGINT); } } }