bug-cvs
[Top][All Lists]
Advanced

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

gnulib/gnulib-tool shell quoting problem for Solaris /bin/sh


From: Mark D. Baushke
Subject: gnulib/gnulib-tool shell quoting problem for Solaris /bin/sh
Date: Tue, 24 Jan 2006 10:25:20 -0800

Greetings,

While trying to run ../gnulib/gnulib-tool on a Solaris 9 system
I have run into problems when /bin/sh is used. 

The workaround appears to be to do

    /bin/bash ../gnulib/gnulib-tool --import

which seems to avoid the problem (/bin/bash is a 2.05 version).

I am getting these two errors:

sed: -e expression #1, char 2: unterminated `s' command
../gnulib/gnulib-tool: .*^I,,: not found
sed: -e expression #1, char 2: unterminated `s' command
../gnulib/gnulib-tool: .*^I,,: not found

I have tracked the problems down to the two for loops in this block of
code starting on line 1152 in the gnulib-tool file:

  # Then the files that are in new-files, but not in old-files:
  already_present=
  for f in `LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files 
| sed -e 's,'^.*"$delimiter"',,'`; do
    case "$f" in
      build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
      lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
      m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
      tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
      *) g="$f" ;;
    esac
    func_add_or_update
  done
  # Then the files that are in new-files and in old-files:
  already_present=true
  for f in `LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files | 
sed -e 's,'^.*"$delimiter"',,'`; do
    case "$f" in
      build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
      lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
      m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
      tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
      *) g="$f" ;;
    esac
    func_add_or_update
  done

The value of $delimeter is a control-I character.

There is a similar construct on line 1083, but that did not seem to
trigger any error messagse from sed, so I probably managed to not
execute it.

To reproduce, checkout the sources for CVS on a Solaris 9 machine and go
to the ccvs and run maint-aux/gnulib-update which in turn runs
'../gnulib/gnulib-tool --import' to do the real work after making sure
everything is okay in the tree.

The attached patch seems to work although you may know of better ways to
do the job.

After using the patch, I only see the Solaris host adding one additional
'-: not found' error message. For example, I see this on the Solaris 9
host:

% maint-aux/gnulib-update
../gnulib/gnulib-tool: -: not found
********************************************************************
Makefile.am needs updating. Use `cvs diff lib/Makefile.gnulib' to
view changes.
********************************************************************
%

while a GNU/Linux host does this:

$ maint-aux/gnulib-update 
********************************************************************
Makefile.am needs updating. Use `cvs diff lib/Makefile.gnulib' to
view changes.
********************************************************************
$ 

A diff of the two trees shows that the same actions have been performed
on the sources, so the extra '-: not found' error is more annoying than
serious.

        Thanks,
        -- Mark

ChangeLog entry:

        * gnulib-tool: Avoid Solaris /bin/sh quoting problems.

Index: gnulib-tool
===================================================================
RCS file: /sources/gnulib/gnulib/gnulib-tool,v
retrieving revision 1.103
diff -u -p -u -p -r1.103 gnulib-tool
--- gnulib-tool 22 Jan 2006 08:31:53 -0000      1.103
+++ gnulib-tool 24 Jan 2006 18:06:18 -0000
@@ -1059,6 +1059,7 @@ func_import ()
   func_tmpdir
   trap 'rm -rf "$tmp"' 0 1 2 3 15
   delimiter='  '
+  subst="s,$delimiter.*,,"
   for f in $old_files; do
     case "$f" in
       build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
@@ -1080,7 +1081,7 @@ func_import ()
     echo "$g""$delimiter""$f"
   done | LC_ALL=C sort > "$tmp"/new-files
   # First the files that are in old-files, but not in new-files:
-  for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files 
| sed -e 's,'"$delimiter"'.*,,'`; do
+  for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files 
| sed -e "$subst"`; do
     # Remove the file. Do nothing if the user already removed it.
     if test -f "$destdir/$g"; then
       if $doit; then
@@ -1151,7 +1152,7 @@ func_import ()
   }
   # Then the files that are in new-files, but not in old-files:
   already_present=
-  for f in `LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files 
| sed -e 's,'^.*"$delimiter"',,'`; do
+  for f in `LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files 
| sed -e "$subst"`; do
     case "$f" in
       build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
       lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
@@ -1163,7 +1164,7 @@ func_import ()
   done
   # Then the files that are in new-files and in old-files:
   already_present=true
-  for f in `LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files | 
sed -e 's,'^.*"$delimiter"',,'`; do
+  for f in `LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files | 
sed -e "$subst"`; do
     case "$f" in
       build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
       lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;




reply via email to

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