Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: misleading message for SIGFPE
- X-seq: zsh-workers 53118
- From: Andreas Kähäri <andreas.kahari@xxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: misleading message for SIGFPE
- Date: Tue, 24 Sep 2024 15:09:37 +0200
- Archived-at: <https://zsh.org/workers/53118>
- In-reply-to: <20240924123652.GA299236@qaa.vinc17.org>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- References: <20240924123652.GA299236@qaa.vinc17.org>
On Tue, Sep 24, 2024 at 02:36:52PM +0200, Vincent Lefevre wrote:
> When a command is terminated by SIGFPE, I get a message saying
> "floating point exception" (this comes from Src/signames.c):
>
> qaa% sh -c 'kill -FPE $$'
> zsh: floating point exception (core dumped) sh -c 'kill -FPE $$'
>
> However, a SIGFPE may also be generated by integer operations
> (such as 1 / 0).
>
> ISO C and POSIX use the term "erroneous arithmetic operation".
> The GNU C Library manual says "fatal arithmetic error".
>
> BTW, in addition to the signal description, I would suggest to
> output the signal name, e.g.
>
> SIGFPE - erroneous arithmetic operation (core dumped)
> SIGSEGV - segmentation fault (core dumped)
> SIGKILL - killed
>
> Otherwise it is not clear that the command termination is due to
> a signal (even though the exit status can be checked / reported).
Isn't it already clear from the value of $? what the signal was?
$ sh -c 'kill -FPE $$'
zsh: floating point exception sh -c 'kill -FPE $$'
$ echo $?
136
$ kill -l 136
FPE
--
Andreas (Kusalananda) Kähäri
Uppsala, Sweden
.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author