[Top][All Lists]

[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 <address@hidden> writes:

Hi Dana,

> # now we're in emacs
> C-x C-f DEL DEL /address@hidden:/home/dana/t$test.txt RET

For the records, it should be "/address@hidden:/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 
*** 1066,1072 ****
                   (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 ----
                   (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.

reply via email to

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