bug-gnu-emacs
[Top][All Lists]
Advanced

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

delete-file fails on symlinks to directories


From: David Casperson
Subject: delete-file fails on symlinks to directories
Date: Mon, 6 Dec 2004 22:43:09 -0800 (PST)

In GNU Emacs 21.3.1 (sparc-sun-solaris2.8, X toolkit)
 of 2003-05-25 on csfac007.unbc.ca
configured using `configure  --prefix=/ld1/local'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: en_US.ISO8859-1
  value of $LC_CTYPE: en_US.ISO8859-1
  value of $LC_MESSAGES: C
  value of $LC_MONETARY: en_US.ISO8859-1
  value of $LC_NUMERIC: en_US.ISO8859-1
  value of $LC_TIME: en_US.ISO8859-1
  value of $LANG: en_US.ISO8859-1
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

The delete-file command claims that:

| Delete file named FILENAME.  If it is a symlink, remove the symlink.
| If file has multiple names, it continues to exist with the other names.

However delete-file will not delete a symlink to a directory.
For instance:
 (make-directory "./here")
 (make-symbolic-link "here" "link-to-here")
 (delete-file "link-to-here")
fails

The
offending code in fileio.c is
--------------------------------------------------
  GCPRO1 (filename);
  if (!NILP (Ffile_directory_p (filename)))
    Fsignal (Qfile_error,
             Fcons (build_string ("Removing old name: is a directory"),
                    Fcons (filename, Qnil)));
  UNGCPRO;
--------------------------------------------------
as the documentation for file-directory-p clearly says that it does NOT
distinguish between directories and symlinks to directories.

Clearly delete-file does not agree with its documentation.  There may
reasons (non-UNIX operating systems?) for leaving the functionality as
is, but it is also inconsistent with higher level functions such as
dired-delete-file .

Your sincerely,
David Casperson
-- 
Dr. David Casperson                          |  casper@unbc.ca
Computer Science                             |  x6672    Fax.5544






reply via email to

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