On 08/07/2012 10:24 AM, Jim Meyering wrote:
> +    if expr "X$option" : 'X-[0-9]\+$' > /dev/null; then

This part of the patch is not portable, since '\+' is
a GNU extension, and its behavior isn't specified by POSIX.

To fix this I installed the following zgrep.in patch.
This diff is relative to the zgrep.in before the current
series of patches, since that makes it easier to review.
The basic idea is to avoid the use of expr here, and
rely just on shell pattern-matching; that's more efficient
anyway.

--- a/zgrep.in
+++ b/zgrep.in
@@ -65,7 +65,7 @@ while test $# -ne 0; do
   optarg=
 
   case $option in
-  (-[0123456789EFGHIKLPRTUVZabchilnoqrsuvwxyz]?*)
+  (-[0123456789EFGHIKLPRTUVZabchilnoqrsuvwxyz]*[!0123456789]*)
     arg2=-\'$(expr "X$option" : 'X-.[0-9]*\(.*\)' | sed "$escape")
     eval "set -- $arg2 "'${1+"$@"}'
     option=$(expr "X$option" : 'X\(-.[0-9]*\)');;


Reply via email to