commit bash-20200731 snapshot

This commit is contained in:
Chet Ramey
2020-08-03 11:36:55 -04:00
parent 560f608dd5
commit cb7e76d009
6 changed files with 88 additions and 18 deletions
+21
View File
@@ -8791,3 +8791,24 @@ lib/glob/smatch.c
the configure check indicates fnmatch has character class support.
Fixes issue reported by Harald van Dijk <harald@gigawatt.nl>
8/2
---
lib/readline/signals.c
- _rl_handle_signal: since we're not called in a signal handler context
any more, we don't need to explicitly unblock the signal we received
so the application's signal handler will get it when we resend the
signal to ourselves. It doesn't hurt anything to do it, but we don't
have to
- _rl_handle_signal: Set up a framework for any signals that need to
be blocked during cleanup: add the signal to SET (initialized to the
existing set of blocked signals) and set BLOCK_SIG to 1. We block
that set around the call to rl_cleanup_after_signal().
- _rl_handle_signal: on AIX, if the signal is SIGHUP, make sure we
block SIGHUP while running rl_cleanup_after_signal()
8/3
---
jobs.c
- start_job: don't allow `fg' or `bg' in a command substitution to
attempt to start a parent's jobs. Suggested by OÄuz
<oguzismailuysal@gmail.com>
+6 -4
View File
@@ -5,9 +5,9 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Mon Feb 15 14:42:40 EST 2016
.\" Last Change: Sun Aug 2 15:39:07 EDT 2020
.\"
.TH BASHBUG 1 "2016 February 15" "GNU Bash-4.4"
.TH BASHBUG 1 "2020 August 1" "GNU Bash 5.1"
.SH NAME
bashbug \- report a bug in bash
.SH SYNOPSIS
@@ -44,8 +44,10 @@ Specifies the preferred editor. If
is not set,
.B bashbug
attempts to locate a number of alternative editors, including
.BR emacs ,
and defaults to \fBvi\fP.
.BR emacs .
If
.B bashbug
cannot locate any of the alternative editors, it attempts to execute \fBvi\fP.
.TP
.B HOME
Directory in which the failed bug report is saved if the mail fails.
+7
View File
@@ -3559,6 +3559,13 @@ start_job (job, foreground)
BLOCK_CHILD (set, oset);
if ((subshell_environment & SUBSHELL_COMSUB) && (pipeline_pgrp == shell_pgrp))
{
internal_error (_("%s: no current jobs"), this_command_name);
UNBLOCK_CHILD (oset);
return (-1);
}
if (DEADJOB (job))
{
internal_error (_("%s: job has terminated"), this_command_name);
+1 -1
View File
@@ -512,7 +512,7 @@ rl_read_key (void)
{
if (rl_get_char (&c) == 0)
c = (*rl_getc_function) (rl_instream);
/* fprintf(stderr, "rl_read_key: calling RL_CHECK_SIGNALS: _rl_caught_signal = %d", _rl_caught_signal); */
/* fprintf(stderr, "rl_read_key: calling RL_CHECK_SIGNALS: _rl_caught_signal = %d\r\n", _rl_caught_signal); */
RL_CHECK_SIGNALS ();
}
}
+1
View File
@@ -591,6 +591,7 @@ readline_internal_charloop (void)
handler. */
if (c == READERR)
{
fprintf(stderr, "rl_read_key returns READERR\r\n");
#if defined (READLINE_CALLBACKS)
RL_SETSTATE(RL_STATE_DONE);
return (rl_done = 1);
+52 -13
View File
@@ -135,7 +135,7 @@ void *_rl_sigcleanarg;
/* Readline signal handler functions. */
/* Called from RL_CHECK_SIGNALS() macro */
/* Called from RL_CHECK_SIGNALS() macro to run signal handling code. */
RETSIGTYPE
_rl_signal_handler (int sig)
{
@@ -170,11 +170,16 @@ rl_signal_handler (int sig)
SIGHANDLER_RETURN;
}
/* This is called to handle a signal when it is safe to do so (out of the
signal handler execution path). Called by _rl_signal_handler for all the
signals readline catches except SIGWINCH. */
static RETSIGTYPE
_rl_handle_signal (int sig)
{
int block_sig;
#if defined (HAVE_POSIX_SIGNALS)
sigset_t set;
sigset_t set, oset;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
long omask;
@@ -204,7 +209,16 @@ _rl_handle_signal (int sig)
_rl_sigcleanup = 0;
_rl_sigcleanarg = 0;
}
#if defined (HAVE_POSIX_SIGNALS)
/* Get the current set of blocked signals. If we want to block a signal for
the duration of the cleanup functions, make sure to add it to SET and
set block_sig = 1 (see the SIGHUP case below). */
block_sig = 0; /* sentinel to block signals with sigprocmask */
sigemptyset (&sig);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
#endif
switch (sig)
{
case SIGINT:
@@ -228,31 +242,51 @@ _rl_handle_signal (int sig)
this even if we've been stopped on SIGTTOU, since we handle signals
when we have returned from the signal handler and the signal is no
longer blocked. */
sigemptyset (&set);
sigaddset (&set, SIGTTOU);
sigprocmask (SIG_BLOCK, &set, (sigset_t *)NULL);
block_sig = 1;
# endif
#endif /* SIGTSTP */
case SIGTERM:
/* Any signals that should be blocked during cleanup should go here. */
#if defined (SIGHUP)
case SIGHUP:
# if defined (_AIX)
if (block_sig == 0)
{
sigaddset (&set, sig);
block_sig = 1;
}
# endif // _AIX
#endif
/* Signals that don't require blocking during cleanup should go here. */
case SIGTERM:
#if defined (SIGALRM)
case SIGALRM:
#endif
#if defined (SIGQUIT)
case SIGQUIT:
#endif
if (block_sig)
sigprocmask (SIG_BLOCK, &set, &oset);
rl_echo_signal_char (sig);
rl_cleanup_after_signal ();
#if defined (HAVE_POSIX_SIGNALS)
# if defined (SIGTSTP)
/* Unblock SIGTTOU blocked above */
if (sig == SIGTTIN || sig == SIGTSTP)
sigprocmask (SIG_UNBLOCK, &set, (sigset_t *)NULL);
# endif
/* At this point, the application's signal handler, if any, is the
current handler. */
#if defined (HAVE_POSIX_SIGNALS)
/* Unblock any signal(s) blocked above */
if (block_sig)
sigprocmask (SIG_UNBLOCK, &oset, (sigset_t *)NULL);
#endif
/* We don't have to bother unblocking the signal because we are not
running in a signal handler context. */
#if 0
#if define (HAVE_POSIX_SIGNALS)
/* Make sure this signal is not blocked when we resend it to the
calling application. */
sigemptyset (&set);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
sigdelset (&set, sig);
@@ -261,6 +295,7 @@ _rl_handle_signal (int sig)
omask = sigblock (0);
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
#endif
#if defined (__EMX__)
signal (sig, SIG_ACK);
@@ -272,7 +307,10 @@ _rl_handle_signal (int sig)
raise (sig); /* assume we have raise */
#endif
/* Let the signal that we just sent through. */
/* We don't need to modify the signal mask now that this is not run in
a signal handler context. */
#if 0
/* Let the signal that we just sent through if it is blocked. */
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
#else /* !HAVE_POSIX_SIGNALS */
@@ -280,6 +318,7 @@ _rl_handle_signal (int sig)
sigsetmask (omask & ~(sigmask (sig)));
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
#endif
rl_reset_after_signal ();
}