From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>,
lennart.borgman@gmail.com, emacs-devel@gnu.org
Subject: Re: File names with spaces and tramp/ftp
Date: Tue, 12 Feb 2008 14:00:48 +0100 [thread overview]
Message-ID: <nqve4u49dr.fsf@alcatel-lucent.de> (raw)
In-Reply-To: <jwv8x1qyie6.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 11 Feb 2008 22:16:34 -0500")
[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> I could change ange-ftp to this encoding style of file names; but I am
>>> anxious: it could break ange-ftp on other systems, where double quotes
>>> might not be supported.
>
>> Does it help to use shell-quote-argument?
>
> I doubt it: the FTP command is not passed through a shell.
> In some cases it may work, of course.
But it is a good approximation. Under GNU/Linux, we have
(shell-quote-argument "file name with spaces 'and \"quotes")
=> "file\\ name\\ with\\ spaces\\ \\'and\\ \\\"quotes"
W32 systems do
(shell-quote-argument "file name with spaces 'and \"quotes")
=> "\"file name with spaces 'and \\\"quotes\""
Both quotations work with stock FTP clients except the quotation of
"\"" on W32 systems: it shall be "\"\" instead of "\\\"". But this
could be adapted, and "\"" isn't so usual on W32 file names. Btw, I
could not create the file "~/file name with spaces 'and \"quotes" on
W32 in Emacs; this worked only with Emacs under GNU/Linux.
Lennart (et al), could you, please, test whether the appended patch
works for you for file names with spaces? And that there isn't any
other regression?
The patch is towards ange-ftp.el in the trunk.
> Stefan
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1557 bytes --]
*** /usr/local/src/emacs/lisp/net/ange-ftp.el.~1~ Wed Feb 6 20:49:56 2008
--- /usr/local/src/emacs/lisp/net/ange-ftp.el Tue Feb 12 13:46:33 2008
***************
*** 1523,1541 ****
(defun ange-ftp-quote-string (string)
"Quote any characters in STRING that may confuse the ftp process."
! (apply 'concat
! (mapcar (lambda (char)
! ;; This is said to be wrong; ftp is said to
! ;; need quoting only for ", and that by doubling it.
! ;; But experiment says this kind of quoting is correct
! ;; when talking to ftp on GNU/Linux systems.
! (if (or (<= char ? )
! (> char ?\~)
! (= char ?\")
! (= char ?\\))
! (vector ?\\ char)
! (vector char)))
! string)))
(defun ange-ftp-barf-if-not-directory (directory)
(or (file-directory-p directory)
--- 1523,1529 ----
(defun ange-ftp-quote-string (string)
"Quote any characters in STRING that may confuse the ftp process."
! (when (stringp string) (shell-quote-argument string)))
(defun ange-ftp-barf-if-not-directory (directory)
(or (file-directory-p directory)
***************
*** 3766,3772 ****
(ange-ftp-send-cmd
t-host
t-user
! (list 'put (or temp2 filename) t-name)
(or msg
(if (and temp2 f-parsed)
(format "Putting %s" newname)
--- 3754,3760 ----
(ange-ftp-send-cmd
t-host
t-user
! (list 'put (or temp2 (ange-ftp-quote-string filename)) t-name)
(or msg
(if (and temp2 f-parsed)
(format "Putting %s" newname)
next prev parent reply other threads:[~2008-02-12 13:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 22:17 File names with spaces and tramp/ftp Lennart Borgman (gmail)
2008-02-11 15:39 ` Michael Albinus
2008-02-11 20:18 ` Eli Zaretskii
2008-02-12 3:16 ` Stefan Monnier
2008-02-12 13:00 ` Michael Albinus [this message]
2008-02-12 19:58 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nqve4u49dr.fsf@alcatel-lucent.de \
--to=michael.albinus@gmx.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
--cc=monnier@iro.umontreal.ca \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.