bug-bash
[Top][All Lists]
Advanced

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

quoted string expansions of octal \001 value occurs twice in Process Sub


From: DeDominic, Anthony
Subject: quoted string expansions of octal \001 value occurs twice in Process Substitution
Date: Fri, 22 Sep 2017 16:53:15 +0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHT    YPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale'
-DPACKAGE='bash'     -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
-I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS
-DDEFAULT_PATH    _VALUE='/usr/local/bin:/usr/bin'  -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2     -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-
switches -specs=/usr/lib    /rpm/redhat/redhat-hardened-cc1 -m64
-mtune=generic -Wno-parentheses -Wno-format-security
uname output: Linux adlinux.sim.gilbarco.com 4.12.13-300.fc26.x86_64 #1
SMP Thu Sep 14 16:00:38 UTC 2    017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.4
Patch Level: 12
Release Status: release

Description:

     an octal/hex value of ctrl-a (\001) expanded by a quoted string
expansion appears to expand twice when in a process substitution. not
all octals expand twice however, such as \002


Repeat-By:
    >(echo -n $'\001' | wc -c)
    outputs 2 (ignoring the permission denied error)
    echo -n $'\001' | wc -c
    outputs 1

I tried to test all octals.

eval "$(for i in {01..77}; do (( 10#$i % 10 > 7 )) && continue; echo
'>(echo -n $'"'\0$i'"' >>test)'; done)"

using `xxd test` you can see there are only repeating \001's
00000000: 0101 0203 0405 0607 0809 0a0b 0c0d 0e0f  ................
...etc

no process substitution
eval "$(for i in {01..77}; do (( 10#$i % 10 > 7 )) && continue; echo
'echo -n $'"'\0$i'"' >>test2'; done)"

`xxd test2`
00000000: 0102 0304 0506 0708 090a 0b0c 0d0e 0f10  ................
...etc
________________________________
________________________________


Please be advised that this email may contain confidential information. If you 
are not the intended recipient, please notify us by email by replying to the 
sender and delete this message. The sender disclaims that the content of this 
email constitutes an offer to enter into, or the acceptance of, any agreement; 
provided that the foregoing does not invalidate the binding effect of any 
digital or other electronic reproduction of a manual signature that is included 
in any attachment.

reply via email to

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