bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Mike Fulton <mikefultonpersonal@gmail.com>
To: bug-gnulib@gnu.org
Subject: numbered signals cause z/OS grief
Date: Fri, 25 Nov 2022 16:11:17 -0800	[thread overview]
Message-ID: <CAOmchhGZ5uuO9F2CPjy_B_9v7XsL49wPNA76g8Y7JzvzxefDrQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1399 bytes --]

Hello

I am working on enabling the gnulib tools to work on z/OS. I would like to
request a patch to avoid warnings when setting traps in the shell. In
particular, z/OS issues a warning when a trap is set for signal 13 instead
of SIGPIPE. My proposed patch is as follows, changing numbered signals to
named signals. This may also be easier for developers to read that aren't
'signal experts'.

diff --git a/gnulib-tool b/gnulib-tool
index 028bcf36a..01b2211be 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -1698,7 +1698,7 @@ trap 'exit_status=$?
       fi
       rm -rf "$tmp"
       exit $exit_status' 0
-for signal in 1 2 3 13 15; do
+for signal in SIGHUP SIGINT SIGABRT SIGPIPE SIGTERM; do
   trap '{ signal='$signal'; func_exit 1; }' $signal
 done
 signal=0
@@ -7676,12 +7676,12 @@ fi

 rm -rf "$tmp"
 # Undo the effect of the previous 'trap' command. Some shellology:
-# We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
+# We cannot use "trap - 0 SIGHUP SIGINT SIGABRT SIGPIPE SIGTERM", because
Solaris sh would attempt to
 # execute the command "-". "trap '' ..." is fine only for signal 0 (=
normal
 # exit); for the others we need to call 'exit' explicitly. The value of $?
is
 # 128 + signal number and is set before the trap-registered command is run.
 trap '' 0
-trap 'func_exit $?' 1 2 3 13 15
+trap 'func_exit $?' SIGHUP SIGINT SIGABRT SIGPIPE SIGTERM

 exit 0

[-- Attachment #2: Type: text/html, Size: 1708 bytes --]

                 reply	other threads:[~2022-11-26  4:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=CAOmchhGZ5uuO9F2CPjy_B_9v7XsL49wPNA76g8Y7JzvzxefDrQ@mail.gmail.com \
    --to=mikefultonpersonal@gmail.com \
    --cc=bug-gnulib@gnu.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).