From: Nick Helm <nick@tenpoint.co.nz>
To: 38707@debbugs.gnu.org
Subject: bug#38707: dired-do-rename doesn't check for "/" !
Date: Tue, 24 Dec 2019 17:28:55 +1300 [thread overview]
Message-ID: <m2fthawdmg.fsf@tenpoint.co.nz> (raw)
In-Reply-To: <87d0cge2pl.5.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Mon, 23 Dec 2019 00:37:26 +0800")
Dan Jacobson <jidanni@jidanni.org> writes:
> Let's say you tell it to rename qqq to "xxx/yyy/zzz/".
>
> And it works.
>
> You get xxx/yyy/zzz/qqq
>
> But if there is no directory zzz,
> then one day you will discover you got
>
> xxx/yyy/qqq .
I'm not sure this is actually a bug, but it looks like the behaviour
happens because of these lines in dired-do-create-files.
;; rename-file bombs when moving directories unless we do this:
(or into-dir (setq target (directory-file-name target)))
Dired could check for and issue an error in the case where the source is
a file and the target appears to be a non-existent directory. Something
like this perhaps?
--- a/lisp/dired-aux.el 2019-12-23 15:12:26.000000000 +1300
+++ b/lisp/dired-aux.el 2019-12-23 15:18:17.000000000 +1300
@@ -1878,6 +1878,10 @@
(apply (car into-dir) operation rfn-list fn-list target (cdr into-dir))
(if (not (or dired-one-file into-dir))
(error "Marked %s: target must be a directory: %s" operation target))
+ (if (and (not (file-directory-p (car fn-list)))
+ (not (file-directory-p target))
+ (directory-name-p target))
+ (error "%s: Target directory does not exist: %s" operation target))
;; rename-file bombs when moving directories unless we do this:
(or into-dir (setq target (directory-file-name target)))
(dired-create-files
Nick
next prev parent reply other threads:[~2019-12-24 4:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-22 16:37 bug#38707: dired-do-rename doesn't check for "/" ! 積丹尼 Dan Jacobson
2019-12-24 4:28 ` Nick Helm [this message]
2020-08-06 10:13 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2fthawdmg.fsf@tenpoint.co.nz \
--to=nick@tenpoint.co.nz \
--cc=38707@debbugs.gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).