Subject: | setcwd unnecessarily canonicalizes the provided directory before issuing cwd command |
Date: | Tue, 23 Jul 2013 19:47:28 +0000 |
To: | "bug-Net-SFTP-Foreign [...] rt.cpan.org" <bug-Net-SFTP-Foreign [...] rt.cpan.org> |
From: | Rob Duval <rduval [...] factset.com> |
Hello,
I am using Net::SFTP::Foreign in a Linux-based service, and so far it has been a great Perl interface to the OpenBSD SSH client. My implementation connects to a couple hundred different SFTP servers, mostly without issue.
However, I am running into an issue when connecting to a server that identifies itself as Serv-U (http://www.serv-u.com/). When I connect to this server and attempt to use the setcwd command to change into a subdirectory, the method fails because the server does not support the SSH_FXP_REALPATH request, which canonicalizes a path per http://www.openssh.org/txt/draft-ietf-secsh-filexfer-02.txt. This struck me as odd behavior, because I expected Net::SFTP::Foreign to simply issue the cwd command without modifying the path, similar to how the OpenBSD SSH client works.
I took a brief look at the Net::SFTP::Foreign source code, and it appears that the setcwd method calls realpath on the provided directory before issuing the cwd command. Even though it seems like almost all SFTP servers support the SSH_FXP_REALPATH request, I don't think it's necessary for setcwd to canonicalize the path.
Would you please consider removing the realpath call from setcwd? The current implementation seems to be at odds with the OpenBSD SSH client's default behavior, so I think resolving this discrepancy would improve the module.
Let me know if I can provide any other information, and thanks in advance.
Rob Duval Senior Systems Engineer - Client Data Integration rduval@factset.com<mailto:rduval@factset.com> FactSet Research Systems Inc.<http://www.factset.com/>