mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 15:43:18 +02:00
fix terminal pgrp issue with async jobs in non-interactive shells; history_expand change to first argument
This commit is contained in:
@@ -5088,3 +5088,20 @@ parse.y
|
||||
prevents it from being enabled if an alias expansion of more than
|
||||
two aliases ends with a space. Fixes issue reported by
|
||||
<anonymous4feedback@outlook.com>
|
||||
|
||||
1/18
|
||||
----
|
||||
jobs.c
|
||||
- wait_for: if we are reaping a background job, don't bother trying to
|
||||
give the terminal back to shell_pgrp -- we never set the terminal's
|
||||
pgrp to that job in the first place. Fixes issue reported by
|
||||
Steffen Nurpmeso <steffen@sdaoden.eu>
|
||||
|
||||
1/19
|
||||
----
|
||||
lib/readline/{histexpand.c,history.h}
|
||||
- history_expand: first argument is now `const char *'. Request from
|
||||
Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
lib/readline/doc/{history.3,hstech.texi}
|
||||
- history_expansion: change description to note new const first arg
|
||||
|
||||
@@ -892,6 +892,7 @@ tests/alias3.sub f
|
||||
tests/alias4.sub f
|
||||
tests/alias5.sub f
|
||||
tests/alias6.sub f
|
||||
tests/alias7.sub f
|
||||
tests/alias.right f
|
||||
tests/appendop.tests f
|
||||
tests/appendop1.sub f
|
||||
|
||||
@@ -3016,9 +3016,11 @@ if (job == NO_JOB)
|
||||
/* Don't modify terminal pgrp if we are running in background or a
|
||||
subshell. Make sure subst.c:command_substitute uses the same
|
||||
conditions to determine whether or not it should undo this and
|
||||
give the terminal to pipeline_pgrp. */
|
||||
|
||||
give the terminal to pipeline_pgrp. We don't give the terminal
|
||||
back to shell_pgrp if an async job exits because we never gave it
|
||||
to that job in the first place. */
|
||||
if ((flags & JWAIT_NOTERM) == 0 && running_in_background == 0 &&
|
||||
(job == NO_JOB || IS_ASYNC (job) == 0) &&
|
||||
(subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
|
||||
give_terminal_to (shell_pgrp, 0);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Fri Jul 17 09:43:01 EDT 2020
|
||||
.\" Last Change: Thu Jan 19 17:20:59 EST 2023
|
||||
.\"
|
||||
.TH HISTORY 3 "2020 July 17" "GNU History 8.1"
|
||||
.TH HISTORY 3 "2023 January 19" "GNU History 8.2"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -40,8 +40,8 @@
|
||||
.SH NAME
|
||||
history \- GNU History Library
|
||||
.SH COPYRIGHT
|
||||
.if t The GNU History Library is Copyright \(co 1989-2020 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2020 by the Free Software Foundation, Inc.
|
||||
.if t The GNU History Library is Copyright \(co 1989-2023 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2023 by the Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
Many programs read input from the user a line at a time. The GNU
|
||||
History library is able to keep track of those lines, associate arbitrary
|
||||
@@ -530,7 +530,7 @@ Returns 0 on success, or \fBerrno\fP on failure.
|
||||
|
||||
These functions implement history expansion.
|
||||
|
||||
.Fn2 int history_expand "char *string" "char **output"
|
||||
.Fn2 int history_expand "const char *string" "char **output"
|
||||
Expand \fIstring\fP, placing the result into \fIoutput\fP, a pointer
|
||||
to a string. Returns:
|
||||
.RS
|
||||
|
||||
@@ -12,7 +12,7 @@ This document describes the GNU History library
|
||||
a programming tool that provides a consistent user interface for
|
||||
recalling lines of previously typed input.
|
||||
|
||||
Copyright @copyright{} 1988--2022 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2023 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
@@ -369,7 +369,7 @@ Returns 0 on success, or @code{errno} on failure.
|
||||
|
||||
These functions implement history expansion.
|
||||
|
||||
@deftypefun int history_expand (char *string, char **output)
|
||||
@deftypefun int history_expand (const char *string, char **output)
|
||||
Expand @var{string}, placing the result into @var{output}, a pointer
|
||||
to a string (@pxref{History Interaction}). Returns:
|
||||
@table @code
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2023 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 8.2
|
||||
@set VERSION 8.2
|
||||
|
||||
@set UPDATED 19 September 2022
|
||||
@set UPDATED-MONTH September 2022
|
||||
@set UPDATED 19 January 2023
|
||||
@set UPDATED-MONTH January 2023
|
||||
|
||||
@set LASTCHANGE Mon Sep 19 11:15:16 EDT 2022
|
||||
@set LASTCHANGE Thu Jan 19 17:22:06 EST 2023
|
||||
|
||||
@@ -904,7 +904,7 @@ history_expand_internal (const char *string, int start, int qc, int *end_index_p
|
||||
while (0)
|
||||
|
||||
int
|
||||
history_expand (char *hstring, char **output)
|
||||
history_expand (const char *hstring, char **output)
|
||||
{
|
||||
int j;
|
||||
int i, r, passc, cc, modified, eindex, only_printing, dquote, squote, flag;
|
||||
@@ -966,7 +966,7 @@ history_expand (char *hstring, char **output)
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
string = hstring;
|
||||
string = (char *)hstring;
|
||||
/* If not quick substitution, still maybe have to do expansion. */
|
||||
|
||||
/* `!' followed by one of the characters in history_no_expand_chars
|
||||
|
||||
@@ -232,7 +232,7 @@ extern int history_truncate_file (const char *, int);
|
||||
|
||||
If an error occurred in expansion, then OUTPUT contains a descriptive
|
||||
error message. */
|
||||
extern int history_expand (char *, char **);
|
||||
extern int history_expand (const char *, char **);
|
||||
|
||||
/* Extract a string segment consisting of the FIRST through LAST
|
||||
arguments present in STRING. Arguments are broken up as in
|
||||
|
||||
@@ -43,3 +43,17 @@ bar
|
||||
baz
|
||||
<áa>
|
||||
<aá>
|
||||
bar
|
||||
foo bar x
|
||||
foo
|
||||
x
|
||||
bar
|
||||
x
|
||||
bar
|
||||
x
|
||||
foo=v bar=
|
||||
foo
|
||||
foo in v
|
||||
bash: -c: line 7: syntax error near unexpected token `do'
|
||||
bash: -c: line 7: `do echo foo=$foo bar=$bar'
|
||||
foo=v bar=
|
||||
|
||||
@@ -63,3 +63,4 @@ ${THIS_SH} ./alias3.sub
|
||||
${THIS_SH} ./alias4.sub
|
||||
${THIS_SH} ./alias5.sub
|
||||
${THIS_SH} ./alias6.sub
|
||||
${THIS_SH} ./alias7.sub
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Change bash to expand the next word following aliases ending with a space
|
||||
# that are more than one level deep. Change how bash handles the expand-next-word
|
||||
# flag when recognizing a reserved word.
|
||||
#
|
||||
# Bash never did this before post-bash-5.2
|
||||
|
||||
: ${THIS_SH:=./bash}
|
||||
|
||||
shopt -s expand_aliases 2>/dev/null
|
||||
|
||||
alias a1='echo '
|
||||
alias a2=a1
|
||||
|
||||
alias foo=bar
|
||||
alias x=xtra
|
||||
|
||||
a2 foo
|
||||
unalias foo
|
||||
|
||||
alias e='echo '
|
||||
alias f='foo '
|
||||
alias b=bar
|
||||
|
||||
e f b x
|
||||
|
||||
alias e=echo
|
||||
|
||||
a2 foo;e x
|
||||
|
||||
unalias e f b
|
||||
|
||||
alias e=echo
|
||||
alias foo='bar '
|
||||
alias c=';'
|
||||
|
||||
a2 foo c e x
|
||||
|
||||
unalias foo e c
|
||||
|
||||
alias file='/dev/null ;'
|
||||
alias e=echo
|
||||
alias foo='bar '
|
||||
alias c='< '
|
||||
alias x=xtra
|
||||
a2 foo c file e x
|
||||
|
||||
unalias a1 a2 e foo c x file
|
||||
|
||||
alias foo=bar
|
||||
|
||||
alias al=' '
|
||||
alias foo=bar
|
||||
|
||||
al for foo in v
|
||||
do echo foo=$foo bar=$bar
|
||||
done
|
||||
|
||||
al case foo in foo) echo foo;; bar) echo bar;; esac
|
||||
|
||||
# one difference between bash in default and posix modes is that default mode
|
||||
# bash allows reserved words to be aliased, which posix says is a no-no
|
||||
|
||||
${THIS_SH} -c '
|
||||
shopt -s expand_aliases 2>/dev/null
|
||||
alias al=" "
|
||||
alias foo=bar
|
||||
alias for=echo
|
||||
al for foo in v
|
||||
do echo foo=$foo bar=$bar
|
||||
done' bash
|
||||
|
||||
${THIS_SH} -o posix -c '
|
||||
alias al=" "
|
||||
alias foo=bar
|
||||
alias for=echo
|
||||
al for foo in v
|
||||
do echo foo=$foo bar=$bar
|
||||
done' bash
|
||||
Reference in New Issue
Block a user