bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH v7 11/11] gnulib-tool: fall back into copy if symbolic link i


From: Bruno Haible
Subject: Re: [PATCH v7 11/11] gnulib-tool: fall back into copy if symbolic link is not supported
Date: Thu, 08 Jun 2017 14:46:43 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-79-generic; KDE/5.18.0; x86_64; ; )

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  <address@hidden>

        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

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