This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: glibc testing problem
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Steve Ellcey <sellcey at mips dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 28 Nov 2012 17:43:34 -0500
- Subject: Re: glibc testing problem
- References: <1a677d91-a44c-4558-b3d5-58087026583d@EXCHHUB01.MIPS.com>
On Wed, Nov 28, 2012 at 4:49 PM, Steve Ellcey <sellcey@mips.com> wrote:
> While testing glibc on a MIPS system I was getting failures in tst-fmon.
> After some hunting around I found that the problem wasn't in what my
> glibc was producing but in what was expected. This test uses the data
> file localedata/tst-fmon.data and the script tst-fmon.sh reads that
> with:
>
> while IFS=" " read locale format value expect; do
>
> where there is a tab inside the quote marks. Now some of the lines
> in the data file are separated by two tabs instead of one, like this one:
>
> de_DE.ISO-8859-1 %n 1.23 1,23 EUR
>
> There are two tabs between '1.23' and '1,23 EUR'. Most shells (bash, ksh)
> seem to treat two tabs the same as one and have no problems. But on
> my systems (debian and ubuntu) /bin/sh is a link to dash and dash does not
> treat two tabs like one. It instead considers the second tab as part of the
> next field. This is why the test fails for me.
>
> Consider this script:
>
> echo "y z" | \
> while IFS=" " read a b
> do
> echo "\"$a\"" "\"$b\""
> done
>
> Where there are two tabs between y and z. On my system if I run
> ksh ./script or bash ./script, I get:
>
> "y" "z"
>
> But if I run dash ./script, I get:
>
> "y" " z"
>
> So my question is: what do we do about this? Remove the extra tab from
> the data file, simply say dash isn't supported (the script starts with
> '#!/bin/sh' and /bin/sh on my system is a link to dash), or is there some
> better fix?
That seems like a bug in dash.
POSIX says "<newline><space><tab>foo<tab><tab>bar<space> yields two
fields, foo and bar."
Not "foo" and "<tab>bar".
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_05
Cheers,
Carlos.