nkabir / shflags

Automatically exported from code.google.com/p/shflags
0 stars 0 forks source link

Variable begins with a hyphen may cause 'expr' error #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Statements execute 'expr' such as:
_flags_opt_=`expr "${_flags_opt_}" : '-\(.*\)'`
should add '--' to prevent error from the variable begins with a hyphen.
i.e., _flags_opt_=`expr -- "${_flags_opt_}" : '-\(.*\)'`

OS: FreeBSD 8.0 Release

Original issue reported on code.google.com by yzlin1...@gmail.com on 17 Dec 2009 at 3:04

GoogleCodeExporter commented 9 years ago
Fixed in r138. I was able to reproduce this in FreeBSD 7.2 on my FreeNAS 0.7.1 
box.

Original comment by kate.war...@gtempaccount.com on 28 Mar 2010 at 6:21

GoogleCodeExporter commented 9 years ago
This patch causes problems. From the man pages of expr on FreeBSD 9.

"The standard -- syntax may be used to prevent this interpretation. However, 
many historic implementations of expr, including the one in previous versions 
of FreeBSD, will not permit this syntax."

It also causes problem on MinGW systems as it uses an expr not compatible with 
the above syntax.

Original comment by pvanderdoes@gmail.com on 28 Dec 2012 at 7:57