Open kylebrandt opened 11 years ago
Changing:
out = connection.exec!("ls -pa #{path}")
to:
out = connection.exec!("ls -pa \"#{path}\"")
in remote.rb does hack around the word splitting problem partially, but then when expanding I get:
> Directory '/kbrandt@192.168.1.122/home/kbrandt/test folder/' doesn't exist. Create it?
Something like:
out = connection.sftp.dir.entries(path).map { |e| (e.directory? ? e.name + "/" : e.name) }
Might be better, less string mangling (Just learning ruby though, so don't really know what I am talking about)
Is it working fine for dirs without spaces?
--Craig
On Sat, Sep 15, 2012 at 11:05 AM, kylebrandt notifications@github.comwrote:
Something like:
out = connection.sftp.dir.entries(path).map { |e| (e.directory? ? e.name+ "/" : e.name) }
Might be better, less string mangling (Just learning ruby though, so don't really know what I am talking about)
— Reply to this email directly or view it on GitHubhttps://github.com/trogdoro/xiki/issues/17#issuecomment-8587158.
Ah no it isn't, some dirs without spaces get "Directory doesn't exist". That is true of the original version as well though, so seems like that is a different issue.
For example:
Directory '/kbrandt@192.168.1.122/home/kbrandt/.gegl-0.0/swap/' doesn't exist. Create it?
I should add better error handling.
Can you try it with a server name instead of an IP?
Side note, it's assumed your certs are set up to connect to the remote server. I.e. it assumes if you ssh on the command line to that server it connects without asking you for a password.
--Craig
On Sat, Sep 15, 2012 at 11:16 AM, kylebrandt notifications@github.comwrote:
Ah no it isn't, some dirs without spaces get "Directory doesn't exist". That is true of the original version as well though, so seems like that is a different issue.
— Reply to this email directly or view it on GitHubhttps://github.com/trogdoro/xiki/issues/17#issuecomment-8587253.
/kbrandt@kbrandt-desktop/home/kbrandt/ - .gegl-0.0/ + plug-ins/ - swap/ > Directory '/kbrandt@kbrandt-desktop/home/kbrandt/.gegl-0.0/swap/' doesn't exist. Create it? - @mkdir
Same issue when using the name. The bug I first posted makes sense, execute probably uses a shell, since there are no quotes, ls
interprets a folder with spaces as two arguments to the command because of word splitting. I know shell, but not ruby (yet), so that is about the limit of the help I can offer at this point :-/
Did it successfully display the .gegl-0.0 dir, or did you type that yourself?
--Craig
On Sat, Sep 15, 2012 at 11:25 AM, kylebrandt notifications@github.comwrote:
/kbrandt@kbrandt-desktop/home/kbrandt/
- .gegl-0.0/
- plug-ins/
- swap/
Directory '/kbrandt@kbrandt-desktop/home/kbrandt/.gegl-0.0/swap/' doesn't exist. Create it?
- @mkdir
Same issue when using the name. The bug I first posted makes sense, execute probably uses a shell, since there are no quotes, ls interprets a folder with spaces as two arguments to the command because of word splitting. I know shell, but not ruby (yet), so that is about the limit of the help I can offer at this point :-/
— Reply to this email directly or view it on GitHubhttps://github.com/trogdoro/xiki/issues/17#issuecomment-8587362.
It did correctly display that directory.
I think I see the pattern now, the problem is with empty directories it seems:
/kbrandt@kbrandt-desktop/home/kbrandt/ + test/ - test folder/ - emptyfolder/ > Directory '/kbrandt@kbrandt-desktop/home/kbrandt/test folder/emptyfolder/' doesn't exist. Create it? - @mkdir/ + test
Ah, cool. I recently added the code to suggest creating dirs when they don't exist. Works locally, but I haven't gone back and made it work with remote dirs. I'll need to get @mkdir working remotely as well.
--Craig
On Sat, Sep 15, 2012 at 11:50 AM, kylebrandt notifications@github.comwrote:
It did correctly display that directory.
I think I see the pattern now, the problem is with empty directories it seems:
/kbrandt@kbrandt-desktop/home/kbrandt/
- test/
test folder/
- emptyfolder/
Directory '/kbrandt@kbrandt-desktop/home/kbrandt/test folder/emptyfolder/' doesn't exist. Create it?
- @mkdir/
- test
— Reply to this email directly or view it on GitHubhttps://github.com/trogdoro/xiki/issues/17#issuecomment-8587644.
Sounds good, just to be clear it seems it doesn't realize that the parent directory does exist if it doesn't have any files in it, so there is a detection issue there of some sort. So it saying the directory doesn't exist even though it does.
Yeah, got it. I actually remember running into that myself a while back. No remote servers should have empty directories!
Kidding, will fix it soon.
When listing directories for a remote host, folders with spaces are not handled correctly.
For example, if I go to:
And try to expand "test folder", I get: