Skip to content
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

Fix #17366 (cmdline parsing of repeated --) #17371

Merged
merged 1 commit into from
Jul 12, 2016
Merged

Conversation

carlobaldassi
Copy link
Member

This just passes through the -- arguments from the command line after the first one (which is used as an argument separator).
Previously, passing more than one -- raised an error, which seems overprotective: after all, consider that you could even have a file called -- in the filesystem, if you're really into that sort of things...

So this fixes #17366, and it seems conceptually more correct to me (provided I didn't screw up, I'm not familiar with this code and command line parsing may have been assuming the previous behaviour for some reason, but I did not find any hint that it was).

I think this should also be backported, if it gets in.

@carlobaldassi
Copy link
Member Author

Just for kicks, here is how standard command line tools behave:

$ echo > --
$ ls -- --
--
$ rm -i -- --
rm: remove regular file ‘--’? y
removed ‘--’

@jakebolewski
Copy link
Member

👍

This is an improvement (@vtjnash raised this in #10726 (comment)). If I remember correctly this does not fix our getopt parsing though (which is why I gave up and punted). For instance if we have a file named -- with contents (println(ARGS)) then julia-dev --load -- -- foo bar baz should print out ["foo", "bar", "baz"] per system getopt parsing rules but currently fails with this PR.

@StefanKarpinski
Copy link
Member

Seems sane to me and since @jakebolewski wrote the previous fix to this, 👍.

@tkelman tkelman merged commit a18b18c into master Jul 12, 2016
@tkelman tkelman deleted the cb/dbldashparsing branch July 12, 2016 09:24
PallHaraldsson pushed a commit to PallHaraldsson/julia that referenced this pull request Aug 10, 2016
x JuliaLang#17366 (cmdline parsing of repeated `--`)

Power is already in NEWS

News this be a separate pull?

PCRE2

Fixed misalignment in doc.

Power is already in NEWS

News this be a separate pull?

Fixed misalignment in doc.

Fixed misalignment in doc.
@tkelman
Copy link
Contributor

tkelman commented Sep 13, 2016

On release-0.4 I'm a little confused what to do about the conflict here since process_options takes an args input and is a bit inconsistent about sometimes working with that argument and sometimes working with the global ARGS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command line parsing removes the -- after arguments have already started
4 participants