bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool: fix filelist for AIX, HP-UX ksh


From: Ralf Wildenhues
Subject: gnulib-tool: fix filelist for AIX, HP-UX ksh
Date: Sun, 17 Jan 2010 02:06:03 +0100
User-agent: Mutt/1.5.20 (2009-10-28)

AIX and HP-UX ksh do not like expanding an empty variable in a
double-quoted shell case pattern:

$ sh -c 'foo=""; case x in "$foo"*) echo good;; $foo*) echo hmm;; esac'
hmm
$ bash -c 'foo=""; case x in "$foo"*) echo good;; $foo*) echo hmm;; esac'
good

This causes differences in the generated {gllib,gltests}/Makefile.am
files.

The fix is to simply avoid the quotes.  I added a documentation note
of caution, although I think this isn't even necessary in practice,
as the shell does not do word splitting after variable expansion here.

This may still need mention in autoconf.texi.

Thanks,
Ralf

    gnulib-tool: fix filelist for AIX, HP-UX ksh.
    
    * gnulib-tool (func_filter_filelist): Do not quote possibly-empty
    variables in shell case patterns, for AIX and HP-UX ksh.

diff --git a/gnulib-tool b/gnulib-tool
index 00b5138..7d724a8 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -1428,6 +1428,7 @@ func_get_filelist ()
 # elements starting with prefix and ending with suffix are considered.
 # Processing: removed_prefix and removed_suffix are removed from each element,
 # added_prefix and added_suffix are added to each element.
+# prefix, suffix should not contain shell-special characters.
 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
 # added_prefix, added_suffix should not contain the characters \|&.
 func_filter_filelist ()
@@ -1440,7 +1441,7 @@ func_filter_filelist ()
     ffflist=
     for fff in $3; do
       case "$fff" in
-        "$4"*"$5")
+        $4*$5)
           if test -n "$6"; then
             func_remove_prefix fff "$6"
           fi
@@ -1460,7 +1461,7 @@ func_filter_filelist ()
     sed_fff_filter="s|^$6\(.*\)$7\$|$8\\1$9|"
     ffflist=`for fff in $3; do
                case "$fff" in
-                 "$4"*"$5") echo "$fff" ;;
+                 $4*$5) echo "$fff" ;;
                esac
              done | sed -e "$sed_fff_filter"`
   fi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]