Bug 1893370

Summary: RHEL 8 awk (gawk 4.2) will not output expected result when using the "int" function under certain circumstances
Product: Red Hat Enterprise Linux 8 Reporter: mkielian <mkielian>
Component: gawkAssignee: Jakub Martisko <jamartis>
Status: CLOSED ERRATA QA Contact: Radka Brychtova <rskvaril>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.4CC: rskvaril
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:05:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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