Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scw logs failes with bash error on Windows #338

Closed
Hades32 opened this issue Apr 6, 2016 · 6 comments
Closed

scw logs failes with bash error on Windows #338

Hades32 opened this issue Apr 6, 2016 · 6 comments
Milestone

Comments

@Hades32
Copy link

Hades32 commented Apr 6, 2016

OS: Windows 10
Shell: Msys2, Part of Git 2.7.0.windows.1
Logged in with token and organisation.
Image: Docker 1.10

marti@WIN-SJ0A7GO32DV /d/Temp
$ scw logs 14a75140-43df-4cdf-b1db-586042aacbac
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file
time="2016-04-06T23:38:27+02:00" level=fatal msg="cannot execute 'logs': command execution failed: exit status 1"

@Hades32
Copy link
Author

Hades32 commented Apr 6, 2016

SCW Version 1.9

@moul moul added the bug label Apr 7, 2016
@moul
Copy link
Contributor

moul commented Apr 7, 2016

This is certainly due to the way we are handling remote command executions on Windows.

Can you run scw -D logs 14a75140-43df-4cdf-b1db-586042aacbac (with debug), you should get the command we try to run, something like ssh 1.2.3.4 /bin/sh -c dmesg

Then can you try to run this command manually from your shell and paste us here the result of these two commands ?


@QuentinPerez, I think we should bullet-proof the utils.SSHExec() function for Windows

@moul moul modified the milestone: 1.10.0 Apr 7, 2016
@Hades32
Copy link
Author

Hades32 commented Apr 7, 2016

$ scw -D logs 01188db2-a70d-4aa8-a4d6-aa246e1a32bf
time="2016-04-07T23:01:15+02:00" level=debug msg="curl -X GET -H \"Content-Type: application/json\" -H \"User-Agent: scw/v1.9.0\" -H \"X-Auth-Token: 00000000-0000-1000-0000-000000000000\" https://api.scaleway.com/servers"
time="2016-04-07T23:01:15+02:00" level=debug msg="curl -X GET -H \"Content-Type: application/json\" -H \"User-Agent: scw/v1.9.0\" -H \"X-Auth-Token: 00000000-0000-1000-0000-000000000000\" https://api.scaleway.com/servers/01188db2-a70d-4aa8-a4d6-aa246e1a32bf"
time="2016-04-07T23:01:16+02:00" level=debug msg="Executing: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c \"\\\"dmesg\\\"\""
Warning: Permanently added '163.172.142.208' (ECDSA) to the list of known hosts.
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file
Connection to 163.172.142.208 closed.
time="2016-04-07T23:01:19+02:00" level=fatal msg="cannot execute 'logs': command execution failed: exit status 1"

@moul
Copy link
Contributor

moul commented Apr 7, 2016

Can you try to run the four following commands and tell us if any of these succeed:

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "\"dmesg\""

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "dmesg"

ssh -o UserKnownHostsFile=NUL -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "\"dmesg\""

ssh -o UserKnownHostsFile=NUL -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "dmesg"

I think we have a least a bad path on windows: /dev/null should be NUL, I also have a doubt about the double-escaping

@Hades32
Copy link
Author

Hades32 commented Apr 7, 2016

All four work. /dev/null is expected to work from Bash and I think ssh.exe has special handling for it.

@Hades32
Copy link
Author

Hades32 commented Apr 8, 2016

works fine now

@Hades32 Hades32 closed this as completed Apr 8, 2016
@moul moul removed the bug label Apr 8, 2016
clement-gilbert pushed a commit to clement-gilbert/scaleway-cli that referenced this issue Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants