bin/155778: awk doesn't set error exit status on errors

Dmitry Marakasov amdmi3 at FreeBSD.org
Tue Mar 22 11:00:02 UTC 2011


>Number:         155778
>Category:       bin
>Synopsis:       awk doesn't set error exit status on errors
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 22 11:00:01 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 8.2-RELEASE i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue Mar 8 09:48:52 MSK 2011 root at hades.panopticon:/async/obj/usr/src/sys/HADES i386


>Description:
awk doesn't set error exit status on errors:

% awk '{if ($1 == '1') print 2}' <&- && echo OK || echo FAILED
awk: i/o error occurred on /dev/stdin
 source line number 1
awk: i/o error occurred while closing /dev/stdin
 source line number 1
OK

GNU awk, however, behaves correctly:

% gawk '{if ($1 == '1') print 2}' <&- && echo OK || echo FAILED 
gawk: cmd. line:1: fatal: error reading input file `-': Bad file descriptor
FAILED

>How-To-Repeat:
See description.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list