-
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
Improved start.jar
dry-run command line quoting
#10090
Closed
Closed
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d2b83b6
Start commandline quoting
gregw 57cf4a7
Start commandline quoting
gregw 620e9ae
Start commandline quoting
gregw a27ef4c
Start commandline quoting
gregw 0983568
Start commandline quoting
gregw c8c5d93
Start commandline quoting
gregw e614ae3
Start commandline quoting
gregw 8df8616
Start commandline quoting
gregw 94dc01f
Merge remote-tracking branch 'origin/jetty-12.0.x' into fix/jetty-12-…
gregw 37ff35a
Start commandline quoting
gregw e11a867
Start commandline quoting
gregw b6810ef
Start commandline quoting
gregw 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.
The list of characters for bash (haven't looked at other shells yet) that have special meaning ...
~
`
#
$
&
*
(
)
\
|
[
]
{
}
;
'
"
<
>
/
?
!
Each of those should trigger quoting and in some cases escaping
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 we don't need every special character, we just need metacharacters that are used to split a command line and characters involved with quoting itself.....
Or do we need to also protect wild cards? Hmmm probably yes....
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 wonder if it would be simpler to have a set of characters that we don't need to quote for: a-z A-Z 0-9 _-/
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.
Here's a longer breakdown of special characters for the shells: csh, sh, bash, ksh, zsh
~
`
#
#
^
^
$
&
*
(
)
\
|
|
[
]
{
}
{
}
:
:
;
;
'
"
<
>
/
-
?
?
!
!
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 wouldn't include
-
(dash) or/
(slash) in that list.The
-
(dash) is used as stdin or stdout reference in many shells.And the
/
(slash) is used as a hard path separator in some shells (forces the shell to intepret the text around the/
in path terms, applying path behaviors to that string), and a soft separator in others (if present, the matching logic applies to the strings adjacent too)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.
For Windows, the rules are a bit different ...
You can only use the
\
back-slash to escape non-control characters when executing in CMD (such as a space character).In Powershell, the escaping is done with
^
character.We will likely need separate quoting and escaping methods for Unix/Linux/OSX and Windows. (Maybe even a special method for those users on Powershell)
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 think this can only really be output for unix shells, and then only the common ones. It is a tool for human debugging and for doing start scripts.
If we keep the output constant, then others can transform to any special usages
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've updated the
usage.txt
file to make it clear that the output is only suitable for the unixsh
command. I do not think we can come up with an output format that will work on every shell on every platform. I also think that any attempt to cover multiple platforms is just going to result in hard to handle variable output. Best to just give fixed output and allows any users on other platforms either to use a sh port or do a transformation.