Hello! On Wed, Feb 13, 2008 at 08:53:01AM +0100, Jim Meyering wrote: > Thomas Schwinge <[EMAIL PROTECTED]> wrote: > > $ readlink -f a/../a/f > > $ echo $? > > 1 > ... > > readlink (GNU coreutils) 5.97 > > > > Why doesn't it resolve the latter case just as the previous ones? > > Because there are two symbolic links involved? Or two times the same > > one? Strange. > > Thanks for the report. > That's because the code concluded it had encountered a cycle. > The bug was fixed for coreutils-6.9.90 via a change to gnulib's > canonicalize module.
For posterity. I need this functionality in a somewhat portable build environment, so this is what I'm using in `configure.ac' now: #v+ [...] [# Test for a readlink bug, see # <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00126.html>.] AC_MSG_CHECKING([for a suitable ``readlink -f'' program]) [mkdir readlink-test && mkdir readlink-test/a-long && : > readlink-test/a-long/f && ln -s a-long readlink-test/a && for READLINK_F in \ 'readlink -f' \ realpath \ false do if $READLINK_F > /dev/null 2>&1 \ readlink-test/a/../a/f then break fi done && rm -rf readlink-test && if [ "$READLINK_F" = false ] then] AC_MSG_RESULT([none found, using own replacement]) [READLINK_F='perl -e '\''use Cwd qw(abs_path); print abs_path $$ARGV[0];'\' else] AC_MSG_RESULT([$READLINK_F]) [fi] AC_SUBST([READLINK_F]) [...] #v- Regards, Thomas
signature.asc
Description: Digital signature
_______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
