FYI: BUG: libtool-1.9f and libtool-1.5.18: "install: you must specify a destination"

2005-07-08 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Wed, Jul 06, 2005 at 07:05:01PM CEST:
> * Juergen Leising wrote on Wed, Jul 06, 2005 at 09:03:49AM CEST:
> > 
> > The following error message appears due to a bug in
> > func_mode_install ():
> > 
> > /bin/sh ../../../libtool --mode=install cp -f  'libeic.la'
> > '/usr/local/lib/bastard/libeic.la'
> > libtool: install: you must specify a destination
> > libtool: install: Try `libtool --help --mode=install' for more
> > information.

> Proposed patch (against HEAD, similar for backport):

I have installed this slightly simpler patch, which also allows
backslash as directory separator, to all branches.  I decided to ignore
the slight chance of misparse that may ensue with a group named `cp':
  install -g cp ...

Cheers,
Ralf

HEAD/branch-2-0:
 
* config/ltmain.m4sh (func_mode_install): Do not assume `-f'
needs an argument if the install program is `cp'.  Cleanup
install mode somewhat.
Reported by Juergen Leising <[EMAIL PROTECTED]>.

Index: config/ltmain.m4sh
===
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.72
diff -u -r1.72 ltmain.m4sh
--- config/ltmain.m4sh  3 Jul 2005 16:55:50 -   1.72
+++ config/ltmain.m4sh  8 Jul 2005 13:41:32 -
@@ -1685,15 +1685,15 @@
 # install_prog (especially on Windows NT).
 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
-   $ECHO "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then
+   $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
   # Aesthetically quote it.
   func_quote_for_eval "$nonopt"
   install_prog="$func_quote_for_eval_result "
-  arg="$1"
+  arg=$1
   shift
 else
   install_prog=
-  arg="$nonopt"
+  arg=$nonopt
 fi
 
 # The real first argument should be the name of the installation program.
@@ -1713,28 +1713,33 @@
 do
   if test -n "$dest"; then
files="$files $dest"
-   dest="$arg"
+   dest=$arg
continue
   fi
 
   case $arg in
   -d) isdir=yes ;;
-  -f) prev="-f" ;;
-  -g) prev="-g" ;;
-  -m) prev="-m" ;;
-  -o) prev="-o" ;;
+  -f)
+   case " $install_prog " in
+   *[[\\\ /]]cp\ *) ;;
+   *) prev=$arg ;;
+   esac
+   ;;
+  -g | -m | -o)
+   prev=$arg
+   ;;
   -s)
stripme=" -s"
continue
;;
-  -*) ;;
-
+  -*)
+   ;;
   *)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
  prev=
else
- dest="$arg"
+ dest=$arg
  continue
fi
;;



branch-1-5:

* ltmain.in (install mode): Do not assume `-f' needs an argument if
the install program is `cp'.  Cleanup install mode somewhat.
Reported by Juergen Leising <[EMAIL PROTECTED]>.

Index: ltmain.in
===
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.76
diff -u -r1.334.2.76 ltmain.in
--- ltmain.in   3 Jul 2005 16:57:34 -   1.334.2.76
+++ ltmain.in   8 Jul 2005 13:42:26 -
@@ -5361,7 +5361,7 @@
 # install_prog (especially on Windows NT).
 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
-   $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+   $echo "X$nonopt" | grep shtool > /dev/null; then
   # Aesthetically quote it.
   arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
   case $arg in
@@ -5374,7 +5374,7 @@
   shift
 else
   install_prog=
-  arg="$nonopt"
+  arg=$nonopt
 fi
 
 # The real first argument should be the name of the installation program.
@@ -5399,28 +5399,31 @@
 do
   if test -n "$dest"; then
files="$files $dest"
-   dest="$arg"
+   dest=$arg
continue
   fi
 
   case $arg in
   -d) isdir=yes ;;
