Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
When using $$ in command substitutionusing $(...) the command is not parsed correctly, the same command works fine in bash on earlier versions of RHEL (e.g. 4, 5, 6, 7)
Version-Release number of selected component (if applicable):
bash-4.4.19-7.el8.x86_64
How reproducible:
always
Steps to Reproduce:
1. run A=$(awk -v p=$$ '{print $0}' <testfile)
2. returns awk error ass command is not parsed correctly
3.
Actual results:
# A=$(awk -v p=$$ '{print $0}' <testfile)
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options: GNU long options: (standard)
-f progfile --file=progfile
-F fs --field-separator=fs
-v var=val --assign=var=val
Short options: GNU long options: (extensions)
-b --characters-as-bytes
-c --traditional
-C --copyright
-d[file] --dump-variables[=file]
-D[file] --debug[=file]
-e 'program-text' --source='program-text'
-E file --exec=file
-g --gen-pot
-h --help
-i includefile --include=includefile
-l library --load=library
-L[fatal|invalid] --lint[=fatal|invalid]
-M --bignum
-N --use-lc-numeric
-n --non-decimal-data
-o[file] --pretty-print[=file]
-O --optimize
-p[file] --profile[=file]
-P --posix
-r --re-interval
-s --no-optimize
-S --sandbox
-t --lint-old
-V --version
To report bugs, see node `Bugs' in `gawk.info'
which is section `Reporting Problems and Bugs' in the
printed version. This same information may be found at
https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.
PLEASE do NOT try to report bugs by posting in comp.lang.awk.
gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.
Examples:
gawk '{ sum += $1 }; END { print sum }' file
gawk -F: '{ print $1 }' /etc/passwd
# echo $?
1
cat $A
Expected results:
# A=$(awk -v p=$$ '{print $0}' <testfile)
# echo $?
0
Additional info:
running this under bash -x see there is no space after the substition of the pid from $$
# A=$(awk -v p=$$ '{print $0}' <testfile)
++ awk -v 'p=3749{print $0}' <-- no space between pid and "{"
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
Command runs successfully if you add an extra space e.g.
# A=$(awk -v p=$$ '{print $0}' <testfile)
++ awk -v p=3749 '{print $0}'
+ A='Some multi line
text
test
more text'
...
This only appears to be when running a command substitution with $()
works fine when using backticks e.g.
# A=`awk -v p=$$ '{print $0}' <testfile`
++ awk -v p=3749 '{print $0}'
+ A='Some multi line
text
test
more text'
...
Comment 5Siteshwar Vashisht
2019-07-10 13:14:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2019:3594
Description of problem: When using $$ in command substitutionusing $(...) the command is not parsed correctly, the same command works fine in bash on earlier versions of RHEL (e.g. 4, 5, 6, 7) Version-Release number of selected component (if applicable): bash-4.4.19-7.el8.x86_64 How reproducible: always Steps to Reproduce: 1. run A=$(awk -v p=$$ '{print $0}' <testfile) 2. returns awk error ass command is not parsed correctly 3. Actual results: # A=$(awk -v p=$$ '{print $0}' <testfile) Usage: awk [POSIX or GNU style options] -f progfile [--] file ... Usage: awk [POSIX or GNU style options] [--] 'program' file ... POSIX options: GNU long options: (standard) -f progfile --file=progfile -F fs --field-separator=fs -v var=val --assign=var=val Short options: GNU long options: (extensions) -b --characters-as-bytes -c --traditional -C --copyright -d[file] --dump-variables[=file] -D[file] --debug[=file] -e 'program-text' --source='program-text' -E file --exec=file -g --gen-pot -h --help -i includefile --include=includefile -l library --load=library -L[fatal|invalid] --lint[=fatal|invalid] -M --bignum -N --use-lc-numeric -n --non-decimal-data -o[file] --pretty-print[=file] -O --optimize -p[file] --profile[=file] -P --posix -r --re-interval -s --no-optimize -S --sandbox -t --lint-old -V --version To report bugs, see node `Bugs' in `gawk.info' which is section `Reporting Problems and Bugs' in the printed version. This same information may be found at https://www.gnu.org/software/gawk/manual/html_node/Bugs.html. PLEASE do NOT try to report bugs by posting in comp.lang.awk. gawk is a pattern scanning and processing language. By default it reads standard input and writes standard output. Examples: gawk '{ sum += $1 }; END { print sum }' file gawk -F: '{ print $1 }' /etc/passwd # echo $? 1 cat $A Expected results: # A=$(awk -v p=$$ '{print $0}' <testfile) # echo $? 0 Additional info: running this under bash -x see there is no space after the substition of the pid from $$ # A=$(awk -v p=$$ '{print $0}' <testfile) ++ awk -v 'p=3749{print $0}' <-- no space between pid and "{" Usage: awk [POSIX or GNU style options] -f progfile [--] file ... Usage: awk [POSIX or GNU style options] [--] 'program' file ... Command runs successfully if you add an extra space e.g. # A=$(awk -v p=$$ '{print $0}' <testfile) ++ awk -v p=3749 '{print $0}' + A='Some multi line text test more text' ... This only appears to be when running a command substitution with $() works fine when using backticks e.g. # A=`awk -v p=$$ '{print $0}' <testfile` ++ awk -v p=3749 '{print $0}' + A='Some multi line text test more text' ...