[ clisp-Bugs-3467762 ] delete-file cannot delete directory symlink

SourceForge.net <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
Bugs item #3467762, was opened at 2011-12-30 18:52
Message generated for change (Settings changed) made by sds
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3467762&group_id=1355

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: clisp
Group: lisp error
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Gabor Balazs (gabalz)
>Assigned to: Sam Steingold (sds)
Summary: delete-file cannot delete directory symlink

Initial Comment:

The delete-file function can remove file and dead symlinks but not (alive) directory symlinks, because it always resolves the provided pathname in the directory symlink case even if it should not (according to the CLISP documentation) :

    "(DELETE-FILE pathname) deletes the pathname PATHNAME, not its TRUENAME, ..."

Problem reconstruction:
~~~~~~~~~~~~~~~~~~

ls -lR
drwxr-xr-x 2 bege users 4096 Dec 30 19:40 dir
-rw-r--r-- 1 bege users    0 Dec 30 19:26 file
lrwxrwxrwx 1 bege users    4 Dec 30 19:26 link-dead -> dead/
lrwxrwxrwx 1 bege users    3 Dec 30 19:26 link-dir -> dir
lrwxrwxrwx 1 bege users    4 Dec 30 19:26 link-file -> file

./dir:
-rw-r--r-- 1 bege users 0 Dec 30 19:40 dir-file

Then
(delete-file "dir")
*** - DELETE-FILE: "/home/bege/TEST/dir" names a directory, not a file
so the provided pathname is resolved.

However,
(delete-file "link-file")
deletes the link-file link (properly), so in this case the provided pathname is not resolved.

(delete-file "link-dead") works properly too without resolving the dead symlink.

Desired behaviour:
~~~~~~~~~~~~~~
delete-file should not resolve the pathname for a directory symlink and should delete the symlink without error.

Version
~~~~~~
clisp --version
GNU CLISP 2.49 (2010-07-07) (built 3529014440) (memory 3529014964)
Software: GNU C 4.5.3 
gcc -O2 -march=core2 -fomit-frame-pointer -pipe -Wa,--noexecstack -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O -falign-functions=4 -pthread -DENABLE_UNICODE -DMULTITHREAD -DPOSIX_THREADS -DDYNAMIC_FFI -I. -Wl,-O1 -Wl,--as-needed  /usr/lib64/libreadline.so -lncurses -ldl /usr/lib64/libavcall.a /usr/lib64/libcallback.a  -L/usr/lib64 -lsigsegv -L/usr/lib64 -lc libgnu_cl.a 
SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.8
libreadline 6.2
Features: 
(READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP
 LISP=CL INTERPRETER MT SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI
 GETTEXT UNICODE BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp readline)
Installation directory: /usr/lib64/clisp-2.49/
User language: ENGLISH
Machine: X86_64 (X86_64) localhost [127.0.0.1]


----------------------------------------------------------------------

>Comment By: Sam Steingold (sds)
Date: 2012-04-27 12:30

Message:
as explained in http://clisp.org/impnotes/dir-is-not-file.html,
you  should use delete-directory for symlinks to directories.
however, that also fails.
I fixed that in the sources, thanks.

----------------------------------------------------------------------

Comment By: Sam Steingold (sds)
Date: 2012-04-27 12:30

Message:
thank you for your bug report.
the bug has been fixed in the source tree (mercurial/hg).
you can either wait for the next release (recommended)
or check out the current mercurial tree (see http://clisp.org)
and build CLISP from the sources (be advised that between
releases the source tree is very unstable and may not even build
on your platform).

----------------------------------------------------------------------

Comment By: Gabor Balazs (gabalz)
Date: 2011-12-30 18:55

Message:
Sorry, there is a mistake in the description, but the error exist. So
correctly,

(delete-file "link-dir")
*** - DELETE-FILE: "/home/bege/TEST/dir" names a directory, not a file

/ instead of (delete-file "dir") /


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3467762&group_id=1355

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.