-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Quoting for start arguments #10099
Merged
Merged
Quoting for start arguments #10099
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
68209de
Quoting for start arguments
gregw a85ccf5
Quoting for start arguments
gregw 26af0c8
Quoting for start arguments
gregw d65ca77
Quoting for start arguments
gregw df91bfd
Quoting for start arguments
gregw f4a2dea
Quoting for start arguments
gregw ff67ade
Quoting for start arguments
gregw 44c1fe2
Quoting for start arguments
gregw 845fbb1
Apply suggestions from code review
gregw 61b51ba
Quoting for start arguments
gregw ab25cd9
Apply suggestions from code review
gregw 6871906
Quoting for start arguments
gregw 4ecf521
* Made "dry-run=multiline" hidden.
sbordet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We don't want to use double quotes with sh / bash / zsh, we want to use strong quotes
'
, as that will not interpret the contents between the quotes.Examples:
sh
on ubuntubash
on ubuntuzsh
on ubuntuThere 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.
Using single quotes is ugly/complex because we have to escape literal single quotes outside of the scope of the quotes, so quoting something like
my.property='foo bar'
(where the single quotes are literal) will end up with the unreadablemy.property=\''foo bar'\'
Double quotes a simpler and with 4 characters that need escaping are well enough defined and simple to support.
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.
The example property
my.property='foo bar'
would, as if it appeared instart.d/my.ini
would mean that the end user wants the single quotes in the value as the end result (meaning if they doproperties.get("my.property")
they would expect a String with those single-tick characters:"'foo bar'"
)The end result would be for strong quotes ...
The entire argument is strong quoted, not just a section.
Example:
This Strong Quoting also eliminates ALL interpretation of the contents of the quoted string by the shell (on all shells)
From the GNU dash man page (what the standard
sh
is on Ubuntu)Something that Double Quotes does not do, and escaping will need to be SUPER robust (things you are ignoring in this PR will fail on various shells) if we go that route.
Yes, I'm aware that
dash
only mentions a handful of characters for Double Quotes, the other shells have far more special characters when encountered within Double Quotes (a behavior that Strong Quoting doesn't have)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.
@joakime I think what you have been trying to say is: "xargs doesn't grok double quotes like y'd think". Once I worked that out, then OK let's go with single quotes. updated.
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.
@joakime what I meant to say was... thanks for persisting and I understood the issue eventually.
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.
It's not
xargs
doing that.It is
bash
doing that,bash
(andzsh
) will evaluate on any redirection/pipe before redirection/pipe (unlikedash
).This was a design decision by
bash
to get around deficiencies insh
not allowing variables to be set on redirection/pipe.