From: Bruno Haible Date: Thu, 13 Apr 2006 11:21:27 +0000 (+0000) Subject: Fix the handling of symbolic links. X-Git-Tag: v0.15~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6379b77efe0fd57f0067aa4928f3dd0e683b7d89;p=thirdparty%2Fgettext.git Fix the handling of symbolic links. --- diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index 7ac7b3813..2c1f0da0a 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,3 +1,9 @@ +2006-04-12 Bruno Haible + + * 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 * gettextize.in (func_tmpdir): Invoke mktemp without option -q, because diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in index b0519bf54..3a37d39b9 100644 --- a/gettext-tools/misc/autopoint.in +++ b/gettext-tools/misc/autopoint.in @@ -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 diff --git a/gettext-tools/misc/gettextize.in b/gettext-tools/misc/gettextize.in index 21f27bba6..3f8e16cc3 100644 --- a/gettext-tools/misc/gettextize.in +++ b/gettext-tools/misc/gettextize.in @@ -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