-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
service: correctly quote arguments. #15875
Conversation
Library/Homebrew/service.rb
Outdated
@@ -399,6 +399,7 @@ def manual_command | |||
.map { |k, v| "#{k}=\"#{v}\"" } | |||
|
|||
out = vars + command if command? | |||
out.map! { |arg| arg.include?(" ") ? "'#{arg}'" : arg } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe sh_quote
is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that outputs /opt/homebrew/opt/nginx/bin/nginx -g daemon\ off\;
which looks less pretty to be but is correct I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed in 60cdc60
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that one is correct, I believe it should be /opt/homebrew/opt/nginx/bin/nginx -g 'daemon off;'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SMillerDev these two are equivalent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe nginx specifically complained. But if you say it works that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SMillerDev yeh, seems to work fine here, both work the same.
If you have a run argument with a space in it: it will need to be quoted to be passed through correctly when run as a manual command. Fixes #15871.
As-of Homebrew/brew#15875 being merged and tagged: this will no longer be needed.
If you have a run argument with a space in it: it will need to be quoted to be passed through correctly when run as a manual command.
Will allow removing manual quoting differences e.g. in https://github.com/Homebrew/homebrew-core/blob/66ebc5d0f0c0df80d96e901b94d4bcf5bc900534/Formula/n/nginx.rb#L149-L153
Fixes #15871.