forked from mvdan/sh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expand: tilde expansions shouldn't expand further
To quote the latest version of the POSIX Shell spec: The pathname resulting from tilde expansion shall be treated as if quoted to prevent it being altered by field splitting and pathname expansion. That is, when HOME='/*', the command "echo ~" should just print "/*" and not do any globbing at all. This was usually not a problem on Unix-like systems, but Windows uses backslashes as path separators. Thus, HOME='C:\foo\bar' is a very normal occurrence. However, since we treated the result of tilde expansion as unquoted, "echo ~" would result in the output "C:foobar", since we'd eat the backslashes when taking care of character escapes. Fix that, and add a few tests for these edge cases. Fixes mvdan#356.
- Loading branch information
Showing
3 changed files
with
24 additions
and
10 deletions.
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
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