[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] coreutils-7.0 expr exposes long-standing bug in matlab s
From: |
Eric Blake |
Subject: |
Re: [coreutils] coreutils-7.0 expr exposes long-standing bug in matlab startup script |
Date: |
Wed, 22 Oct 2008 20:57:25 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Martin Knapp-Cordes on 10/22/2008 12:17 PM:
> This means that the MATLAB startup shell script is indeed
> not Open Group compliant. Obviously, no change will be
> necessary to the script if the proposed fixes are approved,
> as they appear to be.
>
> However, this non-compliance is somewhat of a concern and a
> minimum time frame for a fix has been established, but
> the actual details still need to be worked out.
As pointed out earlier in this thread, and also in
http://www.gnu.org/software/autoconf/manual/autoconf.html#Limitations-of-Usual-Tools,
expr X"$string" : X'regex'
coupled with any necessary postprocessing to account for the leading X,
provides a portable solution for the case when $string starts with -,
across ALL known implementations of expr (whether or not they obey the
POSIX rules to honor --, and whether or not they provide options as
extensions to POSIX).
In the case of numeric analysis, you can use a leading '0 +' to avoid
problems with interpreting a negative number as an option.
And finally, in the particular example that started this thread:
if [ `expr "$lscmd" : '.*->.*'` -ne 0 ]; then
# do stuff here...
fi
can be rewritten as the following faster alternative (completely avoiding
a fork, and any expr bugs, altogether):
case $lscmd in
*'->'* ) ;;
*) # do stuff here...
;;
esac
- --
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
iEYEARECAAYFAkj/6BUACgkQ84KuGfSFAYB5OgCeKQfVV0SY9ktVq5VCSIaSNj7F
5+sAnR7Sgmg/WZOJ+fXSLEKUpPVSUcSQ
=hKqD
-----END PGP SIGNATURE-----
- Re: [coreutils] coreutils-7.0 expr exposes long-standing bug in matlab startup script, (continued)
Re: [coreutils] coreutils-7.0 expr exposes long-standing bug in matlab startup script, Jim Meyering, 2008/10/15
Re: [coreutils] coreutils-7.0 expr exposes long-standing bug in matlab startup script, Pádraig Brady, 2008/10/16
Re: [coreutils] coreutils-7.0 expr exposes long-standing bug in matlab startup script, Martin Knapp-Cordes, 2008/10/21