Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11276
| From | Stephane Chazelas <stephane.chazelas@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | problem with {Z..a} and backticks |
| Date | 2015-07-29 14:11 +0100 |
| Message-ID | <mailman.7604.1438175516.904.bug-bash@gnu.org> (permalink) |
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_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 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall
uname output: Linux host 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.3
Patch Level: 11
Release Status: release
Also reproduced with git head from a couple of weeks ago.
Description:
As {Z..a} includes the ` character, that seems to cause
confusion and can even cause commands to be executed:
$ bash -xc 'echo {Z..a}'
+ echo Z '[' '' ']' '^' _ '`' a
Z [ ] ^ _ ` a
OK (well, see how the backslash between [ and ] was removed), but:
$ bash -xc 'echo {Z..a}x'
bash: bad substitution: no closing "`" in `x
$ bash -xc 'echo {Z..a}uname`id -u`'
++ id -u
++ id -u
++ id -u
++ id -u
++ id -u
++ id -u
++ uname
++ id -u
+ echo Zuname1000 '[uname1000' uname1000 ']uname1000' '^uname1000' _uname1000 'Linuxid -u`' auname1000
Zuname1000 [uname1000 uname1000 ]uname1000 ^uname1000 _uname1000 Linuxid -u` auname1000
See how for `, uname was executed, but not id -u.
Since like ksh93, bash only allows ASCII a-zA-Z for the range
boundaries, it may be better to reject mixed-case ranges like
ksh93 does, or do like zsh and accept any character and sort by
codepoint (may not be possible/desirable the way braces are
expanded early in bash).
--
Stephane
Back to gnu.bash.bug | Previous | Next | Find similar
problem with {Z..a} and backticks Stephane Chazelas <stephane.chazelas@gmail.com> - 2015-07-29 14:11 +0100
csiph-web