fix nofork comsub overwriting currently executing command; free readline undo list on signal in callback mode; avoid disabling readonly when assigning variables from the environment; fix bug with shell-expand-line and $'...' quoting inside command substitutions; add `bash-vi-complete' as bindable command name

This commit is contained in:
Chet Ramey
2024-02-09 10:30:02 -05:00
parent 35465406cd
commit dc97ded434
40 changed files with 201 additions and 88 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
/* callback.c -- functions to use readline as an X `callback' mechanism. */
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -323,6 +323,15 @@ rl_callback_handler_remove (void)
rl_linefunc = NULL;
RL_UNSETSTATE (RL_STATE_CALLBACK);
RL_CHECK_SIGNALS ();
/* Do what we need to do to manage the undo list if we haven't already done
it in rl_callback_read_char(). If there's no undo list, we don't need to
do anything. It doesn't matter if we try to revert all previous lines a
second time; none of the history entries will have an undo list. */
if (rl_undo_list)
readline_common_teardown ();
/* At this point, rl_undo_list == NULL. */
if (in_handler)
{
in_handler = 0;
+1 -1
View File
@@ -1,6 +1,6 @@
/* complete.c -- filename completion for readline. */
/* Copyright (C) 1987-2022,2023 Free Software Foundation, Inc.
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
+5 -1
View File
@@ -1,5 +1,7 @@
@comment %**start of header (This is for running Texinfo on a region.)
@ifclear BashFeatures
@setfilename rluser.info
@end ifclear
@comment %**end of header (This is for running Texinfo on a region.)
@ignore
@@ -1874,8 +1876,10 @@ Display version information about the current instance of Bash.
Expand the line by performing shell word expansions.
This performs alias and history expansion,
$'@var{string}' and $"@var{string}" quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
tilde expansion, parameter and variable expansion, arithmetic expansion,
command and proces substitution,
word splitting, and quote removal.
An explicit argument suppresses command and process substitution.
@item history-expand-line (M-^)
Perform history expansion on the current line.
+1 -1
View File
@@ -1,6 +1,6 @@
/* misc.c -- miscellaneous bindable readline functions. */
/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
+13 -7
View File
@@ -474,17 +474,12 @@ readline_internal_setup (void)
RL_CHECK_SIGNALS ();
}
STATIC_CALLBACK char *
readline_internal_teardown (int eof)
STATIC_CALLBACK void
readline_common_teardown (void)
{
char *temp;
HIST_ENTRY *entry;
RL_CHECK_SIGNALS ();
if (eof)
RL_SETSTATE (RL_STATE_EOF); /* XXX */
/* Restore the original of this history line, iff the line that we
are editing was originally in the history, AND the line has changed. */
entry = current_history ();
@@ -510,6 +505,17 @@ readline_internal_teardown (int eof)
rid of it now. */
if (rl_undo_list)
rl_free_undo_list ();
}
STATIC_CALLBACK char *
readline_internal_teardown (int eof)
{
RL_CHECK_SIGNALS ();
if (eof)
RL_SETSTATE (RL_STATE_EOF); /* XXX */
readline_common_teardown ();
/* Disable the meta key, if this terminal has one and we were told to use it.
The check whether or not we sent the enable string is in
+1 -1
View File
@@ -1,6 +1,6 @@
/* Readline.h -- the names of functions callable from within readline. */
/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
+3 -2
View File
@@ -1,7 +1,7 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999-2023 Free Software Foundation, Inc.
/* Copyright (C) 1999-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -270,10 +270,11 @@ extern char *_rl_savestring (const char *);
* Undocumented private functions *
*************************************************************************/
#if defined(READLINE_CALLBACKS)
#if defined (READLINE_CALLBACKS)
/* readline.c */
extern void readline_internal_setup (void);
extern void readline_common_teardown (void);
extern char *readline_internal_teardown (int);
extern int readline_internal_char (void);
+1 -1
View File
@@ -1,6 +1,6 @@
/* search.c - code for non-incremental searching in emacs and vi modes. */
/* Copyright (C) 1992-2023 Free Software Foundation, Inc.
/* Copyright (C) 1992-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
+1 -1
View File
@@ -1,6 +1,6 @@
/* signals.c -- signal handling support for readline. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
+1 -1
View File
@@ -1,6 +1,6 @@
/* text.c -- text handling commands for readline. */
/* Copyright (C) 1987-2021,2023 Free Software Foundation, Inc.
/* Copyright (C) 1987-2021,2023-2024 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
+1 -1
View File
@@ -1,6 +1,6 @@
/* eaccess.c - eaccess replacement for the shell, plus other access functions. */
/* Copyright (C) 2006-2020,2022-2023 Free Software Foundation, Inc.
/* Copyright (C) 2006-2020,2022-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
+1 -1
View File
@@ -2,7 +2,7 @@
* tmpfile.c - functions to create and safely open temp files for the shell.
*/
/* Copyright (C) 2000-2020,2022-2023 Free Software Foundation, Inc.
/* Copyright (C) 2000-2020,2022-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.