nu774 / sudo-for-cygwin

poor sudo clone for cygwin
http://sites.google.com/site/qaacpage/
72 stars 17 forks source link

error in line 40 os.chdir(cwd): OSError: [Errno 2] No such file or directory: '/cygdrive/b/path/to/some folder/2015/02_15' #4

Closed ggaussling closed 9 years ago

ggaussling commented 9 years ago

Hello, thank you for providing this software! I got an issue by running sudo in a script. I followed the entry under issues and at the end of the readme to install the server as a task on login. This was successful.

It seems, that sudo will not work with network mapped drives of mount type type netapp !

I mapped \\DATENSERVER\ao to drive B:

In a script with this command, I get an error message, but the path '/cygdrive/b/path/to/some folder/2015/02_15' is valid!

It worked formerly as cygstart --action=runas cmd /c $command | tee -a "$log_cyg", but with the elevation prompt, that I want to prevent.

Here is the part of the script:

command='mklink /D "D:\path\folder" "\DATENSERVER\ao\path\to\some folder\2015\02_15\folder" 2>&1 | wtee -a "\DATENSERVER\ao\path\to\some folder\2015\02_15~log" '

sudo cmd /c $command | tee -a "$log_cyg"

This is the output i get:

File "/home/$USER/bin/sudo-for-cygwin-master/sudoserver.py", line 40, in child os.chdir(cwd) OSError: [Errno 2] No such file or directory: '/cygdrive/b/path/to/some folder/2015/02_15' Closing connection Exception KeyError: KeyError(4293775964L,) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored

Maybe this helps? KeyError in module 'threading' after a successful py.test run

[07. Week, Fr, 2015-02-13, 11:43] user@pc168 /cygdrive/b/path/to/some folder/2015/02_15 $ ls -d '/cygdrive/b/path/to/some folder/2015/02_15' /cygdrive/b/path/to/some folder/2015/02_15

[07. Week, Fr, 2015-02-13, 11:43] user@pc168 /cygdrive/b/path/to/some folder/2015/02_15 $ sudo ls -d '/cygdrive/b/path/to/some folder/2015/02_15' Traceback (most recent call last): File "/home/user/bin/sudo-for-cygwin-master/sudoserver.py", line 40, in child os.chdir(cwd) OSError: [Errno 2] No such file or directory: '/cygdrive/b/path/to/some folder/2015/02_15' Closing connection Exception KeyError: KeyError(4293775964L,) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored`

Further tests (drive 'G:' is a local drive):

[07. Week, Fr, 2015-02-13, 11:55] user@user168 /cygdrive/b/path/to/some folder/2015/02_15 $ pushd ~ ~ /cygdrive/b/path/to/some folder/2015/02_15 ~

[07. Week, Fr, 2015-02-13, 11:56] user@user168 ~ $ sudo ls -d '/cygdrive/g/ao' /cygdrive/g/ao

[07. Week, Fr, 2015-02-13, 11:56] user@user168 ~ $ mount |grep 'G:' G: on /cygdrive/g type ntfs (binary,posix=0,user,noumount,auto)

[07. Week, Fr, 2015-02-13, 11:56] user@user168 ~ $ sudo ls -d '/cygdrive/b/path/to/some folder/2015/02_15' ls: cannot access /cygdrive/b/path/to/some folder/2015/02_15: No such file or directory

[07. Week, Fr, 2015-02-13, 11:56] user@user168 ~ $ ls -d '/cygdrive/b/path/to/some folder/2015/02_15' /cygdrive/b/path/to/some folder/2015/02_15

$ mount |grep 'B:' B: on /cygdrive/b type netapp (binary,posix=0,user,noumount,auto)`

ggaussling commented 9 years ago

As a workaround I switched to cygwin UNC path names. But that triggert cmd.exe /c mklinks UNC warnings. cmd.exe switched automatically into %systemroot% working directory. That implies absolute path names.

nu774 commented 9 years ago

Thanks for the report. Since sudoserver simply calls Python's chdir() function and it fails, I think there's nothing I can do for it. In other words, it won't fix.