-  -f) prev="-f" ;;
-  -g) prev="-g" ;;
-  -m) prev="-m" ;;
-  -o) prev="-o" ;;
+  -f) 
+   case " $install_prog " in
+   *[\\\ /]cp\ *) ;;
+   *) prev=$arg ;;
+   esac
+   ;;
+  -g | -m | -o) prev=$arg ;;
   -s)
stripme=" -s"
continue
;;
-  -*) ;;
-
+  -*)
+   ;;
   *)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
  prev=
else
- dest="$arg"
+ dest=$arg
  continue
fi
;;




Re: BUG: libtool-1.9f and libtool-1.5.18: "install: you must specify a destination"

2005-07-06 Thread Ralf Wildenhues
Hi Juergen,

* Juergen Leising wrote on Wed, Jul 06, 2005 at 09:03:49AM CEST:
> 
> The following error message appears due to a bug in
> func_mode_install ():
> 
> /bin/sh ../../../libtool --mode=install cp -f  'libeic.la'
> '/usr/local/lib/bastard/libeic.la'
> libtool: install: you must specify a destination
> libtool: install: Try `libtool --help --mode=install' for more
> information.

Acknowledged.

> As one can see, there has been given a destination, so it is not
> the fault of automake/autoconf/make, because it is pretty much
> legitimate to use both "cp -f" and "install -c".
> 
> The reason for this error is, that the -f of "cp" does NOT expect
> any further arguments, as opposed to bsd's "install". cp -f rather means
> "force" and enforces overwriting of any existing files. This is at least 
> true for both of the versions of "cp" under linux (fileutils-4.1) and under 
> freebsd-4.6 (and under irix, iirc). Therefore libtool's treatment of -f 
> in func_mode_install with "cp" MUST NOT be
> 
>   prev="-f"
> 
> However, at least bsd's "install" does know the option -f
> (opposedly to the install used under linux) and does require 
> further arguments. So a short distinction will be necessary. 
> My workaround for this is in libtool (around line 2442) rsp.
> ltmain.sh (line 2053) in func_mode_install ():
*snip*

Thanks for this report.  Unless anyone opposes, I will install this
slightly different fix, which also cleans up install mode a bit.
Failure might basically occur for a coreutils-like package, were that to
use libtool and also install a program named `cp'.

Regards,
Ralf

Proposed patch (against HEAD, similar for backport):

* config/ltmain.m4sh (func_mode_install): Do not assume `-f'
needs an argument if the install program is `cp'.  Cleanup
install mode somewhat.
Reported by Juergen Leising <[EMAIL PROTECTED]>.

Index: config/ltmain.m4sh
===
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.72
diff -u -r1.72 ltmain.m4sh
--- config/ltmain.m4sh  3 Jul 2005 16:55:50 -   1.72
+++ config/ltmain.m4sh  6 Jul 2005 16:59:08 -
@@ -1685,15 +1685,15 @@
 # install_prog (especially on Windows NT).
 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
-   $ECHO "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then
+   $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
   # Aesthetically quote it.
   func_quote_for_eval "$nonopt"
   install_prog="$func_quote_for_eval_result "
-  arg="$1"
+  arg=$1
   shift
 else
   install_prog=
-  arg="$nonopt"
+  arg=$nonopt
 fi
 
 # The real first argument should be the name of the installation program.
@@ -1719,10 +1719,17 @@
 
   case $arg in
   -d) isdir=yes ;;
-  -f) prev="-f" ;;
-  -g) prev="-g" ;;
-  -m) prev="-m" ;;
-  -o) prev="-o" ;;
+  -f)
+   case " $install_prog " in
+   *" cp "* | *"/cp "*)
+ prev= ;;
+   *)
+ prev=$arg ;;
+   esac
+   ;;
+  -g | -m | -o)
+   prev=$arg
+   ;;
   -s)
stripme=" -s"
continue
@@ -1734,7 +1741,7 @@
if test -n "$prev"; then
  prev=
else
- dest="$arg"
+ dest=$arg
  continue
fi
;;