bin/54031: awk/nawk regression with LANG

dirk.meyer at dinoex.sub.org dirk.meyer at dinoex.sub.org
Wed Jul 2 09:50:15 PDT 2003


>Number:         54031
>Category:       bin
>Synopsis:       awk/nawk regression with LANG
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 02 09:50:13 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Dirk Meyer
>Release:        FreeBSD 5.1-STABLE i386
>Organization:
privat
>Environment:

	LANG=de_DE.ISO_8859-1

>Description:

	regexp matching in awk/nawk:

	if (c !~ /[a-zA-Z]/)

	when var c is set to value "0++" or "000"
	c ~ /[a-zA-Z]/ results in 1
	c !~ /[a-zA-Z]/ results in 0

	like when c contains a normal word.

>How-To-Repeat:

	1)
	simple test:

#!/usr/bin/awk
/[a-zA-Z]/ {
        print "Has a Letter: " $0
}
/[A-Z]/ {
        print "Has a big Letter: " $0
}
/[a-z]/ {
        print "Has a small Letter: " $0
}

	every String matches the first and third command.

samples:

Has a Letter: 
Has a small Letter: 
1
Has a Letter: 1
Has a small Letter: 1
a
Has a Letter: a
Has a small Letter: a
A
Has a Letter: A
Has a big Letter: A
Has a small Letter: A
C
Has a Letter: C
Has a big Letter: C
Has a small Letter: C
Z
Has a Letter: Z
Has a big Letter: Z
Has a small Letter: Z
]
Has a Letter: ]
Has a small Letter: ]



	2)
	start regression test (without install) in:
$ cd /usr/porst/news/cnews && make
$ cd /usr/porst/news/cnews && make test

	output:

: namecheck.awk
test " `echo | awk -f namecheck.awk`" = " empty name" ;
test " `echo a b | awk -f namecheck.awk`" = " white space in name" ;
test " `echo 'a b' | awk -f namecheck.awk`" = " white space in name" ;
test " `(echo a ; echo b) | awk -f namecheck.awk`" = " newline(s) in name" ;
chmod +x namecheck.r
sed -n '/^[^#]/p' namecheck.t >tmp.nc
./namecheck.r <tmp.nc
comp.lang.0++:
saw:
not:    name component does not contain letter
*** Error code 1

Stop in /home/image/usr/ports/current/cnews/work/util.
*** conf/inall terminated

>Fix:

	workaround:

	unset LANG:
$ export LANG=

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


More information about the freebsd-bugs mailing list