Subject: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement

From: Eli Zaretskii <[email-masked]>
Date: Fri, 10 Jan 2020 16:12:37 +0200

> Date: Fri, 10 Jan 2020 15:48:02 +0200
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > 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)
> 
> Why would it be missing? which code removes it, if you typed it?

Answering myself: this is a problem with completion routines: when the
user types a file name that is exactly identical to the default (or
just presses RET, which is the same), then the completion code in
read-file-name-internal returns a value that has the trailing slash
stripped.  And we now require a trailing slash to recognize NEWNAME as
a directory.

Maybe Stefan can help us out here.