NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/58421: awk(1) goes into infinite loop when reading dirs. on tmpfs



The following reply was made to PR bin/58421; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: Robert Elz <kre%munnari.OZ.AU@localhost>
Subject: Re: bin/58421: awk(1) goes into infinite loop when reading dirs. on
 tmpfs
Date: Sun, 14 Jul 2024 22:20:53 +0000 (UTC)

 On Fri, 12 Jul 2024, Robert Elz wrote:
 
 >   | +		isrec = (found == 0 && *buf == '\0') ? false : true;
 >
 > Surely that's just:
 > 		isrec = !(found == 0 && *buf == '\0');
 > or simplified:
 > 		isrec = found != 0 || *buf != '\0';
 > or if you prefer brevity:
 > 		isrec = found || *buf;
 >
 > Why bother with the ? : operator in a case like that?
 >
 >
 >   | +		isrec = (c == EOF && rr == buf) ? false : true;
 >
 > And similarly there:
 > 		isrec = c != EOF || rr != buf;
 >
 
 :) All true, except, this should go upstream. Even the latest version is like
 that:
 
 https://github.com/onetrueawk/awk/blob/master/lib.c#L251
 
 (Just wanted to get someone to update awk with this PR, actually.)
 
 Cheers!
 
 -RVP
 


Home | Main Index | Thread Index | Old Index