Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16320

Unexpected history expanded in heredoc in $() or <()

From "ladyrick" <ladyrick@qq.com>
Newsgroups gnu.bash.bug
Subject Unexpected history expanded in heredoc in $() or <()
Date 2020-05-29 23:59 +0800
Message-ID <mailman.666.1590785260.2541.bug-bash@gnu.org> (permalink)
References <tencent_487241FE2E73B9237E6574D052A92DD1DE0A@qq.com>

Show all headers | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:&nbsp; -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&nbsp; &nbsp;-I.&nbsp; -I../. -I.././include -I.././lib&nbsp; -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-7fckc0/bash-4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -no-pie -Wno-parentheses -Wno-format-security
uname output: Linux n227-006-177 4.14.81.bm.14-amd64 #1 SMP Debian 4.14.81.bm.14 Sun Aug 25 08:22:56 UTC 2019 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu


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


Description:
	A heredoc starts with "cat <<'EOF'" is expected to not expand anything just like in a single quote string. But when this heredoc is in a $() or <(), history is expanded.


Repeat-By:
	This works:
```
cat <<'EOF'
!!
EOF
```
	This doesn't work:
```
cat <(cat <<'EOF'
!!
EOF
)
```
	This doesn't work neither:
```
echo "$(cat <<'EOF'
!!
EOF
)"
```
	Only when I exec `set +H` to disable history expand, these examples all work.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Unexpected history expanded in heredoc in $() or <() "ladyrick" <ladyrick@qq.com> - 2020-05-29 23:59 +0800

csiph-web