]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20050728 snapshot
authorChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 18:49:10 +0000 (13:49 -0500)
committerChet Ramey <chet.ramey@case.edu>
Sat, 3 Dec 2011 18:49:10 +0000 (13:49 -0500)
CWRU/CWRU.chlog
CWRU/CWRU.chlog~
bashline.c
bashline.c~
builtins/evalstring.c
builtins/evalstring.c~
jobs.c

index d28a1e359e97caa25a74b2eb2e0c83bcfe527191..4b6f60da4ec7d24ab961b35c4a1bd8457b092abc 100644 (file)
@@ -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
index 0281318362c51b2e086164156717219f13b9e350..608dadce98fb179b3601fc3bd4b117eb37b54d70 100644 (file)
@@ -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
index 6af64d9f6e21563e37dd18e3a2d3853cacdff839..ed33b532229263444dae188a558ab95a6cab102c 100644 (file)
@@ -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])
index 7d641613c3fd4d4f7accfe77ef38327c128adaef..76d0f189f50499bc1aa54ff7ad3ff314f63657e3 100644 (file)
@@ -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;
index f9e161343ae1c445643a6012a9516ec0bd1f9842..636c0f883603b78958c48f5af441361dd85d8a65 100644 (file)
@@ -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);
 
index 9c8a4a2ab4fbc204170f3dfc76f0a2ca8cce6dae..f9e161343ae1c445643a6012a9516ec0bd1f9842 100644 (file)
@@ -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 373cf773d5cf104411ce53bef523503644eb72bb..3f84ad0cc7504a413c3d4f4a7bc5db9fda32bfda 100644 (file)
--- 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);
            }
        }
     }