[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5496: xdev rename-file of symlinks-to-directories broken
From: |
David De La Harpe Golden |
Subject: |
bug#5496: xdev rename-file of symlinks-to-directories broken |
Date: |
Sat, 30 Jan 2010 02:15:05 +0000 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20091109) |
So, file-directory-p returns non-nil for symlinks to directories, so
delete-directory now (i.e. following #5436/#3353) gets incorrectly
called in rename-file if you try to rename a symlink-to-a-directory to a
location on another device. The copy-directory bit is already guarded
appropriately, but not the delete-directory bit.
delete-directory at least then fails rather than following the symlink
and then recursively deleting. However, the result a user would no doubt
expect is for just the symlink to be renamed.
e.g. /tmp and /home different filesystems
mkdir /home/david/foo
cd /tmp
mkdir bar
ln -s bar baz
; in emacs
(rename-file "/tmp/baz" "/home/david/foo")
result:
baz symlink to a "bar" in /home/david/foo
- consistent with shell mv behaviour.
Unfortunately, /tmp/baz won't be removed properly without attached tiny
patch.
=== modified file 'src/fileio.c'
--- src/fileio.c 2010-01-28 17:47:05 +0000
+++ src/fileio.c 2010-01-30 01:50:33 +0000
@@ -2295,17 +2295,21 @@
/* We have already prompted if it was an integer, so don't
have copy-file prompt again. */
Fcopy_file (file, newname,
NILP (ok_if_already_exists) ? Qnil : Qt,
Qt, Qt);
count = SPECPDL_INDEX ();
specbind (Qdelete_by_moving_to_trash, Qnil);
- if (!NILP (Ffile_directory_p (file)))
+ if (
+#ifdef S_IFLNK
+ (NILP (symlink_target)) &&
+#endif
+ (!NILP (Ffile_directory_p (file))))
call2 (Qdelete_directory, file, Qt);
else
Fdelete_file (file);
unbind_to (count, Qnil);
}
else
report_file_error ("Renaming", list2 (file, newname));
}
- bug#5496: xdev rename-file of symlinks-to-directories broken,
David De La Harpe Golden <=