[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[coreutils] coreutils-7.0 expr exposes long-standing bug in matlab start
From: |
Nelson H. F. Beebe |
Subject: |
[coreutils] coreutils-7.0 expr exposes long-standing bug in matlab startup script |
Date: |
Mon, 13 Oct 2008 15:08:00 -0600 (MDT) |
I've just filed a bug report with The Mathworks, vendor of the
widely-used Matlab matrix algebra system. Their bin/matlab startup
script (all versions up to current) contains code like this:
if [ `expr "$lscmd" : '.*->.*'` -ne 0 ]; then
With native versions of expr, and expr from GNU coreutils prior to
version 7.0, the expansion of lscmd usually begins "-rw-r--r--", but
the leading hyphen does not cause the word to be treated as an option.
For example:
% expr "-rw-r--r--" : '.*->.*'
0
However, in coreutils expr version 7.0, that hyphen raises an error:
% expr "-rw-r--r--" : '.*->.*'
expr: syntax error
% expr " -rw-r--r--" : '.*->.*'
0
This is NOT a coreutils bug, but since Matlab is widely deployed,
other sites will certainly hit this same bug in the coming days and
weeks, so this is just a heads-up to the coreutils developers.
Here is a typical patch:
% rcsdiff -r1.1 /usr/local/sys/matlab/matlab7.6/bin/matlab
===================================================================
RCS file: /usr/local/sys/matlab/matlab7.6/bin/RCS/matlab,v
retrieving revision 1.1
diff -r1.1 /usr/local/sys/matlab/matlab7.6/bin/matlab
178c178
< # $Revision: 1.1 $ $Date: 2008/10/13 20:40:34 $
---
> # $Revision: 1.2 $ $Date: 2008/10/13 20:48:49 $
211c211
< # $Revision: 1.1 $ $Date: 2008/10/13 20:40:34 $
---
> # $Revision: 1.2 $ $Date: 2008/10/13 20:48:49 $
401c401
< if [ ! "$lscmd" ]; then
---
> if [ ! " $lscmd" ]; then
422,423c422,423
< if [ `expr "$lscmd" : '.*->.*'` -ne 0 ]; then
< filename=`echo "$lscmd" | awk '{ print $NF }'`
---
> if [ `expr " $lscmd" : '.*->.*'` -ne 0 ]; then
> filename=`echo " $lscmd" | awk '{ print $NF }'`
467c467
< RCSHEADER='$Revision: 1.1 $ $Date: 2008/10/13 20:40:34 $'
---
> RCSHEADER='$Revision: 1.2 $ $Date: 2008/10/13 20:48:49 $'
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: address@hidden -
- 155 S 1400 E RM 233 address@hidden address@hidden -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
- [coreutils] coreutils-7.0 expr exposes long-standing bug in matlab startup script,
Nelson H. F. Beebe <=