mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-09 13:10:50 +02:00
force using temp files for here documents with shell compatibility setting; fix small memleak in programmable completion
This commit is contained in:
@@ -291,10 +291,10 @@ h. The `unset' builtin now attempts to treat arguments as array subscripts
|
||||
i. There is a default value for $BASH_LOADABLES_PATH in config-top.h.
|
||||
|
||||
j. Associative array assignment and certain instances of referencing (e.g.,
|
||||
`test -v' now allow `@' and `*' to be used as keys.
|
||||
`test -v') now allow `@' and `*' to be used as keys.
|
||||
|
||||
k. Bash attempts to expand indexed array subscripts only once when executing
|
||||
shell constructs and word expansions.
|
||||
k. Bash attempts to expand indexed and associative array subscripts only
|
||||
once when executing shell constructs and word expansions.
|
||||
|
||||
l. The `unset' builtin allows a subscript of `@' or `*' to unset a key with
|
||||
that value for associative arrays instead of unsetting the entire array
|
||||
|
||||
+3
-3
@@ -291,10 +291,10 @@ h. The `unset' builtin now attempts to treat arguments as array subscripts
|
||||
i. There is a default value for $BASH_LOADABLES_PATH in config-top.h.
|
||||
|
||||
j. Associative array assignment and certain instances of referencing (e.g.,
|
||||
`test -v' now allow `@' and `*' to be used as keys.
|
||||
`test -v') now allow `@' and `*' to be used as keys.
|
||||
|
||||
k. Bash attempts to expand indexed array subscripts only once when executing
|
||||
shell constructs and word expansions.
|
||||
k. Bash attempts to expand indexed and associative array subscripts only
|
||||
once when executing shell constructs and word expansions.
|
||||
|
||||
l. The `unset' builtin allows a subscript of `@' or `*' to unset a key with
|
||||
that value for associative arrays instead of unsetting the entire array
|
||||
|
||||
@@ -550,6 +550,9 @@ compat50 (set using BASH_COMPAT)
|
||||
printed an informational message to that effect even when writing
|
||||
output in a format that can be reused as input (-l). Bash-5.1
|
||||
suppresses that message if -l is supplied
|
||||
- Bash-5.1 and later use pipes for here-documents and here-strings if
|
||||
they are smaller than the pipe capacity. If the shell compatibility
|
||||
level is set to 50 or lower, it reverts to using temporary files.
|
||||
|
||||
compat51 (set using BASH_COMPAT)
|
||||
- The `unset' builtin will unset the array a given an argument like
|
||||
@@ -560,6 +563,10 @@ compat51 (set using BASH_COMPAT)
|
||||
for statement can be expanded more than once
|
||||
- expressions used as arguments to arithmetic operators in the [[
|
||||
conditional command can be expanded more than once
|
||||
- indexed and associative array subscripts used as arguments to the
|
||||
operators in the [[ conditional command (e.g., `[[ -v') can be
|
||||
expanded more than once. Bash-5.2 behaves as if the
|
||||
`assoc_expand_once' option were enabled.
|
||||
- the expressions in substring parameter brace expansion can be
|
||||
expanded more than once
|
||||
- the expressions in the $(( ... )) word expansion can be expanded
|
||||
|
||||
+16
-1
@@ -2870,7 +2870,7 @@ subst.c
|
||||
- parameter_brace_expand: when expanding an indirect variable, extend
|
||||
the special case for array[@] and array[*] (set -u/no positional
|
||||
parameters, obeying the baroque quoting rules) to the value of the
|
||||
indirection. Report amd fix from konsolebox <konsolebox@gmail.com>
|
||||
indirection. Report and fix from konsolebox <konsolebox@gmail.com>
|
||||
|
||||
12/31
|
||||
-----
|
||||
@@ -3556,3 +3556,18 @@ lib/sh/zmapfd.c
|
||||
lib/sh/zgetline.c
|
||||
- zgetline: use size_t instead of int for local length and indexing
|
||||
variables
|
||||
|
||||
4/20
|
||||
----
|
||||
pcomplete.c
|
||||
- init_itemlist_from_varlist: free VLIST after assigning it from
|
||||
*SVFUNC and after we get the variable names and values out of it.
|
||||
Report from Robert E. Griffith <bobg@junga.com>
|
||||
|
||||
4/25
|
||||
----
|
||||
redir.c
|
||||
- here_document_to_fd: if the shell compatibility level is bash-5.0 or
|
||||
earlier, use tempfiles for all here-documents and here-strings. From
|
||||
a bug-bash discussion started by Sam Liddicott <sam@liddicott.com>
|
||||
|
||||
|
||||
@@ -2368,6 +2368,7 @@ history list.
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
@@ -2448,6 +2449,8 @@ main (argc, argv)
|
||||
@{
|
||||
char *line, *s;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
initialize_readline (); /* Bind our completer. */
|
||||
|
||||
@@ -50,6 +50,8 @@ Copyright (C) 1999 Jeff Solomon
|
||||
#include <stdio.h>
|
||||
#include <termios.h> /* xxx - should make this more general */
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
# include "readline.h"
|
||||
#else
|
||||
@@ -104,6 +106,8 @@ main()
|
||||
{
|
||||
fd_set fds;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
/* Adjust the terminal slightly before the handler is installed. Disable
|
||||
* canonical mode processing and set the input character time flag to be
|
||||
* non-blocking.
|
||||
|
||||
@@ -27,8 +27,11 @@
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
@@ -7,9 +7,15 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
/* Standard readline include files. */
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "readline.h"
|
||||
@@ -22,10 +28,19 @@
|
||||
extern int errno;
|
||||
|
||||
static void cb_linehandler (char *);
|
||||
static void signandler (int);
|
||||
|
||||
int running;
|
||||
int running, sigwinch_received;
|
||||
const char *prompt = "rltest$ ";
|
||||
|
||||
/* Handle SIGWINCH and window size changes when readline is not active and
|
||||
reading a character. */
|
||||
static void
|
||||
sighandler (int sig)
|
||||
{
|
||||
sigwinch_received = 1;
|
||||
}
|
||||
|
||||
/* Callback function called for each line when accept-line executed, EOF
|
||||
seen, or EOF character read. This sets a flag and returns; it could
|
||||
also call exit(3). */
|
||||
@@ -60,6 +75,11 @@ main (int c, char **v)
|
||||
fd_set fds;
|
||||
int r;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
/* Handle SIGWINCH */
|
||||
signal (SIGWINCH, sighandler);
|
||||
|
||||
/* Install the line handler. */
|
||||
rl_callback_handler_install (prompt, cb_linehandler);
|
||||
|
||||
@@ -80,6 +100,13 @@ main (int c, char **v)
|
||||
rl_callback_handler_remove ();
|
||||
break;
|
||||
}
|
||||
if (sigwinch_received)
|
||||
{
|
||||
rl_resize_terminal ();
|
||||
sigwinch_received = 0;
|
||||
}
|
||||
if (r < 0)
|
||||
continue;
|
||||
|
||||
if (FD_ISSET (fileno (rl_instream), &fds))
|
||||
rl_callback_read_char ();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Standard readline include files. */
|
||||
@@ -125,6 +126,8 @@ main (int c, char **v)
|
||||
{
|
||||
char *p;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
running = 1;
|
||||
rl_catch_signals = 1;
|
||||
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
extern void exit();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "posixstat.h"
|
||||
# include "readline.h"
|
||||
@@ -93,6 +97,10 @@ main (argc, argv)
|
||||
else
|
||||
progname++;
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
/* defaults */
|
||||
prompt = "readline$ ";
|
||||
fd = nch = 0;
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
extern void exit();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
@@ -79,6 +83,10 @@ main (argc, argv)
|
||||
char *temp;
|
||||
int opt, Vflag, Nflag;
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale (LC_ALL, ""):
|
||||
#endif
|
||||
|
||||
progname = strrchr(argv[0], '/');
|
||||
if (progname == 0)
|
||||
progname = argv[0];
|
||||
|
||||
@@ -19,12 +19,16 @@
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if 0 /* LINUX */
|
||||
#if 1 /* LINUX */
|
||||
#include <pty.h>
|
||||
#else
|
||||
#include <util.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
# include "readline.h"
|
||||
#else
|
||||
@@ -48,6 +52,13 @@ sigint (s)
|
||||
exit (0);
|
||||
}
|
||||
|
||||
void
|
||||
sigwinch (s)
|
||||
int s;
|
||||
{
|
||||
rl_resize_terminal ();
|
||||
}
|
||||
|
||||
static int
|
||||
user_input()
|
||||
{
|
||||
@@ -308,6 +319,11 @@ int
|
||||
main()
|
||||
{
|
||||
int val;
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
val = openpty (&masterfd, &slavefd, NULL, NULL, NULL);
|
||||
if (val == -1)
|
||||
return -1;
|
||||
@@ -316,6 +332,9 @@ main()
|
||||
if (val == -1)
|
||||
return -1;
|
||||
|
||||
signal (SIGWINCH, sigwinch);
|
||||
signal (SIGINT, sigint);
|
||||
|
||||
val = init_readline (slavefd, slavefd);
|
||||
if (val == -1)
|
||||
return -1;
|
||||
@@ -324,8 +343,6 @@ main()
|
||||
if (val == -1)
|
||||
return -1;
|
||||
|
||||
signal (SIGINT, sigint);
|
||||
|
||||
val = main_loop ();
|
||||
|
||||
tty_reset (STDIN_FILENO);
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
extern void exit();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifdef READLINE_LIBRARY
|
||||
# include "readline.h"
|
||||
# include "history.h"
|
||||
@@ -52,6 +56,10 @@ main ()
|
||||
char *temp, *prompt;
|
||||
int done;
|
||||
|
||||
#ifdef HAVE_SETLOCALE
|
||||
setlocale (LC_ALL, "");
|
||||
#endif
|
||||
|
||||
temp = (char *)NULL;
|
||||
prompt = "readline$ ";
|
||||
done = 0;
|
||||
|
||||
@@ -414,6 +414,7 @@ init_itemlist_from_varlist (itp, svfunc)
|
||||
sl->list[i] = savestring (vlist[i]->name);
|
||||
sl->list[sl->list_len = n] = (char *)NULL;
|
||||
itp->slist = sl;
|
||||
free (vlist);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -460,7 +460,10 @@ here_document_to_fd (redirectee, ri)
|
||||
return fd;
|
||||
}
|
||||
|
||||
#if defined (HEREDOC_PIPESIZE)
|
||||
if (shell_compatibility_level <= 50)
|
||||
goto use_tempfile;
|
||||
|
||||
#if HEREDOC_PIPESIZE
|
||||
/* Try to use a pipe internal to this process if the document is shorter
|
||||
than the system's pipe capacity (computed at build time). We want to
|
||||
write the entire document without write blocking. */
|
||||
|
||||
@@ -4095,7 +4095,9 @@ remove_backslashes (string)
|
||||
to the != or == operator, and should be treated as a pattern. In
|
||||
this case, we quote the string specially for the globbing code. If
|
||||
SPECIAL is 2, this is an rhs argument for the =~ operator, and should
|
||||
be quoted appropriately for regcomp/regexec. The caller is responsible
|
||||
be quoted appropriately for regcomp/regexec. If SPECIAL is 3, this is
|
||||
an array subscript and should be quoted after expansion so it's only
|
||||
expanded once (Q_ARITH). The caller is responsible
|
||||
for removing the backslashes if the unquoted word is needed later. In
|
||||
any case, since we don't perform word splitting, we need to do quoted
|
||||
null character removal. */
|
||||
|
||||
Reference in New Issue
Block a user