GNU bug report logs - #29149
Tramp shell uses local shell setting in windows

Previous Next

Package: emacs;

Reported by: Shuguang Sun <shuguang <at> gmail.com>

Date: Sun, 5 Nov 2017 04:11:01 UTC

Severity: normal

Merged with 29442

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Shuguang Sun <shuguang <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 29149 <at> debbugs.gnu.org
Subject: Re: bug#29149: Tramp shell uses local shell setting in windows
Date: Fri, 17 Nov 2017 15:53:09 +0100
Shuguang Sun <shuguang <at> gmail.com> writes:

> Hi Michael,

Hi Shuguang,

> I attached the trace log which has actions: open the file
> coxph_bench.r, and edit it, and save it. If you need the full log,
> please let me know.

Thanks!

I'll show the most interesting lines here, which tell us the flow

======================================================================
1 -> (tramp-file-name-handler find-backup-file-name "/plink:username <at> host.com:/opt/home/username/test/coxph_bench.r")

The function `find-backup-file-name' has called the Tramp file name
handler due to the remote nature of the file name.

| 2 -> (tramp-sh-file-name-handler find-backup-file-name "/plink:username <at> host.com:/opt/home/username/test/coxph_bench.r")
| | 3 -> (tramp-handle-find-backup-file-name "/plink:username <at> host.com:/opt/home/username/test/coxph_bench.r")

Some Tramp internal flow in order to find the correct funtion. It is
`tramp-handle-find-backup-file-name'.

| | | 4 -> (tramp-run-real-handler find-backup-file-name ("/plink:username <at> host.com:/opt/home/username/test/coxph_bench.r"))

`tramp-handle-find-backup-file-name' calls again
`find-backup-file-name', but suppressing file name handlers. This is
intended in order to ensure proper encoding of "/", ":" "!" and alike.

| | | | 5 -> (tramp-file-name-handler file-exists-p "/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles")
| | | | 5 <- tramp-file-name-handler: t

Some other file name operations are called in `find-backup-file-name',
which work fine. I've removed them from the trace. The last such
operation is `file-exists-p'.

| | | | 5 -> (tramp-file-name-handler expand-file-name "/plink!username <at> host.com!/opt/home/username/test/coxph_bench.r" "/plink:username <at> host.com:/opt/home/username/test/")

`find-backup-file-name' has finished the encoding of the file name (it
is "/plink!username <at> host.com!/opt/home/username/test/coxph_bench.r").
Due to the encoding, it looks like a local file name.

Now, `expand-file-name' is called with the encoded file name. Due to the
leading "/", it is regarded as absolute file name. Tramp is involved due
to the remote default-directory.

| | | | 5 <- tramp-file-name-handler: "c:/plink!username <at> host.com!/opt/home/username/test/coxph_bench.r"

... And this is the problem. Since Tramp sees the local absolute file,
it doesn't do anything, but let the default `expand-file-name' do the
job. This prefixes the file name with "c:/".

The rest is not surprising. The leading "c:" is transformed into
"!drive_c!", and here we are.

| | | | 5 -> (tramp-file-name-handler expand-file-name "!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r" "/plink:username <at> host.com:~/.emacs.d/backup-tramp/Rfiles")
| | | | 5 <- tramp-file-name-handler: "/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r"
| | | | 5 -> (tramp-file-name-handler expand-file-name "/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/" nil)
| | | | 5 -> (tramp-file-name-handler file-name-all-completions "!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~" "/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/")
| | | | 5 <- tramp-file-name-handler: ("!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~1~")
| | | 4 <- tramp-run-real-handler: ("/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~2~")
| | 3 <- tramp-handle-find-backup-file-name: ("/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~2~")
| 2 <- tramp-sh-file-name-handler: ("/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~2~")
1 <- tramp-file-name-handler: ("/plink:username <at> host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username <at> host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~2~")

I have no clue yet how to fix. Pls give me some days to think about.

Best regards, Michael.




This bug report was last modified 7 years and 175 days ago.

Previous Next


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