Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-298

Windows: ScpClient.upload fails on remote machine if path is absolute and begins with a drive letter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.1
    • 0.11.0
    • None
    • Windows

    Description

      When I try to copy a file using ScpClient.upload() to a remote machine using an absolute path that begins with a drive letter, the copy operation will fail:

      Exception in thread "main" java.io.IOException: Received nack: Can not write to /C:/Workspace/SSHTest/bin/C:/DOKUME~1/AUTOBU~1/LOKALE~1/Temp/testfile.txt
      (the current working directory was C:\Workspace\SSHTest\bin)

      When I use an absolute path that does not begin with a drive letter (e.g. "\DOKUME~1\AUTOBU~1\LOKALE~1\Temp\testfile.txt) the copy operation works.

      It seems that the windows client does not recognize paths beginning with a drive letter as absolute, so it assums a relative path and eppends it to the current directory (C:\Workspace\SSHTest\bin in this case).

      Below a piece of testcode:

      private ScpClient m_scp;
      private String srcFile = "testfile.txt";
      private String dstFile = "C:\\DOKUME~1\\AUTOBU~1\\LOKALE~1\\Temp
      testfile.txt";

      m_scp = m_session.createScpClient();
      m_scp.upload(srcFile, dstFile);

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            g.telkamp Gerrit Telkamp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: