]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix the handling of symbolic links.
authorBruno Haible <bruno@clisp.org>
Thu, 13 Apr 2006 11:21:27 +0000 (11:21 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:10 +0000 (12:13 +0200)
gettext-tools/misc/ChangeLog
gettext-tools/misc/autopoint.in
gettext-tools/misc/gettextize.in

index 7ac7b38137a1fd3136e80f8a3b5ea9f999b35150..2c1f0da0afd26bcfbef2c545e7a05aa82e2d6c7a 100644 (file)
@@ -1,3 +1,9 @@
+2006-04-12  Bruno Haible  <bruno@clisp.org>
+
+       * autopoint.in (func_find_curr_installdir): Handle the case of a
+       symbolic link pointing to an absolute pathname correctly.
+       * gettextize.in (func_find_curr_installdir): Likewise.
+
 2006-01-23  Bruno Haible  <bruno@clisp.org>
 
        * gettextize.in (func_tmpdir): Invoke mktemp without option -q, because
index b0519bf541790ac5d7c8b123eef068d68084bb94..3a37d39b9d2b927e2d80f819fed1367f9488f0e9 100644 (file)
@@ -101,11 +101,17 @@ func_find_curr_installdir ()
     *) curr_executable=`pwd`/"$curr_executable" ;;
   esac
   # Resolve symlinks.
+  sed_dirname='s,/[^/]*$,,'
+  sed_linkdest='s,^.* -> \(.*\),\1,p'
   while : ; do
     lsline=`LC_ALL=C ls -l "$curr_executable"`
     case "$lsline" in
       *" -> "*)
-        curr_executable=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`/`echo "$lsline" | sed -n -e 's,^.* -> \(.*\),\1,p'` ;;
+        linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
+        case "$linkdest" in
+          /* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
+          *) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
+        esac ;;
       *) break ;;
     esac
   done
index 21f27bba6c70d5e84d94f594dca9d7f5c50dfaf1..3f8e16cc3c9499be1be969bdc046a130d3a7ef15 100644 (file)
@@ -101,11 +101,17 @@ func_find_curr_installdir ()
     *) curr_executable=`pwd`/"$curr_executable" ;;
   esac
   # Resolve symlinks.
+  sed_dirname='s,/[^/]*$,,'
+  sed_linkdest='s,^.* -> \(.*\),\1,p'
   while : ; do
     lsline=`LC_ALL=C ls -l "$curr_executable"`
     case "$lsline" in
       *" -> "*)
-        curr_executable=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`/`echo "$lsline" | sed -n -e 's,^.* -> \(.*\),\1,p'` ;;
+        linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
+        case "$linkdest" in
+          /* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
+          *) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
+        esac ;;
       *) break ;;
     esac
   done