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 option parsing so it works across possible SH implementations #287

Open
alerque opened this issue Apr 3, 2021 · 2 comments
Open

Fix option parsing so it works across possible SH implementations #287

alerque opened this issue Apr 3, 2021 · 2 comments

Comments

@alerque
Copy link
Collaborator

alerque commented Apr 3, 2021

Per the yucky discovery here our current option parsing is not robust across SH implementations. Whatever @RichiH's has works. My systems don't.

On my systems /bin/sh is a symlink to bash, which should be triggering its internal POSIX compatibility mode. Whatever you think of this it's a pretty common arrangement.

On the other hand I tested dash and I get different results:

$ ./vcsh -v foreach -g echo foo
verbose mode on
vcsh 1.20141026
vcsh: verbose: foreach begin
que-atom:
git: 'echo' is not a git command. See 'git --help'.

The most similar command is
        fetch

$ dash ./vcsh -v foreach -g echo foo
verbose mode on
vcsh 1.20141026
vcsh: verbose: foreach begin
que-atom:
foo
@RichiH
Copy link
Owner

RichiH commented Apr 3, 2021

I seem to remember very, very, very dimly that Bash's POSIX compatibility mode not actually being POSIX compatible is what prompted me to hand-craft the option parsing.

@mirabilos might be able to help with his POSIX-fu.

@alerque
Copy link
Collaborator Author

alerque commented Apr 3, 2021

It's possible that is the case, but the hand crafted version isn't working either. Different error (it fails early) but it still doesn't work. The safe-harbor release under Bash's pseudo POSIX gives:

$ vcsh -v foreach -g echo foo
verbose mode on
vcsh 1.20141026
/usr/bin/vcsh: illegal option -- g
...

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

No branches or pull requests

2 participants