[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portability problems of "Usual Tools" not described in manual
From: |
Eric Blake |
Subject: |
Re: Portability problems of "Usual Tools" not described in manual |
Date: |
Tue, 17 Mar 2009 12:09:20 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[adding bug-coreutils]
According to Russ Allbery on 3/17/2009 11:10 AM:
>>> bash-3.1$ expr "X$baz" : 'X\(foo\)$' || echo baz
>>> foo
>> I'm assuming this was from an older version of coreutils? Can someone
>> determine 'expr --version' in the broken case, to see when it was fixed?
>
> address@hidden:~$ expr "X$baz" : 'X\(foo\)$' || echo baz
> foo
> address@hidden:~$ expr --version
> expr (GNU coreutils) 5.97
>
> address@hidden:~$ baz='foo
>> bar'
> address@hidden:~$ expr "X$baz" : 'X\(foo\)$' || echo baz
>
> baz
> address@hidden:~$ expr --version
> expr (GNU coreutils) 6.10
>
> There's no mention that I can find in the coreutils NEWS file, though, in
> a quick search for "expr".
I see it, although it is indirect, and looks like a side effect of a
related change for regex cleanup. The news for 6.0 states:
expr no longer complains about leading ^ in a regular expression
(the anchor is ignored), or about regular expressions like A** (the
second "*" is ignored). expr now exits with status 2 (not 3) for
errors it detects in the expression's values; exit status 3 is now
used only for internal errors (such as integer overflow, which expr
now checks for).
POSIX seems to be a bit ambiguous on this point. It states that BRE
anchors exist to limit "matching strings that begin or end a line", so it
is not obvious whether the presence of a newline in the string parsed by
expr counts as two lines or one overall string. But if most other
implementations treat the $ as the anchor only of the overall string, then
perhaps the coreutils NEWS item should be reworded to make it prominent
that this behavior change was intentional.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkm/51AACgkQ84KuGfSFAYBFuACgqTVEGaC2Pc7o4HTNfeus0O2c
fYwAn0p8ex3kpzY0w9M4z/ZOCdRB2KMJ
=G2fe
-----END PGP SIGNATURE-----
- Re: Portability problems of "Usual Tools" not described in manual,
Eric Blake <=