Bug 23593

Summary: [patch] possible fix to awk(1)
Product: Base System Reporter: kh <kh>
Component: gnuAssignee: David E. O'Brien <obrien>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description kh 2000-12-17 02:50:00 UTC
 Submitter-Id:   current-users
 Originator:     Kouichi Hirabayashi
 Organization:   Mogami Wire & Cable Corp.
 Confidential:   no
 Synopsis:       The printf function of awk(1) does not work correctly.
 Severity:       non-critical
 Priority:       low
 Category:       gnu
 Release:        FreeBSD 3.4-RELEASE i386
 Class:          sw-bug
 Environment: 
 	any
 Description:
 	Here is a sample script to show this problem.
 
 	/usr/bin/awk '
 	BEGIN {
 	  x = 123
 	  printf "%6.0f %06.1f\n", x, x
 	  print "must be printed as"
 	  printf "%6d %06.1f\n", x, x
 	  exit 0
 	}'
 How-To-Repeat:
 	Execute above script.
 Fix: 
 *** /usr/src/contrib/awk/ORGbuiltin.c   Sun Dec 17 11:00:28 2000
 --- /usr/src/contrib/awk/builtin.c      Sun Dec 17 11:01:07 2000
 ***************
 *** 463,469 ****
                         break;
   
                 case '0':
 !                       zero_flag = TRUE;
                         if (lj)
                                 goto retry;
                         /* FALL through */
 --- 463,470 ----
                         break;
   
                 case '0':
 !                       if (!have_prec)
 !                               zero_flag = TRUE;
                         if (lj)
                                 goto retry;
                         /* FALL through */
Comment 1 bill fumerola freebsd_committer freebsd_triage 2001-02-26 21:57:45 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

refiled damaged PR. (pending->gnu)
Comment 2 Poul-Henning Kamp freebsd_committer freebsd_triage 2001-05-29 10:38:52 UTC
Responsible Changed
From-To: freebsd-bugs->obrien

This should be reported back to the gawk people I guess ?
Comment 3 Zak Johnson 2002-06-19 15:22:00 UTC
This PR can be closed.

A similar patch has been committed as of contrib/awk/builtin.c revision
1.1.1.3, and the sample script's output is now correct.

-Zak
Comment 4 David E. O'Brien freebsd_committer freebsd_triage 2002-06-19 18:02:44 UTC
State Changed
From-To: open->closed

similar patch has been committed as of contrib/awk/builtin.c revision 
1.1.1.3, and the sample script's output is now correct.