Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15995
| From | Sherwood Wang <sherwood@wang.onl> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | An exported function is malformed if it contains a nested function definition with heredoc |
| Date | 2020-03-06 22:48 +0800 |
| Message-ID | <mailman.2177.1583509179.2412.bug-bash@gnu.org> (permalink) |
| References | <3ec210c3a23f1ad8ad73a3093766c934d50fa3f6.camel@wang.onl> |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-
5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux hostname 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1
(2020-01-26) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 3
Release Status: release
Description:
A function containing a nested function definition with heredoc
cannot be serialized into the environment variable correctly,
and leads to failures in a subshell.
See also:
https://stackoverflow.com/questions/60564674/exporting-a-function-with-a-nested-function-definition-and-heredoc-in-bash
Repeat-By:
Create a script:
#!/bin/bash
f() {
g() {
cat <<EOF
EOF
}
g
}
export -f f
bash -c ':'
Executing it yields the following error:
bash: f: line 8: syntax error: unexpected end of file
bash: error importing function definition for `f'
Back to gnu.bash.bug | Previous | Next | Find similar
An exported function is malformed if it contains a nested function definition with heredoc Sherwood Wang <sherwood@wang.onl> - 2020-03-06 22:48 +0800
csiph-web