yanne / api-test

0 stars 0 forks source link

Get file silently fails when windows server (includes patch) #3

Closed yanne closed 10 years ago

yanne commented 10 years ago

None

This issue was originally opened at Google Code on Sep 24, 2008.

yanne commented 10 years ago

Original comment by SonOfLi...@gmail.com on Sep 24, 2008.

Shouldn't have edited my fix before posting it but after testing.

The fix that worked for me was to remove the "if" clause. Right now it seems that a more proper fix would be much harder, since st_mode IS set by paramiko but either isn't set correctly or isn't interpreted correctly by stat.S_ISREG().

Example values: [[438, 'AUTOEXEC.BAT'], [292, 'boot.ini'], [16822, 'Config.Msi'], [438, 'CONFIG.SYS'], [16822, 'Documents and Settings'], [16822, 'freeSSHd'], [292, 'IO.SYS'], [292, 'MSDOS.SYS'], [292, 'NTDETECT.COM'], [292, 'ntldr'], [438, 'pagefile.sys'], [16822, 'Perl'], [16676, 'Program Files'], [16822, 'Python25'], [438, 'remote_tests.html'], [438, 'results.xml'], [16822, 'robot'], [16822, 'System Volume Information'], [16822, 'WINDOWS']]

Apparently, stat.I_SREG calls I_SFMT (which ANDs with 170000h) and compares the result to 100000h. On my setup, that isn't the correct way to do it (don't have time to find what is). However, I do get different results to I_SFMT for files and directories - files give zero, directories give 7000h. So a patch that works for me is:

--- pythonclient.py +++ pythonclient.py @@ -107 +107 @@

This is based on looking at the source and printing debugging messages, I don't know where the fault lays or what the standards say should be the correct values...

-- Aur

yanne commented 10 years ago

Original comment by janne.t....@gmail.com on Sep 25, 2008.

It seems that the first problem has to fixed in the way described in the second patch. This is because the actual contents of st_mode attribute depend on the SFTP server implementation. It seems that this does not cause any problems with OpenSSH servers.

Can you add some details to your other problem. The reason we are using posixpath is because the SFTP-protocol uses slashes as path separators, regardless of the platform

yanne commented 10 years ago

Original comment by SonOfLi...@gmail.com on Sep 25, 2008.

Then a fix would be to document that POSIX paths must be used (as this is not true for other SSH clients I've used like pscp or OpenSSH's scp, and e.g. freeSSHd does support both path formats)

yanne commented 10 years ago

Original comment by SonOfLi...@gmail.com on Oct 2, 2008.

When will these be incorporated into a release?

Not trying to pressure anyone, just to decide whether I can wait or I need to get into the headache of deploying my patches across the company.

-- Aur

yanne commented 10 years ago

Original comment by janne.t....@gmail.com on Oct 30, 2008.

Fixed with regards to get file failing to find some files in r39