[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17238: 24.3; TRAMP Can't open remote file with '$' in the filename
From: |
Michael Albinus |
Subject: |
bug#17238: 24.3; TRAMP Can't open remote file with '$' in the filename |
Date: |
Fri, 11 Apr 2014 08:36:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Dana Pieluszczak <danajp@gmail.com> writes:
Hi Dana,
> # now we're in emacs
> C-x C-f DEL DEL /dana@192.168.1.105:/home/dana/t$test.txt RET
For the records, it should be "/dana@192.168.1.105:/home/dana/t$$test.txt".
It works for you because "$test" is not an environment variable;
otherwise it would be replaced.
> Actual result
>
> - a new buffer called t$test.txt is opened
> - the buffer is empty
> - The following is written to *Messages* buffer:
> File exists, but cannot be read
Confirmed, I could reproduce it.
> This is a bug in tramp-sh-handle-file-truename. I've attached a
> patch. The current version of tramp-sh-handle-file-truename uses
> backticks inside a quoted string. Shell arguments used inside the
> backticks should be shell escaped twice, but they're not.
>
> I've changed the shell command to use a subshell ( $(...) )
> Instead of backticks which removes the need for the double escaping.
We cannot use the $(...) syntax, because we don't know whether the
remote shell does support it. Instead, we shall quote the file name twice.
Does the following patch work for you? (The line numbers might differ)
--8<---------------cut here---------------start------------->8---
*** /usr/share/emacs/24.3/lisp/net/tramp-sh.el.~1~ 2014-04-11
08:19:48.434437606 +0200
--- /usr/share/emacs/24.3/lisp/net/tramp-sh.el 2014-04-11 08:19:48.594440377
+0200
***************
*** 1066,1072 ****
v
(format "echo \"\\\"`%s --canonicalize-missing %s`\\\"\""
(tramp-get-remote-readlink v)
! (tramp-shell-quote-argument localname)))))
;; Use Perl implementation.
((and (tramp-get-remote-perl v)
--- 1066,1073 ----
v
(format "echo \"\\\"`%s --canonicalize-missing %s`\\\"\""
(tramp-get-remote-readlink v)
! (tramp-shell-quote-argument
! (tramp-shell-quote-argument localname))))))
;; Use Perl implementation.
((and (tramp-get-remote-perl v)
--8<---------------cut here---------------end--------------->8---
> Dana P
Best regards, Michael.