GNU bug report logs - #39057
27.0.60; copy-file interactive VS from lisp disagreement

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Thu, 9 Jan 2020 21:04:01 UTC

Severity: normal

Found in version 27.0.60

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 39057 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39057 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp
 disagreement
Date: Fri, 10 Jan 2020 12:55:59 +0100 (CET)

> I cannot reproduce this, so there must be more here than meets the
> eye
> So please step through the code and tell where it fails and why.

It seems NEWNAME, i.e., the second argument seeing by `copy-file' might be different
when called interactively; this is true even if the user introduces the 
same value.

I have printed out newname before the line
newname = expand_cp_target (file, newname);
at src/fileio.c

I)
M-: (copy-file "/tmp/foo" "~/") RET
;; it shows "~/" as expected

II)
M-x: copy-file RET /tmp/foo RET ~/ RET
;; it shows "~" (the '/' is missing)

Apparentely, this was unnoticed because before Emacs 26 we were using predicate
`file-directory-p`
M-: (file-directory-p "~") RET
=> t

After commit 'Fix race with rename-file etc. with dir NEWNAME'
(01c885f21f343045783eb9ad1ff5f9b83d6cd789)
we use `directory-name-p`, and the issue is revealed.

(directory-name-p "~")
=> nil

Since you cannot reproduce the issue, it might be platform dependent.
I am able to reproduce it in this nice site, which runs Emacs 26.3 in a linux machine:
https://repl.it/languages/elisp

M-! touch /tmp/foo RET
M-x copy-file RET /tmp/foo RET RET
;; received prompt
;; FILE /home/runner already exists; copy to it anyway? (yes or no)

;; Eval following forms from the *ielm* buffer 
(file-exists-p "~/foo") RET
=> nil

(copy-file "/tmp/foo" "~/")
=> nil

(file-exists-p "~/foo") RET
=> t




This bug report was last modified 5 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.