pkg / sftp

SFTP support for the go.crypto/ssh package
BSD 2-Clause "Simplified" License
1.51k stars 380 forks source link

Getting Windows `go test -integration` working #434

Open puellanivis opened 3 years ago

puellanivis commented 3 years ago

I figured, I have everything necessary to give this a shot, what could possibly go wrong? Maybe it would expose the issue with the io.Copy mentioned in #433 ? I’ve jotted down an example of some generic classes of errors below.

What assumption did we make wrong here?

client_integration_test.go:752: Getwd: wanted absolute path, got "/C:/Users/snowgirl/Work/sftp"

Intriguing, symlinks aren’t working, we likely need admin rights for symlinks in Windows:

client_integration_test.go:773: symlink C:\Users\snowgirl\AppData\Local\Temp\sftptest-readlink416952039\file C:\Users\snowgirl\AppData\Local\Temp\sftptest-readlink416952039\symlink: A required privilege is not held by the client.

Not sure how these handles are being left open:

sftp server file with handle "1" left open: C:\Users\snowgirl\AppData\Local\Temp\sftptest-readdeadlock065051590/writeTest
``̀ 

Error message doesn’t even say what file:
`̀ `
server_integration_test.go:617: C:\Windows\System32\OpenSSH\sftp.exe: exit status 1: Couldn't stat remote file: Failure

😬

server_integration_test.go:694: put: local /tmp/sftp.65b523619ba1776cc46bf73a4337dd8d remote /tmp/sftp.ae0dc63945ea2295246a74b92d609d22
server_integration_test.go:699: open /tmp/sftp.65b523619ba1776cc46bf73a4337dd8d: The system cannot find the path specified.
$ grep -r tmp
server_integration_test.go:     tmpDirRemote := "/tmp/" + randName()

Where is this weird , output coming from?

--- FAIL: TestServerPutRecursive (0.06s)
    server_integration_test.go:869: put recursive: local C:\Users\snowgirl\Work\sftp remote /tmp/sftp.27a44279ebd0fbbb08777194541b8adb
    server_integration_test.go:873: runSftpClient failed: C:\Windows\System32\OpenSSH\sftp.exe: exit status 1: Couldn't stat remote file: Failure
        , output
drakkan commented 3 years ago

@puellanivis I did some tests here we have to rewrite a lot of test cases to make them work on Windows :-(

puellanivis commented 3 years ago

Yeah, this is probably definitely going to end up being an epic. 😆