gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] TRUENAME fails for certain symlinks


From: Magnus Henoch
Subject: [Gcl-devel] TRUENAME fails for certain symlinks
Date: Wed, 04 May 2005 13:14:29 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (berkeley-unix)

TRUENAME fails to get the truename of an absolute symlink when the
symlink is referred to by an absolute path.  The following shell
commands reproduce the problem:

cd /tmp
touch foo
ln -s foo bar
echo '(truename "/tmp/bar")' | gclcvs
[...]
Error: Cannot get the truename of #P"/tmp/bar".

This is with gclcvs 2.7.0-36 on Debian/i386.  With gcl 2.6.6-1 it
gives #P"/tmp/foo" as expected.

This patch seems to fix the problem.

--- unixfsys.c  06 Feb 2005 18:17:36 +0100      1.20
+++ unixfsys.c  01 May 2005 21:17:38 +0200      
@@ -245,8 +245,10 @@
            newlen=readlink(filename,newname,MAXPATHLEN-1);
            if (newlen < 0)
                return(file_error("Symlink broken at ~S.",pathname));
-           for (p = filename, q = 0;  *p != '\0';  p++)
-                   if (*p == '/') q = p;
+           q = 0;
+           if (newname[0] != '/')
+                   for (p = filename;  *p != '\0';  p++)
+                           if (*p == '/') q = p;
            if (q == 0)
                q = filename;
            else

Magnus





reply via email to

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