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 1893370 - RHEL 8 awk (gawk 4.2) will not output expected result when using the "int" function under certain circumstances
Summary: RHEL 8 awk (gawk 4.2) will not output expected result when using the "int" fu...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: gawk
Version: 8.4
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: 8.0
Assignee: Jakub Martisko
QA Contact: Radka Brychtova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-30 21:50 UTC by mkielian@redhat.com
Modified: 2021-05-18 15:06 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 15:05:56 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:1676 0 None None None 2021-05-18 15:05:58 UTC

Comment 1 mkielian@redhat.com 2020-10-30 22:52:14 UTC
Here is a quick summary of the issue: 



The following function is failing: 
Note: Function used to remove a leading zero from string given to awk

Only in RHEL 8.0/8.1/8.2 ( gawk 4.2 ) 

$ echo 012345 | awk '{$0=int($0)}1'


Note: ( No data returned, just CR/LF ) 




The following alternatives do in fact seem to work under RHEL 8 ( gawk 4.2):

$  echo 012345 | awk '{print $0=int($0)}'
12345

$ echo 012345 | awk '{print int($0)}'
12345

$ echo 012345 | awk '{x=$0+0;print x}'
12345



Checking further into this the first alternative is closest to the original one, with one key difference: 


$ echo 012345 | awk '{$0=int($0)}1'
(CR/LF)                          ^----This 1 here seems to be a "shortcut" to print the output of the function,
                                        If any number other than 0 is in this position it evaluates as "true"
                                        It then prints the output, but in RHWL 8 ( gawk 4.2 ) it doesn't output anything.

$  echo 012345 | awk '{print $0=int($0)}'
12345                    ^------------If we explicitly use the "print" command to output the result of the int function, it works properly.
                                        Note: Even in RHEL 8 ( gawk 4.2 )

Comment 2 Jakub Martisko 2020-11-18 10:25:30 UTC
Thanks for the report, I've tried the gawk in Fedora (5.1.0) and it seems to work with the {$0=int($0)}1 pattern, so the problem is just with the RHEL-8 version, I will try the upstream commit you mentioned in your original message.

Comment 9 errata-xmlrpc 2021-05-18 15:05:56 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 (gawk bug fix and enhancement update), 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-2021:1676


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