zsh-workers
 help / color / mirror / code / Atom feed
From: Nate Eldredge <nate@thatsmathematics.com>
To: zsh-workers@zsh.org
Subject: SIGABRT/SIGIOT confusion under Linux
Date: Sat, 25 Mar 2023 14:40:36 -0600 (MDT)	[thread overview]
Message-ID: <3ac2df17-56b4-be10-b3ba-f27af8d1c47a@thatsmathematics.com> (raw)

On Linux, the obscure SIGIOT signal, which hasn't really been meaningful 
on any machine since the PDP-11, is an alias for the common SIGABRT 
(signal 6).  The system strsignal() function maps signal 6 to the expected 
description "Aborted".  However, since zsh does its own translation, and 
since the SIGABRT precedes SIGIOT in Linux's <signal.h>, the latter 
overwrites the former in zsh's signal string tables.  See 
Src/signames2.awk.

This has (at least) two unfortunate results:

1. When a command aborts by calling `abort()`, which raises SIGABRT, zsh 
emits the message "zsh: IOT instruction (core dumped)" which will surely 
mystify most users.

2. The `kill` builtin doesn't accept `-ABRT`.  If you wanted to send the 
abort signal to a process, you would have to know to do `kill -IOT pid` 
instead, or `kill -6 pid` if you have the numbers memorized.

Tested with zsh 5.9 as distributed with Ubuntu 22.10 on x86-64, but the 
latest zsh source in git seems to not have changed.

-- 
Nate Eldredge
nate@thatsmathematics.com



             reply	other threads:[~2023-03-25 20:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 20:40 Nate Eldredge [this message]
2023-03-26  8:28 ` PATCH: Handle SIGIOT as an alias to SIGABRT if they are the same signal number Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ac2df17-56b4-be10-b3ba-f27af8d1c47a@thatsmathematics.com \
    --to=nate@thatsmathematics.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).