avoid problems with sign-extended "char" operand to is* functions
authorJim Meyering <meyering@redhat.com>
Sat, 26 Apr 2008 07:28:48 +0000 (09:28 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 6 May 2008 06:21:28 +0000 (08:21 +0200)
commit209850fd7e1e89cf8937310878bd22d70e3588a5
tree4f124f7243ad25afb4ca6a2f2fab081a927a3016
parent4d3bf408b9a308a4702ac93546446927c12cc101
avoid problems with sign-extended "char" operand to is* functions

* src/cut.c (set_fields): Apply to_uchar to isblank operands.
* src/uniq.c (find_field): Likewise.
* src/seq.c (scan_arg): Likewise, for isspace.
* tests/misc/uniq: New file.  Test for the above, but only
when isspace(0240).
* tests/Makefile.am (TESTS): Add misc/uniq.
* configure.ac: Use gt_LOCALE_FR.
* tests/check.mk (TESTS_ENVIRONMENT): Propagate LOCALE_FR to scripts.
* NEWS: Mention the bug fixes.

Before this patch, on FreeBSD 6:

  $ printf 'x y z\nx \xa0 y z\n' > in
  $ LC_ALL=fr_FR.UTF-8 uniq -f2 in|tr ' ' .
  x.y.z
  x. .y.z

With the patch:

  $ LC_ALL=fr_FR.UTF-8 uniq -f2 in|tr ' ' .
  x.y.z

This also affected many other locales:
for i in $(locale -a); do test $(LC_ALL=$i ./uniq -f1 in|wc -l)
  = $(LC_ALL=$i uniq -f1 in|wc -l) || echo $i ; done
...
en_GB.ISO8859-1
en_GB.ISO8859-15
en_GB.UTF-8
en_IE.UTF-8
en_NZ.ISO8859-1
en_NZ.ISO8859-15
en_NZ.UTF-8
en_US.ISO8859-1
en_US.ISO8859-15
en_US.UTF-8
...
NEWS
configure.ac
src/cut.c
src/seq.c
src/uniq.c
tests/Makefile.am
tests/check.mk
tests/misc/uniq [new file with mode: 0755]