[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16984: dired-do-rename susceptible to .../~/... hijack
From: |
Michael Albinus |
Subject: |
bug#16984: dired-do-rename susceptible to .../~/... hijack |
Date: |
Sat, 29 Oct 2016 18:22:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
npostavs@users.sourceforge.net writes:
>> Prefixing with "/:" would also deactivate all file name handlers. The
>> file name "/ssh:user@host:/path/~/file" would be handled literally,
>> which is wrong.
>
> Ah, good point. How about checking (find-file-name-handler filename
> 'substitute-in-file-name):
>
> + (not (let ((handler (find-file-name-handler
> + filename 'substitute-in-file-name)))
> + (and handler
> + (funcall handler 'substitute-in-file-name
> filename)))))
I would rather use (not (file-remote-p file-name))
This fixes the problem for local file names, but not for remote
ones. "/ssh:user@host:/path/~/file" would still be expanded to something
like "/ssh:user@host:/home/user/file". Well, better than nothing.
What do people think to use the "/:" prefix also for the local part of
remote file names? Then one could use "/ssh:user@host:/:/path/~/file",
making substitute-in-file-name a noop.
Best regards, Michael.