Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14902
| Path | csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Pusillanimous Pussyfooter <0xef967c36@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: write() not retried after EINTR in printf and echo |
| Date | Sun, 9 Dec 2018 19:45:00 +0200 |
| Lines | 42 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.5482.1544390346.1284.bug-bash@gnu.org> (permalink) |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | usenet.stanford.edu 1544390347 5666 208.118.235.17 (9 Dec 2018 21:19:07 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:to:subject:mime-version:content-disposition :in-reply-to; bh=WhIqevurRLmBcMKa1KVCfqfDDpj26ZXJSGyp/2oOh2M=; b=ZVyR9Yy0GdS1LSG5+vBTvgAYf9lzyWCIe9j0rDheM6QimbEVPE5o+nWYjKsO51Vx+J F4xL5xajhb2jIURsNV0xk8faCXJB5J8B/aW+GFRw6k1/zq5PMD8tj2ixI43rozXfxr/i GRK9uP05bDuMsVGBv3z2sDO/hpGGjXWJo0WQ09OJfXlEtZnjQKWmaPpeGkolzjvdI1wY NBvxlbUlmOo23/VgZUQqLYdmRAyCVwTsFYE4AEUWabfZu6X8BUtc4UHn3GLG4Ep4ZYLX 1203IwzNSU41FDbWvGmeqHTxc/wFJaJLikkulxrAci4sxhSODZFkkGgQpel9mf28O/x2 O/yw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:to:subject:mime-version :content-disposition:in-reply-to; bh=WhIqevurRLmBcMKa1KVCfqfDDpj26ZXJSGyp/2oOh2M=; b=E9izhagU+RSVfL8E0BkKEuNjS09j3vPF1VX8oL8mm7RoWVZ4q0m3BcYzvJaHPDcJAv girlYu8JOa4sjtq3X3R7F3to4Rl1h+sjnAr/z2r+TlrjM3Xkje/TG+YXC5SsKSdZReYz ukuEPzF2E/eUyCaVRFkyE4vSXvcDM4aXd4RGC2+yOmWVJVSuz4E7IlYCsIR4rNSz2GWK HuAvg89sg1YevQC2aQO5Tz2XqP8NLQ3WzuDufylrsWw7M/0eojQTGkae94KFsO3RJKmm sSW4X4BTJwzHKiwBvb1xi4v2IinfCxtR8tNWveUH2Olk0NPyZ2lQz7gno5U3EyB7+twZ i1MA== |
| X-Gm-Message-State | AA+aEWYrQY/W0rdg7LPjR2w6F7CvlNK8h+bghGexCxV/ls5N1NCq3wQ1 nKTN37ulJ5CPk3vqEi9cEo9ImCc3XgY= |
| X-Google-Smtp-Source | AFSGD/U4LVCFnDjeuKYQm37pCf+2dMmbj9XtB2qkkf8jLsLgr/itPm9sLZexljQq4T80USd4Mk0Xdg== |
| X-Received | by 2002:a1c:bd82:: with SMTP id n124mr7842137wmf.105.1544377502552; Sun, 09 Dec 2018 09:45:02 -0800 (PST) |
| Content-Disposition | inline |
| In-Reply-To | <520ffeef-3f3f-ff5f-027f-b00f0c28e11e@case.edu> |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2a00:1450:4864:20::32e |
| X-Mailman-Approved-At | Sun, 09 Dec 2018 16:19:05 -0500 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14902 |
Show key headers only | View raw
> There are a couple of signals for which this is the appropriate behavior.
> The right fix is to install handlers with the SA_RESTART flag set. The
> next version of bash will install its SIGWINCH handler with SA_RESTART.
Here is a trivial patch doing just that, though IMHO it would be much better
and more consistent to check for EINTR and restart the write() system call,
as it's already done for open() in redir.c:redir_open(). The EINTR "error"
should never be user visible, no matter what signal had caused it.
The problem could also be reproduced with
printf '%065535d' 1 | sleep 10000
followed by a terminal resize, but not with
mkfifo /tmp/fifo; exec 7</tmp/fifo
because the EINTR is handled correctly in redir_open().
diff --git a/sig.c b/sig.c
index e5bb7399..cc2456c5 100644
--- a/sig.c
+++ b/sig.c
@@ -736,12 +736,17 @@ set_signal_handler (sig, handler)
/* We don't want a child death to interrupt interruptible system calls, even
if we take the time to reap children */
#if defined (SIGCHLD)
if (sig == SIGCHLD)
act.sa_flags |= SA_RESTART; /* XXX */
#endif
+ /* And neither should a terminal resize */
+#if defined (SIGWINCH)
+ if (sig == SIGWINCH)
+ act.sa_flags |= SA_RESTART; /* XXX */
+#endif
/* If we're installing a SIGTERM handler for interactive shells, we want
it to be as close to SIG_IGN as possible. */
if (sig == SIGTERM && handler == sigterm_sighandler)
act.sa_flags |= SA_RESTART; /* XXX */
sigemptyset (&act.sa_mask);
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: write() not retried after EINTR in printf and echo Pusillanimous Pussyfooter <0xef967c36@gmail.com> - 2018-12-09 19:45 +0200
csiph-web