Hi,

   +-From: <[EMAIL PROTECTED]> ----------
   |_Date: Tue, 23 Oct 2007 16:02:18 -0400 __
   |
   |Then I proceed to test Windows, using Cygwin and Eclipse Europa.
   |Surprisingly, Scp works fine, and so does the Shell programs, but Sftp
   |fails on the put command. It appears that the path is somehow filtered
   |and the backslashes were removed, resulting in a message of the form:
   |4: java.io.FileNotFoundException: Q:2007jschWin_0.1.35verifyp.htm (The
   |system cannot find the file specified)
   |It should have been Q:\2007\jsch\Win_0.1.35\verify\p.htm instead.

It is a bug, which has been sneaked in 0.1.35.
So, 0.1.34 does not have such a problem, and you will be able to
work around by the following code on 0.1.35,

   //c.put("Q:\\2007\\jsch\\Win_0.1.35\\verify\\p.htm", ...);
   String pwd=c.lpwd();
   c.lcd("Q:\\2007\\jsch\\Win_0.1.35\\verify");
   c.put("p.htm", ...);
   c.lcd(pwd);

Here is a patch to fix this problem,

diff -Naur jsch-0.1.35/src/com/jcraft/jsch/ChannelSftp.java 
jsch-0.1.36/src/com/jcraft/jsch/ChannelSftp.java
--- jsch-0.1.35/src/com/jcraft/jsch/ChannelSftp.java    Tue Oct 16 01:14:21 2007
+++ jsch-0.1.36/src/com/jcraft/jsch/ChannelSftp.java    Tue Oct 23 09:33:18 2007
@@ -159,6 +159,7 @@
 
   private static final String file_separator=java.io.File.separator;
   private static final char file_separatorc=java.io.File.separatorChar;
+  private static boolean fs_is_bs=(byte)java.io.File.separatorChar == '\\';
 
   private String cwd;
   private String home;
@@ -2221,7 +2222,7 @@
         i--;
         continue;
       }
-      if((byte)file_separatorc != '\\' &&
+      if(!fs_is_bs &&
          i>0 && path[i-1]=='\\'){
         i--;
         if(i>0 && path[i-1]=='\\'){
@@ -2233,9 +2234,9 @@
       break;
     }
 
-    if(i<0){ v.addElement(Util.unquote(_path)); return v;}
+    if(i<0){ v.addElement(fs_is_bs ? _path : Util.unquote(_path)); return v;}
     while(i>=0){if(path[i]==file_separatorc)break;i--;}
-    if(i<0){ v.addElement(Util.unquote(_path)); return v;}
+    if(i<0){ v.addElement(fs_is_bs ? _path : Util.unquote(_path)); return v;}
 
     byte[] dir;
     if(i==0){dir=new byte[]{(byte)file_separatorc};}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to