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

Use of --posix for bash integration causes unwanted side effects #5349

Closed
dcolascione opened this issue Aug 4, 2022 · 3 comments
Closed
Labels

Comments

@dcolascione
Copy link
Contributor

dcolascione commented Aug 4, 2022

Describe the bug

Kitty's addition of --posix to bash command line for integration injection makes the injection non-transparent and can break user scripts. In particular, --posix causes bash to enable the inherit_errexit shell option. inherit_errexit remains enabled even after kitty.bash resets the posix shell option.

inherit_errexit being unexpectedly enabled can break sourced shell functions in subtle and hard-to-guess ways.

To Reproduce
Steps to reproduce the behavior:

  1. Launch bash in kitty with integration enabled
  2. Run shopt -p inherit_errexit
  3. Observe that inherit_errexit is enabled
  4. Run the same command in xterm and observe that inherit_errexit is disabled
@dcolascione dcolascione added the bug label Aug 4, 2022
@kovidgoyal
Copy link
Owner

That's a bug in bash, it should reset the setting when resetting posix.
In any case its trivial to workaround, simply have kitty.bash reset it.
Feel free to send a PR.

@dcolascione
Copy link
Contributor Author

Why are you closing this bug? User shell code is still broken. Whether or not bash should reset options set as a side effect of using --posix, it doesn't, and even if we changed bash's behavior today, it'd be years before a version of bash with that change propagated to users.

@kovidgoyal kovidgoyal reopened this Aug 4, 2022
@kovidgoyal
Copy link
Owner

Because its already fixed.

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

No branches or pull requests

2 participants