]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20060223 snapshot
authorChet Ramey <chet.ramey@case.edu>
Sun, 4 Dec 2011 03:45:40 +0000 (22:45 -0500)
committerChet Ramey <chet.ramey@case.edu>
Sun, 4 Dec 2011 03:45:40 +0000 (22:45 -0500)
CWRU/CWRU.chlog
builtins/hash.def
parse.y

index f354a0d3ca396a74cee75ce89ea7a067fad5e878..4535c6e6c7cda7ab2089000fa162419df77b272d 100644 (file)
@@ -13106,3 +13106,8 @@ lib/readline/readline.c
 lib/readline/display.c
        - further fixes to _rl_make_prompt_for_search from Eric Blake to deal
          with multiple calls to expand_prompt
+
+                                  2/21
+                                  ----
+builtins/hash.def
+       - don't print `hash table empty' message in posix mode
index 7f24c034c2e135d158d90f1cba7e8a01001ce97b..697ffd0a911de44f6e1456e473fb5a0ff3d5b5b6 100644 (file)
@@ -1,7 +1,7 @@
 This file is hash.def, from which is created hash.c.
 It implements the builtin "hash" in Bash.
 
-Copyright (C) 1987-2003 Free Software Foundation, Inc.
+Copyright (C) 1987-2006 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -59,6 +59,7 @@ $END
 #include "common.h"
 #include "bashgetopt.h"
 
+extern int posixly_correct;
 extern int dot_found_in_search;
 extern char *this_command_name;
 
@@ -124,7 +125,8 @@ hash_builtin (list)
      we test expunge_hash_table. */
   if (list == 0 && expunge_hash_table == 0)
     {
-      if (print_hashed_commands (list_portably) == 0)
+      opt = print_hashed_commands (list_portably);
+      if (opt == 0 && posixly_correct == 0)
        printf (_("%s: hash table empty\n"), this_command_name);
 
       return (EXECUTION_SUCCESS);
diff --git a/parse.y b/parse.y
index 37c9e965196fab32855e561e2b322e47c8cb8353..148ae51ddfe1301a4dad4e91efb278cd8caf8020 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -2723,6 +2723,7 @@ read_token (command)
 #define P_ALLOWESC     0x02
 #define P_DQUOTE       0x04
 #define P_COMMAND      0x08    /* parsing a command, so look for comments */
+#define P_BACKQUOTE    0x10    /* parsing a backquoted command substitution */
 
 static char matched_pair_error;
 static char *
@@ -2732,12 +2733,12 @@ parse_matched_pair (qc, open, close, lenp, flags)
      int *lenp, flags;
 {
   int count, ch, was_dollar, in_comment, check_comment;
-  int pass_next_character, nestlen, ttranslen, start_lineno;
+  int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
   char *ret, *nestret, *ttrans;
   int retind, retsize, rflags;
 
   count = 1;
-  pass_next_character = was_dollar = in_comment = 0;
+  pass_next_character = backq_backslash = was_dollar = in_comment = 0;
   check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
 
   /* RFLAGS is the set of flags we want to pass to recursive calls. */
@@ -2749,7 +2750,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
   start_lineno = line_number;
   while (count)
     {
-      ch = shell_getc (qc != '\'' && pass_next_character == 0);
+      ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
 
       if (ch == EOF)
        {
@@ -2778,6 +2779,13 @@ parse_matched_pair (qc, open, close, lenp, flags)
       else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
        in_comment = 1;
 
+      /* last char was backslash inside backquoted command substitution */
+      if (backq_backslash)
+       {
+         backq_backslash = 0;
+         /* Placeholder for adding special characters */
+       }
+
       if (pass_next_character)         /* last char was backslash */
        {
          pass_next_character = 0;
@@ -2816,6 +2824,8 @@ parse_matched_pair (qc, open, close, lenp, flags)
        {
          if MBTEST((flags & P_ALLOWESC) && ch == '\\')
            pass_next_character++;
+         else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
+           backq_backslash++;
          continue;
        }
 
@@ -2900,11 +2910,11 @@ add_nestret:
        }
       else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
        {
-         /* Add P_ALLOWESC so backslash quotes the next character and
+         /* Add P_BACKQUOTE so backslash quotes the next character and
             shell_getc does the right thing with \<newline>.  We do this for
             a measure  of backwards compatibility -- it's not strictly the
             right POSIX thing. */
-         nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_ALLOWESC);
+         nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
          goto add_nestret;
        }
       else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '['))      /* ) } ] */