GNU bug report logs -
#29440
Tramp put drive_c in the backup file name when backuping in local PC/windows
Previous Next
Reported by: Shuguang Sun <shuguang <at> gmail.com>
Date: Sat, 25 Nov 2017 17:27:01 UTC
Severity: minor
Fixed in version 26.1
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29440 in the body.
You can then email your comments to 29440 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Sat, 25 Nov 2017 17:27:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Shuguang Sun <shuguang <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 25 Nov 2017 17:27:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
Windows 7
GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2017-11-24
I didn't set tramp-backup-directory-alist which means the fiile will be
backuped locally instead of being backup in server side.
backup-directory-alist:
("\\.[rR]\\(md\\)?$" . "~/.emacs.d/autosave/Rfiles")
When I open a file in tramp and edit it, the backup file will be and was
backuped in the local direcory: ~/.emacs.d/autosave/Rfiles
(c:/Users/username/HOME/.emacs.d/autosave/Rfiles). However the backfile is
named
"c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!username <at> host!!!opt!bee!home!username!test!coxph_bench.r.~2~",
where "dirve_c" was put in.
I attached the log file, and it may be anchored by find "c:/plink" and
"drive_c".
[Message part 2 (text/html, inline)]
[tramp_local_backup_traceing.txt (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Sat, 25 Nov 2017 19:20:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 29440 <at> debbugs.gnu.org (full text, mbox):
> From: Shuguang Sun <shuguang <at> gmail.com>
> Date: Sun, 26 Nov 2017 00:08:42 +0800
>
> Windows 7
> GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2017-11-24
>
> I didn't set tramp-backup-directory-alist which means the fiile will be backuped locally instead of being backup
> in server side.
>
> backup-directory-alist:
> ("\\.[rR]\\(md\\)?$" . "~/.emacs.d/autosave/Rfiles")
>
> When I open a file in tramp and edit it, the backup file will be and was backuped in the local direcory:
> ~/.emacs.d/autosave/Rfiles (c:/Users/username/HOME/.emacs.d/autosave/Rfiles). However the backfile is
> named
> "c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!username <at> host!!!opt!bee!home!username!test!coxph_bench.r.~2~",
> where "dirve_c" was put in.
Maybe I'm confused, but what did you expect to happen instead? When
files are backed-up in a single directory, the drive letters cannot be
kept because Windows doesn't allow colons in file names.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Sun, 26 Nov 2017 06:01:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 29440 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
It should be "c:/Users/username/HOME/.
emacs.d/autosave/Rfiles/!plink!!username <at> host!!!opt!bee!home!username!test!coxph_bench.r.~2~",
because it is in server in not in "c:/plink...." and there should be "!drive_c"
added.
On Sun, Nov 26, 2017 at 3:18 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: Shuguang Sun <shuguang <at> gmail.com>
> > Date: Sun, 26 Nov 2017 00:08:42 +0800
> >
> > Windows 7
> > GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2017-11-24
> >
> > I didn't set tramp-backup-directory-alist which means the fiile will be
> backuped locally instead of being backup
> > in server side.
> >
> > backup-directory-alist:
> > ("\\.[rR]\\(md\\)?$" . "~/.emacs.d/autosave/Rfiles")
> >
> > When I open a file in tramp and edit it, the backup file will be and was
> backuped in the local direcory:
> > ~/.emacs.d/autosave/Rfiles (c:/Users/username/HOME/.emacs.d/autosave/Rfiles).
> However the backfile is
> > named
> > "c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!
> drive_c!plink!!username <at> host!!!opt!bee!home!username!test!
> coxph_bench.r.~2~",
> > where "dirve_c" was put in.
>
> Maybe I'm confused, but what did you expect to happen instead? When
> files are backed-up in a single directory, the drive letters cannot be
> kept because Windows doesn't allow colons in file names.
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Mon, 27 Nov 2017 17:25:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 29440 <at> debbugs.gnu.org (full text, mbox):
Shuguang Sun <shuguang <at> gmail.com> writes:
> Hi,
Hi,
> backup-directory-alist:
> ("\\.[rR]\\(md\\)?$" . "~/.emacs.d/autosave/Rfiles")
>
> When I open a file in tramp and edit it, the backup file will be and
> was backuped in the local direcory: ~/.emacs.d/autosave/Rfiles
> (c:/Users/username/HOME/.emacs.d/autosave/Rfiles). However the
> backfile is named
> "c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!username <at> host!!!opt!bee!home!username!test!coxph_bench.r.~2~",
> where "dirve_c" was put in.
I've hijacked a Windows 7 machine today. It runs Emacs 25.1 only, but
this should be good enough. I have prepared a similar setting, with
--8<---------------cut here---------------start------------->8---
backup-directory-alist is a variable defined in `files.el'.
Its value is (("." . "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup"))
--8<---------------cut here---------------end--------------->8---
I have used file "/plink:albinus <at> 192.168.178.30:/home/albinus/tmp/123" as
test file. The interesting function is make-backup-file-name-1, which
I debug.
When I enter line 4422, the (when (memq system-type '(windows-nt ms-dos cygwin))
part, backup-directory is
"c:/Users/lb01177/AppData/Roaming/.emacs.d/backup", and file is still
"/plink:albinus <at> 192.168.178.30:/home/albinus/tmp/123". As expected.
The interesting part is here:
--8<---------------cut here---------------start------------->8---
;; Replace any invalid file-name characters (for the
;; case of backing up remote files).
(setq file
(expand-file-name (convert-standard-filename file)))
--8<---------------cut here---------------end--------------->8---
(convert-standard-filename file) returns "\\plink!albinus <at> 192.168.178.30!\\home\\albinus\\tmp\\123".
And (expand-file-name ...) returns then "c:/plink!albinus <at> 192.168.178.30!/home/albinus/tmp/123".
Unexpected, indeed. I believe, this must be fixed, because "c:" is
converted to "/drive_c" later on. The final backup name is
"c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!drive_c!plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123.~3~"
Eli?
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Mon, 27 Nov 2017 18:08:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 29440 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Date: Mon, 27 Nov 2017 18:24:45 +0100
> Cc: 29440 <at> debbugs.gnu.org
>
> When I enter line 4422, the (when (memq system-type '(windows-nt ms-dos cygwin))
> part, backup-directory is
> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup", and file is still
> "/plink:albinus <at> 192.168.178.30:/home/albinus/tmp/123". As expected.
>
> The interesting part is here:
>
> --8<---------------cut here---------------start------------->8---
> ;; Replace any invalid file-name characters (for the
> ;; case of backing up remote files).
> (setq file
> (expand-file-name (convert-standard-filename file)))
> --8<---------------cut here---------------end--------------->8---
>
> (convert-standard-filename file) returns "\\plink!albinus <at> 192.168.178.30!\\home\\albinus\\tmp\\123".
> And (expand-file-name ...) returns then "c:/plink!albinus <at> 192.168.178.30!/home/albinus/tmp/123".
>
> Unexpected, indeed. I believe, this must be fixed, because "c:" is
> converted to "/drive_c" later on. The final backup name is
> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!drive_c!plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123.~3~"
>
> Eli?
The code there is inappropriate for remote file names, it assumes a
local file name. A remote file name should be processed as follows:
. remove the leading slash
. run the result through convert-standard-filename
. then do this:
(expand-file-name
(subst-char-in-string
?/ ?!
(replace-regexp-in-string "!" "!!" file))
backup-directory))
With your example, this produces
"c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
Or maybe prepend a slashe before calling subst-char-in-string? That
would produce
"c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
WDYT?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Mon, 27 Nov 2017 20:22:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 29440 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
Hi Eli,
> With your example, this produces
>
> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
>
> Or maybe prepend a slashe before calling subst-char-in-string? That
> would produce
>
> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
>
> WDYT?
I'd prefer the second variant. It makes it more obvious where the file
name is transformed from, keeping the leading slash.
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Thu, 30 Nov 2017 19:24:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 29440 <at> debbugs.gnu.org (full text, mbox):
Michael Albinus <michael.albinus <at> gmx.de> writes:
Hi Eli,
>> With your example, this produces
>>
>> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
>>
>> Or maybe prepend a slashe before calling subst-char-in-string? That
>> would produce
>>
>> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
>>
>> WDYT?
>
> I'd prefer the second variant. It makes it more obvious where the file
> name is transformed from, keeping the leading slash.
I'm a little bit undecided. Do you want, that *I* apply the patch?
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Fri, 01 Dec 2017 10:43:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 29440 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: shuguang <at> gmail.com, 29440 <at> debbugs.gnu.org
> Date: Mon, 27 Nov 2017 21:21:02 +0100
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> Hi Eli,
>
> > With your example, this produces
> >
> > "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
> >
> > Or maybe prepend a slashe before calling subst-char-in-string? That
> > would produce
> >
> > "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
> >
> > WDYT?
>
> I'd prefer the second variant. It makes it more obvious where the file
> name is transformed from, keeping the leading slash.
OK, I installed such a change on the emacs-26 branch, please see if it
fixes the problem.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Fri, 01 Dec 2017 18:21:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 29440 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: shuguang <at> gmail.com, 29440 <at> debbugs.gnu.org
> Date: Thu, 30 Nov 2017 20:23:34 +0100
>
> >> With your example, this produces
> >>
> >> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
> >>
> >> Or maybe prepend a slashe before calling subst-char-in-string? That
> >> would produce
> >>
> >> "c:/Users/lb01177/AppData/Roaming/.emacs.d/backup/!plink!!albinus <at> 192.168.178.30!!!home!albinus!tmp!123"
> >>
> >> WDYT?
> >
> > I'd prefer the second variant. It makes it more obvious where the file
> > name is transformed from, keeping the leading slash.
>
> I'm a little bit undecided. Do you want, that *I* apply the patch?
I already installed it.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Sat, 02 Dec 2017 11:35:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 29440 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
Hi Eli,
> OK, I installed such a change on the emacs-26 branch, please see if it
> fixes the problem.
I'll try to find an MS Windows machine @work, next days. Then I'll test.
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Mon, 05 Feb 2018 13:32:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 29440 <at> debbugs.gnu.org (full text, mbox):
Michael Albinus <michael.albinus <at> gmx.de> writes:
Hi Eli,
>> OK, I installed such a change on the emacs-26 branch, please see if it
>> fixes the problem.
>
> I'll try to find an MS Windows machine @work, next days. Then I'll test.
Nothing happened for weeks. I forgot to report that it works for me.
@Shuguang, could you pls recheck? We could close the bug then.
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#29440
; Package
emacs
.
(Tue, 06 Feb 2018 09:13:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 29440 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thank you Michael,
Now it works correctly.
!plink!!username <at> host!!!path!to!file.r.~2~
On Mon, Feb 5, 2018 at 9:31 PM, Michael Albinus <michael.albinus <at> gmx.de>
wrote:
> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
> Hi Eli,
>
> >> OK, I installed such a change on the emacs-26 branch, please see if it
> >> fixes the problem.
> >
> > I'll try to find an MS Windows machine @work, next days. Then I'll test.
>
> Nothing happened for weeks. I forgot to report that it works for me.
>
> @Shuguang, could you pls recheck? We could close the bug then.
>
> Best regards, Michael.
>
[Message part 2 (text/html, inline)]
Reply sent
to
Michael Albinus <michael.albinus <at> gmx.de>
:
You have taken responsibility.
(Wed, 07 Feb 2018 07:38:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Shuguang Sun <shuguang <at> gmail.com>
:
bug acknowledged by developer.
(Wed, 07 Feb 2018 07:38:03 GMT)
Full text and
rfc822 format available.
Message #43 received at 29440-done <at> debbugs.gnu.org (full text, mbox):
Version: 26.1
Shuguang Sun <shuguang <at> gmail.com> writes:
Hi Shuguang,
> Now it works correctly.
>
> !plink!!username <at> host!!!path!to!file.r.~2~
Thanks for the feedback. I'm closing the bug.
Best regards, Michael.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 07 Mar 2018 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 184 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.