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

cmd/go: print shell commands safely #5279

Open
robpike opened this Issue Apr 12, 2013 · 9 comments

Comments

Projects
None yet
4 participants
@robpike
Contributor

robpike commented Apr 12, 2013

The printing of commands by the go tool is simple-minded, can be incorrect in the face
of empty strings and other issues, ignores system-dependent issues ($foo vs %foo;
quoting, etc.) and should be improved. The current setup just calls Printf or special
formatting routines that sometimes (not always) expand variables, and ignore local
quoting and other conventions (rm vs. del for example). It's not important but it is
worth doing right.

It's a big job.
@robpike

This comment has been minimized.

Contributor

robpike commented Apr 12, 2013

Comment 1:

Issue #5274 has been merged into this issue.

@gopherbot

This comment has been minimized.

gopherbot commented Apr 12, 2013

Comment 2 by toqueteos:

I'm sorry Rob I forgot to search for "shell".
Is the idea of a replay command suitable or it's better to ouput native shell commands?
@alexbrainman

This comment has been minimized.

Member

alexbrainman commented Apr 14, 2013

Comment 3:

To sumup from https://golang.org/issue/5274. Possible unix to
windows command translation candidates:
"cp" -> "copy /y" 
"mkdir -p" -> "mkdir"
"rm -f" -> "del /f /q" for files and "rmdir /s /q" for directories
"rm -r" -> same as before
Alex
@alexbrainman

This comment has been minimized.

Member

alexbrainman commented Apr 14, 2013

Comment 4:

Issue #5274 has been merged into this issue.

@rsc

This comment has been minimized.

Contributor

rsc commented Jul 30, 2013

Comment 5:

I am not sure it is worth doing right.
The printing of commands by the go tool is meant to be informational, not a working
shell script.
@alexbrainman

This comment has been minimized.

Member

alexbrainman commented Jul 31, 2013

Comment 6:

I am with rsc on this. I suspect correct windows translation could be complicated (too
many unusual parameters options) or impossible to do correctly. I think clarity is most
important here.
Alex
@rsc

This comment has been minimized.

Contributor

rsc commented Nov 27, 2013

Comment 7:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment