sftp "cd" command to drive letter under cygwin

Peter Stuge peter at stuge.se
Wed Jan 9 14:40:20 EST 2013


Rick Patterson wrote:
> Cygwin should make Windows easier for Windows developers

Corinna frequently gets to repeat the truth, so I'll help this time:

Cygwin is not Windows.


> We don't have a "Cygwin" application.  We have a Windows application

Ok.


> that if you wish to use commands from a UNIX subsystem (various
> ones are available) then that can be accommodated.

So far so good. But keep in mind that you're still a Windows
application.


> For example, sftp is a typical third-party add-on Windows
> application.  Our application might run on a machine with no
> UNIX subsystem or on one with Cygwin, or one with some other
> UNIX utilities that include sftp.

Sure. And you will quite likely need to have different code for each
different case, and in addition you will need to have different code
for every type of SFTP destination for each different case.


> If our application is configured to use sftp, and it sits on a
> Windows machine it can find "sftp" on, it assumes everything is
> okay, and generates a standard ftp batch transfer file,
> transferring windows files to other Windows and UNIX machines,
> using target location data fetched from a database.

So actually you only support one specific implementation of "sftp"
because you rely on it understanding the OpenSSH sftp batch file
format?


> The database might be used by any number of applications which are
> not Cygwin aware, so it is natural to put pat information in this
> database that reflect the filesystem for the operating system of
> the machine, and not what what this data might be mapped to if it
> is used via Cygwin.    What is even more complicated is now our
> application is supposed to know not just whether the local machine
> it is running on is using Cygwin, and so map local files to
> Cygdrive, but also whether the target machines has a Cygwin sftp on
> it, and if so, convert the path data written to the sftp batch
> files to a Cygdrive specification, suitable for the the target
> machine.

That's exactly right. If you want to handle all cases, that's what
you'll have to do.


> sftp, a derivative of ftp,

sftp is a SSH version 2 subsystem protocol and has nothing at all to
do with FTP, except that both are protocols for transfering files. :)


> being one of the oldest and stradard TCP/IP applications, should
> not have a problem whereby it cannot find Windows files or
> directories when it is running on a Windows machine.

No matter what protocol you look at, successful implementation can
certainly require consideration of remote endpoint system properties.


//Peter


More information about the openssh-unix-dev mailing list