bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29149: Tramp shell uses local shell setting in windows


From: Michael Albinus
Subject: bug#29149: Tramp shell uses local shell setting in windows
Date: Fri, 17 Nov 2017 15:53:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Shuguang Sun <shuguang@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@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@host.com:/opt/home/username/test/coxph_bench.r")
| | 3 -> (tramp-handle-find-backup-file-name 
"/plink:username@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@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@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@host.com!/opt/home/username/test/coxph_bench.r" 
"/plink:username@host.com:/opt/home/username/test/")

`find-backup-file-name' has finished the encoding of the file name (it
is "/plink!username@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@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@host.com!!!opt!bee!home_nas!username!test!coxph_bench.r"
 "/plink:username@host.com:~/.emacs.d/backup-tramp/Rfiles")
| | | | 5 <- tramp-file-name-handler: 
"/plink:username@host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username@host.com!!!opt!bee!home_nas!username!test!coxph_bench.r"
| | | | 5 -> (tramp-file-name-handler expand-file-name 
"/plink:username@host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/" 
nil)
| | | | 5 -> (tramp-file-name-handler file-name-all-completions 
"!drive_c!plink!!username@host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~"
 
"/plink:username@host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/")
| | | | 5 <- tramp-file-name-handler: 
("!drive_c!plink!!username@host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~1~")
| | | 4 <- tramp-run-real-handler: 
("/plink:username@host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username@host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~2~")
| | 3 <- tramp-handle-find-backup-file-name: 
("/plink:username@host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username@host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~2~")
| 2 <- tramp-sh-file-name-handler: 
("/plink:username@host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username@host.com!!!opt!bee!home_nas!username!test!coxph_bench.r.~2~")
1 <- tramp-file-name-handler: 
("/plink:username@host.com:/home/bceuser/username/.emacs.d/backup-tramp/Rfiles/!drive_c!plink!!username@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]