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.
Bug 1727952 - Parsing commands break when using $$ in command substitution $(..)
Summary: Parsing commands break when using $$ in command substitution $(..)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: bash
Version: 8.1
Hardware: x86_64
OS: Linux
urgent
high
Target Milestone: rc
: 8.0
Assignee: Siteshwar Vashisht
QA Contact: Karel Volný
URL:
Whiteboard:
Depends On:
Blocks: 1729750
TreeView+ depends on / blocked
 
Reported: 2019-07-08 16:04 UTC by Paul Dwyer
Modified: 2020-11-14 08:34 UTC (History)
8 users (show)

Fixed In Version: bash-4.4.19-10.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1729750 (view as bug list)
Environment:
Last Closed: 2019-11-05 22:25:24 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pdwyer: needinfo-
fkrska: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3594 0 None None None 2019-11-05 22:25:28 UTC

Description Paul Dwyer 2019-07-08 16:04:13 UTC
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 5 Siteshwar Vashisht 2019-07-10 13:14:22 UTC
Upstream discussion https://lists.gnu.org/archive/html/bug-bash/2017-01/msg00065.html

Comment 22 errata-xmlrpc 2019-11-05 22:25:24 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


Note You need to log in before you can comment on or make changes to this bug.