bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inconsistent treatment of backslash-bang


From: Lawrence D'Oliveiro
Subject: inconsistent treatment of backslash-bang
Date: Wed, 16 Jul 2008 14:47:11 +1200
User-agent: Mutt/1.5.16 (2007-06-09)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O2 -pipe
uname output: Linux theon 2.6.23-gentoo #6 SMP Sat Oct 27 20:31:22 NZDT 2007 
x86_64 AMD Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description:
        In all contexts in which a character "X" has special meaning to bash, 
it should
        be possible to insert that character literally by writing "\X". This 
fails in
        one case: where "X" is "!", and the context is inside double quotes.

Repeat-By:
        Steps to Reproduce:
        1. echo "hi there!0"
        2. echo "hi there\!0"
        3. echo hi there\!0
        4. echo "hi there$0"
        5. echo "hi there\$0"
        6. echo hi there\$0

        Actual Results:  
        1. bash: !0: event not found
        2. hi there\!0
        3. hi there!0
        4. hi there/bin/bash
        5. hi there$0
        6. hi there$0

        Expected Results:  
        1. bash: !0: event not found
        2. hi there!0
        3. hi there!0
        4. hi there/bin/bash
        5. hi there$0
        6. hi there$0

        Note the difference in number 2.

Fix:
The following patch (adding "!" to the "slashify_in_quotes" set) seems to fix
the problem:

--- syntax.h-orig       2006-06-23 05:45:22.000000000 +1200
+++ syntax.h    2008-05-31 16:23:36.000000000 +1200
@@ -23,7 +23,7 @@

 /* Defines for use by mksyntax.c */

-#define slashify_in_quotes "\\`$\"\n"
+#define slashify_in_quotes "\\`$\"!\n"
 #define slashify_in_here_document "\\`$"

 #define shell_meta_chars   "()<>;&|"

Originally reported as Gentoo bug 224309 
<http://bugs.gentoo.org/show_bug.cgi?id=224309>.

Lawrence D'Oliveiro




reply via email to

[Prev in Thread] Current Thread [Next in Thread]