unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Dana Pieluszczak <danajp@gmail.com>
Cc: 17238@debbugs.gnu.org
Subject: bug#17238: 24.3; TRAMP Can't open remote file with '$' in the filename
Date: Fri, 11 Apr 2014 08:36:04 +0200	[thread overview]
Message-ID: <87k3awe5kb.fsf@gmx.de> (raw)
In-Reply-To: <CANw9LG3WhPytBavrhsG+xmGQR86xm+pzBy-DxHvDRNLfyxO9qA@mail.gmail.com> (Dana Pieluszczak's message of "Thu, 10 Apr 2014 23:01:03 -0400")

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.





  reply	other threads:[~2014-04-11  6:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  3:01 bug#17238: 24.3; TRAMP Can't open remote file with '$' in the filename Dana Pieluszczak
2014-04-11  6:36 ` Michael Albinus [this message]
2014-04-11 12:32   ` Dana Pieluszczak
2014-04-11 13:02     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3awe5kb.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=17238@debbugs.gnu.org \
    --cc=danajp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).