NetBSD Problem Report #42321

From www@NetBSD.org  Sun Nov 15 11:34:31 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 1062763B8CD
	for <gnats-bugs@gnats.netbsd.org>; Sun, 15 Nov 2009 11:34:31 +0000 (UTC)
Message-Id: <20091115113430.8F3A763B844@www.NetBSD.org>
Date: Sun, 15 Nov 2009 11:34:30 +0000 (UTC)
From: alnsn@yandex.ru
Reply-To: alnsn@yandex.ru
To: gnats-bugs@NetBSD.org
Subject: build.sh reports an error (but doesn't stop) in awk script
X-Send-Pr-Version: www-1.0

>Number:         42321
>Category:       misc
>Synopsis:       build.sh reports an error (but doesn't stop) in awk script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 15 11:35:00 +0000 2009
>Closed-Date:    Sun Nov 15 13:39:56 +0000 2009
>Last-Modified:  Sun Nov 15 13:40:03 +0000 2009
>Originator:     Alexander Nasonov
>Release:        NetBSD 5.99.22
>Organization:
>Environment:
NetBSD aa1nb.lan 5.99.22 NetBSD 5.99.22 (MONOLITHIC) #0: Sat Nov 14 16:49:42 GMT 2009  root@aa1nb.lan:/home/alnsn/src/netbsd-current/src/sys/arch/i386/compile/obj/MONOLITHIC i386

>Description:
Every time I run build.sh script, it prints an error in awk script and continues. I don't know whether it affects anything but this annoying message can be easily fixed.

See also bin/42320.

>How-To-Repeat:
$ cd /usr/src
$ LANG=ru_RU.KOI8-R AWK=/usr/bin/awk ./build.sh

or

$ LANG=ru_RU.KOI8-R AWK=/usr/bin/awk sh ./sys/conf/osrelease.sh -m
awk: syntax error at source line 1
 context is
        {print >>>  int($1+$2/100+0.01 <<< 
awk: illegal statement at source line 1

>Fix:
There are three different ways to fix this problem:

1. fix bin/42320

2. apply the patch:
$ cvs diff -U0 ./sys/conf/osrelease.sh
Index: ./sys/conf/osrelease.sh
===================================================================
RCS file: /cvsroot/src/sys/conf/osrelease.sh,v
retrieving revision 1.117
diff -U 0 -r1.117 osrelease.sh
--- ./sys/conf/osrelease.sh     29 Oct 2009 06:33:27 -0000      1.117
+++ ./sys/conf/osrelease.sh     15 Nov 2009 11:23:20 -0000
@@ -48 +48 @@
-       echo $release | $AWK -F. '{print int($1+$2/100+0.01)}'
+       echo $release | $AWK -F. '{print int($1+($2+1)/100)}'


3. apply the patch:
$ cvs diff -U0 ./sys/conf/osrelease.sh                             
Index: ./sys/conf/osrelease.sh
===================================================================
RCS file: /cvsroot/src/sys/conf/osrelease.sh,v
retrieving revision 1.117
diff -U 0 -r1.117 osrelease.sh
--- ./sys/conf/osrelease.sh     29 Oct 2009 06:33:27 -0000      1.117
+++ ./sys/conf/osrelease.sh     15 Nov 2009 11:26:08 -0000
@@ -34,0 +35,3 @@
+LC_NUMERIC=C
+export LC_NUMERIC
+

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: dsl@NetBSD.org
State-Changed-When: Sun, 15 Nov 2009 13:39:56 +0000
State-Changed-Why:
Script changed to not use awk.


From: David Laight <dsl@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42321 CVS commit: src/sys/conf
Date: Sun, 15 Nov 2009 13:39:00 +0000

 Module Name:	src
 Committed By:	dsl
 Date:		Sun Nov 15 13:39:00 UTC 2009

 Modified Files:
 	src/sys/conf: osrelease.sh

 Log Message:
 Use shell builtins instead of awk and sed.
 Avoids problems with awk processing floating point numbers when LC_NUMERIC
 give a decimal point of ','.
 Fixes PR/42321


 To generate a diff of this commit:
 cvs rdiff -u -r1.117 -r1.118 src/sys/conf/osrelease.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.