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

Exit with negative numbers causes assertion failure #9659

Closed
IsaacOscar opened this issue Mar 14, 2023 · 0 comments
Closed

Exit with negative numbers causes assertion failure #9659

IsaacOscar opened this issue Mar 14, 2023 · 0 comments
Milestone

Comments

@IsaacOscar
Copy link

I probably shoudln't be doing this, but when I use the exit builtin with a negative number, I get an assertion failure. For example, running fish -c 'exit -1' gives:

warning: builtin exit returned invalid exit code -1
error: /home/abuild/rpmbuild/BUILD/fish-3.6.0/src/proc.h:97: failed assertion: ret >= 0 && "trying to create proc_status_t from failed wait{,id,pid}() call" " or invalid builtin exit code!"
error: Backtrace:
0   fish(+0xf4eba) [0x559073362eba]
1   fish(+0xf837c) [0x55907336637c]
2   fish(+0x138db1) [0x5590733a6db1]
3   fish(+0x13a6fe) [0x5590733a86fe]
4   fish(+0x13a85b) [0x5590733a885b]
5   fish(+0x73943) [0x5590732e1943]
6   fish(+0x1fb77) [0x55907328db77]
7   fish(+0x15a04) [0x559073283a04]
8   /lib64/libc.so.6(+0x27af0) [0x7fd1b6735af0]
9   __libc_start_main + 139
10  fish(+0x18285) [0x559073286285]

fish: Job 1, 'fish -c 'exit -1'' terminated by signal SIGABRT (Abort)

Note that the crash is in the fish that I just spawned to run exit -1, not the shell used to spawn fish.

Version Information:

  • fish --version reports fish, version 3.6.0
  • uname -a reports Linux DESKTOP-38G9TM7 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
  • I'm running openSUSE Tumbleweed (version 20230304) in WSL version 1.1.3.0
  • My terminal is "Windows Terminal"
  • Runing with fish under env HOME=$(mktemp -d) makes no difference
@faho faho closed this as completed in a16abf2 Mar 14, 2023
@ridiculousfish ridiculousfish added this to the fish 3.7.0 milestone Mar 14, 2023
@zanchey zanchey modified the milestones: fish next-3.x, fish 3.7.0 Aug 4, 2023
faho added a commit that referenced this issue Sep 8, 2023
Another from the "why are we asserting instead of doing something
sensible" department.

The alternative is to make exit() and return() compute their own exit
code, but tbh I don't want any *other* builtin to hit this either?

Fixes #9659

(cherry picked from commit a16abf2)
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

3 participants