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: Myung-Hun KO
Subject: Re: [PATCH v7 11/11] gnulib-tool: fall back into copy if symbolic link is not supported
Date: Thu, 8 Jun 2017 22:42:28 +0900

Thanks! 

2017. 6. 8. 오후 9:46에 "Bruno Haible" <address@hidden>님이 작성:
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]