Steven McBride
unread,Aug 17, 2020, 8:52:46 AM8/17/20You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bug-...@gnu.org, ba...@packages.debian.org
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
-Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-fdebug-prefix-map=/build/bash-N2nMjo/bash-4.4.18=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux tau5vbub1 4.15.0-112-generic #113-Ubuntu SMP Thu Jul
9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.4
Patch Level: 20
Release Status: release
Description:
'echo "$(<\"filename\")"' fails with No such file or directory
error.
'echo "$(cat \"filename\")"' also fails no such file or directory
error.
'echo "$(<filename)"' is okay.
'echo $(<"filename")' is okay.
I think I'm doing the nested double quoting correctly.
The quoting is because in my original case 'filename' was
a variable that could contained a filename with spaces in it.
My execution trace:
~ 19>cat fn
w1 w2
~ 20>echo $(<fn)
w1 w2
~ 21>echo $(<"fn")
w1 w2
~ 22>echo "$(<fn)"
w1 w2
~ 23>echo "$(<\"fn\")"
-bash: "fn": No such file or directory
Running "strace" shows that quote marks are not removed in
the failing case:
echo "$(<fn)":
[pid 3708] dup2(4, 1) = 1
[pid 3708] close(4) = 0
[pid 3708] close(3) = 0
[pid 3708] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
>> [pid 3708] openat(AT_FDCWD, "fn", O_RDONLY) = 3
[pid 3708] read(3, "some text\n", 128) = 10
[pid 3708] write(1, "some text\n", 10 <unfinished ...>
[pid 3707] <... read resumed> "some text\n", 128) = 10
[pid 3708] <... write resumed> ) = 10
echo "$(<\"fn\")":
[pid 779] dup2(4, 1) = 1
[pid 779] close(4) = 0
[pid 779] close(3) = 0
[pid 779] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
>> [pid 779] openat(AT_FDCWD, "\"fn\"", O_RDONLY) = -1 ENOENT
(No such file or di
[pid 779] openat(AT_FDCWD, "/usr/share/locale/locale.alias",
O_RDONLY|O_CLOEXE
[pid 779] fstat(3, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
Repeat-By:
echo w1 w2 > filename
echo "$(<\"filename\")"
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]