[Top][All Lists]

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

String concatenation bug in bash-3.1.17

From: Igor Peshansky
Subject: String concatenation bug in bash-3.1.17
Date: Sat, 5 Aug 2006 22:06:11 -0400 (EDT)

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: cygwin
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc' 
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H 
-DRECYCLES_PIDS   -I.  -I/tmp/bash-3.1 -I/tmp/bash-3.1/include 
-I/tmp/bash-3.1/lib   -O2
uname output: CYGWIN_NT-5.1 pechtcha 1.7.0(0.159/4/2) 2006-07-29 22:39 i686 
Machine Type: i686-pc-cygwin

Bash Version: 3.1
Patch Level: 17
Release Status: release

        Attempting to embed a substring variable expansion that produces
        an empty string in another string results in an extra \177
        character.  A separately quoted substring expression is fine.

        Also observed in bash 3.1 patchlevel 16 on Debian.

        echo -n "${str:2}" | od -c
        echo -n "+${str:2}" | od -c
        echo -n "+""${str:2}" | od -c

        Observe that the first "echo" prints nothing, the last echo prints
        a lone '+', but the second echo prints a '+' followed by \177.
        This happens for strings of any length, as long as the substring
        count is exactly equal to the length of the string (or use

        echo -n "+${str:${#str}}" | od -c


        Apparently, a call to remove_quoted_nulls() is missing somewhere.
        Haven't investigated further yet.

      |\      _,,,---,,_            address@hidden | address@hidden
ZZZzz /,`.-'`'    -.  ;-;;,_            Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'           old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

reply via email to

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