[PATCH] Allow scp to copy files that start with a Windows drive name.

Sam Hocevar sam at hocevar.net
Wed Sep 21 02:56:10 AEST 2016


On Tue, Sep 20, 2016, Scott Neugroschl wrote:

> This patch changes the behaviour (only on Cygwin) by considering that a
> single letter followed by a colon is a Windows drive name and thus an
> absolute path. This is also more consistent with the manual page that
> recommends to use absolute pathnames “to avoid scp treating file names
> containing ‘:’ as host specifiers”.
> 
> -----------------------
> 
> Is this really necessary?   Especially since it's a Cygwin specific patch, what is wrong with simply using /cygdrive/C/foo/bar?

   The patch uses HAVE_CYGWIN but is not Cygwin-specific, it also applies to
MSYS2 which is a modern Cygwin fork and does not have /cygdrive/C/ (it uses /c/
directly instead).

   Also an interactive user may immediately correct the error by changing
the path to a Unix-like one instead, but sometimes the arguments are not
user-controlled, or scp is used together with non-Cygwin applications, or is
embedded into a larger script that expects scp to behave as documented for
absolute paths. From a least surprise perspective, I believe the correct place
to fix this is indeed in scp.

   Finally, drives in /cygdrive/ (or in MSYS2 /c/) are not immediately
accessible; a newly mounted network device or thumb drive will fail to appear
unless the terminal is closed and a new one is opened. If the shell is a child
of sshd.exe it would even require a restart of the SSH server.

Regards,
-- 
Sam.


More information about the openssh-unix-dev mailing list