From: Paul Eggert <eggert@cs.ucla.edu>
To: Andreas Schwab <schwab@suse.de>, Kaushal Modi <kaushal.modi@gmail.com>
Cc: self@gkayaalp.com, 28792@debbugs.gnu.org
Subject: bug#28792: 26.0.60; Deleting to a custom trash directory in Dired gives error
Date: Thu, 12 Oct 2017 13:25:47 -0700 [thread overview]
Message-ID: <04f4ac98-93b4-7356-8251-304c3601fe86@cs.ucla.edu> (raw)
In-Reply-To: <mvma80wv12u.fsf@suse.de>
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
On 10/12/2017 08:27 AM, Andreas Schwab wrote:
> rename-file now refuses to copy directory across
> file systems unless the target name ends in a slash.
Thanks for the diagnosis. This is an unintended consequence of the
race-condition patch for rename-file that I installed last month. I
installed the attached patch into the emacs-26 branch to fix the bug.
[-- Attachment #2: 0001-Let-rename-file-rename-dirs-across-filesystems.patch --]
[-- Type: text/x-patch, Size: 1901 bytes --]
From 21df0eec6d056c88c7ffbd5a1c0f76661702d5cf Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 12 Oct 2017 13:08:53 -0700
Subject: [PATCH] Let rename-file rename dirs across filesystems
Problem diagnosed by Andreas Schwab (Bug#28792#65).
This fixes a bug that I introduced in
2017-09-10T22:39:24@eggert@cs.ucla.edu
"Fix race with rename-file etc. with dir NEWNAME".
* src/fileio.c (Frename_file): Copy a source directory across
file system boundaries even if its name does not end in slash.
---
src/fileio.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/fileio.c b/src/fileio.c
index 4bbcec6f17..e57bf46015 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2260,7 +2260,7 @@ This is what happens in interactive use with M-x. */)
(Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists)
{
Lisp_Object handler;
- Lisp_Object encoded_file, encoded_newname, symlink_target;
+ Lisp_Object encoded_file, encoded_newname;
file = Fexpand_file_name (file, Qnil);
@@ -2334,12 +2334,22 @@ This is what happens in interactive use with M-x. */)
if (rename_errno != EXDEV)
report_file_errno ("Renaming", list2 (file, newname), rename_errno);
+ struct stat file_st;
bool dirp = !NILP (Fdirectory_name_p (file));
+ if (!dirp)
+ {
+ if (lstat (SSDATA (encoded_file), &file_st) != 0)
+ report_file_error ("Renaming", list2 (file, newname));
+ dirp = S_ISDIR (file_st.st_mode) != 0;
+ }
if (dirp)
call4 (Qcopy_directory, file, newname, Qt, Qnil);
else
{
- symlink_target = Ffile_symlink_p (file);
+ Lisp_Object symlink_target
+ = (S_ISLNK (file_st.st_mode)
+ ? emacs_readlinkat (AT_FDCWD, SSDATA (encoded_file))
+ : Qnil);
if (!NILP (symlink_target))
Fmake_symbolic_link (symlink_target, newname, ok_if_already_exists);
else
--
2.13.6
next prev parent reply other threads:[~2017-10-12 20:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 3:26 bug#28792: 26.0.60; Deleting to a custom trash directory in Dired gives error Kaushal Modi
2017-10-12 3:36 ` Kaushal Modi
2017-10-12 3:51 ` Kaushal Modi
2017-10-12 12:50 ` Göktuğ Kayaalp
2017-10-12 12:58 ` Eli Zaretskii
2017-10-12 13:02 ` Kaushal Modi
2017-10-12 13:37 ` Göktuğ Kayaalp
2017-10-12 12:58 ` Kaushal Modi
2017-10-12 13:16 ` Eli Zaretskii
2017-10-12 13:31 ` Kaushal Modi
2017-10-12 13:44 ` Eli Zaretskii
2017-10-12 14:02 ` Andreas Schwab
2017-10-12 14:06 ` Kaushal Modi
2017-10-12 15:07 ` Kaushal Modi
2017-10-12 15:15 ` Eli Zaretskii
2017-10-12 15:27 ` Andreas Schwab
2017-10-12 15:31 ` Kaushal Modi
2017-10-12 20:25 ` Paul Eggert [this message]
2017-10-12 21:41 ` Kaushal Modi
2017-10-15 7:18 ` Paul Eggert
2017-10-15 13:35 ` Kaushal Modi
2017-10-15 13:47 ` Noam Postavsky
2017-10-12 14:24 ` Noam Postavsky
2017-10-12 14:43 ` Drew Adams
2017-10-12 15:07 ` Andreas Schwab
2017-10-12 15:10 ` Drew Adams
2017-10-12 13:34 ` Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=04f4ac98-93b4-7356-8251-304c3601fe86@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=28792@debbugs.gnu.org \
--cc=kaushal.modi@gmail.com \
--cc=schwab@suse.de \
--cc=self@gkayaalp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.