Paul Eggert wrote on 2016-01-15:
> Thanks, I installed the attached somewhat-different patch instead. 
> Please give it a try.

This func_ln_s has a bug: when both arguments are relative and the second one
is in the current directory, the copy source will be wrong. I.e.

  func_ln_s a/b y

will essentially do

  ln -s a/b y || cp -p y/a/b y

where the correct expansion is

  ln -s a/b y || cp -p a/b y

Bruno


2017-06-08  Bruno Haible  <br...@clisp.org>

        gnulib-tool: Fix bug in func_ln_s, from 2016-01-15.
        * gnulib-tool (func_ln_s): Determine cp_src correctly.

diff --git a/gnulib-tool b/gnulib-tool
index a0dc037..e336466 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -784,9 +784,13 @@ func_ln_s ()
 
     case "$1" in
       /* | ?:*) # SRC is absolute.
-        cp_src=$1 ;;
+        cp_src="$1" ;;
       *) # SRC is relative to the directory of DEST.
-        cp_src=${2%/*}/$1 ;;
+        case "$2" in
+          */*) cp_src="${2%/*}/$1" ;;
+          *)   cp_src="$1" ;;
+        esac
+        ;;
     esac
 
     cp -p "$cp_src" "$2"


Reply via email to