-
Notifications
You must be signed in to change notification settings - Fork 39
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 in config files is not being handled as expected #35
Comments
I can't detect any effect from this change in the PowerShell console.
As I noted before the change, the value in an --encryption-context pair can be a single or double-quoted string, but the key cannot be quoted. These commands fail:
These commands work as expected:
|
I did some further testing and found that this is a quirk with PowerShell. I'm guessing that in PS the quotes override whitespace in separating values, but only if they come first? Test codeimport argparse
import sys
def main():
# Print the raw arguments that we get from the shell
print(sys.argv)
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
parser.add_argument('-f', nargs='+', action='append')
args = parser.parse_args()
# Print the processed arguments from argparse
print(args)
if __name__ == '__main__':
main() ResultsLinux (bash)
MacOS (bash)
PowerShell
Given that this usage is not something we wanted to encourage anyway, I'm inclined to just say "don't do this". Maybe we should include a note explicitly saying note to do this in PowerShell? The only way to fix this would be to modify the user input, but I really don't think we should do that. I think that would be much more likely to cause surprising behavior than breaking. |
I agree. Right now, the docs say that if you are working in a PowerShell console and you want to include spaces or special characters in the name or value of a name=value pair, enclose the entire pair in quotation marks. |
Sounds good! |
Problem
Because the config files are read as raw data, not interpreted by a shell, quoted contents are not being handled correctly.
ex:
Possible Solution
I think we should be able to solve this by just using
shlex.split
rather thanstr.split
in the custom config file handler.The text was updated successfully, but these errors were encountered: