-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
interp: display all options for bash's shopt
and explicitly state unsupported ones
#877
Comments
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 19, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` This commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options: ``` $ gosh -c "shopt | grep unsupported" cmdhist off (unsupported) complete_fullquote off (unsupported) extquote off (unsupported) force_fignore off (unsupported) hostcomplete off (unsupported) assoc_expand_once off (unsupported) autocd off (unsupported) ``` Also, rewrite the `bashOptsTable` so that it can keep two option states: - Supported options; and - Options that we may or may not allow users to override using the `-s` and `-u` flags We kept that distinction so we could error if one attempts to override the default options. In practice, toggling these defaults are generally okay, but in our case, it does not produce any side-effect and we wanted to be explicit about it when toggled. Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 19, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob: unsupported option name exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options: ``` $ gosh -c "shopt | grep unsupported" cmdhist off (unsupported) complete_fullquote off (unsupported) extquote off (unsupported) force_fignore off (unsupported) hostcomplete off (unsupported) assoc_expand_once off (unsupported) autocd off (unsupported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: - Supported options; and - Options that we may or may not allow users to override using the `-s` and `-u` flags We kept that distinction so we could error if one attempts to override the default options. In practice, toggling these defaults are generally okay, but in our case, it does not produce any side-effect and we wanted to be explicit about it when toggled. Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 19, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob: unsupported option name exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options: ``` $ gosh -c "shopt | grep unsupported" cmdhist off (unsupported) complete_fullquote off (unsupported) extquote off (unsupported) force_fignore off (unsupported) hostcomplete off (unsupported) assoc_expand_once off (unsupported) autocd off (unsupported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: - Supported options; and - Options that we may or may not allow users to override using the `-s` and `-u` flags We kept that distinction so we could error if one attempts to override the default options. In practice, toggling these defaults are generally okay, but in our case, it does not produce any side-effect and we wanted to be explicit about it when toggled. Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 26, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob off ("on" not supported) exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options, for example: ``` $ gosh -c "shopt" | grep "not supported" checkwinsize on ("off" not supported) cmdhist on ("off" not supported) complete_fullquote on ("off" not supported) extquote on ("off" not supported) force_fignore on ("off" not supported) // .. cut for brevity xpg_echo on ("off" not supported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: 1) Bash's default options and 2) whether we support it Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 26, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob off ("on" not supported) exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options, for example: ``` $ gosh -c "shopt" expand_aliases off globstar off nullglob off // .. cut for brevity hostcomplete on ("off" not supported) inherit_errexit on ("off" not supported) interactive_comments on ("off" not supported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: 1) Bash's default options and 2) whether we support it Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 29, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob off ("on" not supported) exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options, for example: ``` $ gosh -c "shopt" expand_aliases off globstar off nullglob off // .. cut for brevity hostcomplete on ("off" not supported) inherit_errexit on ("off" not supported) interactive_comments on ("off" not supported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: 1) Bash's default options and 2) whether we support it Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 29, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob off ("on" not supported) exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options, for example: ``` $ gosh -c "shopt" expand_aliases off globstar off nullglob off // .. cut for brevity hostcomplete on ("off" not supported) inherit_errexit on ("off" not supported) interactive_comments on ("off" not supported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: 1) Bash's default options and 2) whether we support it Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 29, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob off ("on" not supported) exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options, for example: ``` $ gosh -c "shopt" expand_aliases off globstar off nullglob off // .. cut for brevity hostcomplete on ("off" not supported) inherit_errexit on ("off" not supported) interactive_comments on ("off" not supported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: 1) Bash's default options and 2) whether we support it Fixes mvdan#877
riacataquian
added a commit
to riacataquian/sh
that referenced
this issue
Jun 29, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob off ("on" not supported) exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options, for example: ``` $ gosh -c "shopt" expand_aliases off globstar off nullglob off // .. cut for brevity hostcomplete on ("off" not supported) inherit_errexit on ("off" not supported) interactive_comments on ("off" not supported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: 1) Bash's default options and 2) whether we support it Fixes mvdan#877
riacataquian
added a commit
that referenced
this issue
Jun 29, 2022
Trying to set an unsupported but valid Bash option leads to a potentially confusing error message: ``` $ gosh -c "shopt -s extglob" shopt: invalid option name "extglob" ``` Fix that by handling the unsupported options differently from the invalid ones: ``` $ gosh -c "shopt -s extglob" bash: line 1: shopt: extglob off ("on" not supported) exit status 1 ``` Additionally, this commit lists all of the Bash options when `shopt` without arguments is called and explicitly identify the unsupported options, for example: ``` $ gosh -c "shopt" expand_aliases off globstar off nullglob off // .. cut for brevity hostcomplete on ("off" not supported) inherit_errexit on ("off" not supported) interactive_comments on ("off" not supported) ``` While at it, rewrite the `bashOptsTable` so that it can keep two option states: 1) Bash's default options and 2) whether we support it Fixes #877
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We don't support all of bash's shell options, at the moment we support these three:
Bash actually has more options than what's listed above, see shopt documentation but we only print what's supported which could be misleading and unhelpful, eg when someone looks up for an option
shopt | grep extglob
, they'll get empty results.Also trying to set an unsupported bash option leads to a confusing error message:
We could improve the error message by explicitly saying it is instead unsupported.
The text was updated successfully, but these errors were encountered: