Always use bundled getopt_long implementation#40104
Always use bundled getopt_long implementation#40104fingolfin wants to merge 3 commits intoJuliaLang:masterfrom
Conversation
|
Test fails with this error: I guess that means the "new" getopt code enabled here really wants Given that this getopt code is from musl, but is fairly old (~2014?) the first thing I'd try is to see if their newer version works better, and whether it could be used. However, it seems to have been changed substantially, so I am not sure how viable this is. Or one could just improve the code that we have already, it shouldn't be too hard for just this one usecase. However, before I investigate either option, it'd be good to know whether this PR has any chance of landing at all -- if this is not something the Julia core devs want out of some principle, there is no point in me trying to fix this (and possible other) issue(s). |
|
I think a change like this needs at least a deprecation cycle, where any args that fail due to this PR , would succeed but with a deprecation warning. Something that would show up in e.g. CI logs and give people a chance to transition. |
|
Those two issues look probably fixed by https://git.musl-libc.org/cgit/musl/commit/src/misc/getopt_long.c?h=v1.1.18&id=cfd7b4acd55420deedd41e0614c9b614c73c743e and https://git.musl-libc.org/cgit/musl/commit/src/misc/getopt_long.c?h=v1.1.18&id=91184c4f16b143107fa9935edebe5d2b20bd70d8. It does seem potentially useful to vendor our own here for consistency, so we could get the latest version there, or bundle another common one such as https://github.com/apple-open-source-mirror/Libc/blob/master/stdlib/FreeBSD/getopt_long.c |
|
Would you be willing to update to the new musl code, so we do get consistent behavior on all platforms? |
|
It should just require downloading those patches, and using |
|
I will take another look |
779a01c to
4fb7867
Compare
|
So I've looked into this a bit again, and got it working with the most recent getopt_long in musl. However, the code needs at least some patching, plus some hackery to avoid clashes between its symbol and those define in the systems' version of
Any preferences? |
|
If we're unhappy enough, we can also use the command line parser in LLVM instead from libSupport, but I think it just hasn't been a major issue enough to be worthwhile making significant changes. |
... not just when building with MSVC. This ensures that command line arguments are processed uniformly on all platforms. It also gives us full control over how it behaves. Resolves JuliaLang#29669
4fb7867 to
d3b72e7
Compare
|
Actually when I just tried to rebase and update the PR, I noticed that PR #42586 was merged which actually removes the use of So I've now made PR #42703 which actually removes If this is still a goal, then I can also revive this PR. E.g. since dropping support for "abbreviated" options like |
|
It seems possibly still useful to vendor our own copy for consistency. |
|
From a reading of this PR, it seems like it may still be relevant, despite the linked PRs merged? |
... not just when building with MSVC. This ensures that command line
arguments are processed uniformly on all platforms. It also gives us
full control over how it behaves.
Resolves #29669, that is, typos like
julia --projec=t.(note how=andtare swapped) won't be silently accepted anymore.The code is a bit hacky; I could rewrite it to get rid of the
#definehack. On the other hand, it keeps the diff minimal and would make it very easy to revert this in the future again.