fix for wait -n' in posix mode; fix for long messages in readline; fix for short reads by source' builtin; fix for crash on RISC-V machines; fix for bad memory read when getopts is called twice with different sets of arguments

This commit is contained in:
Chet Ramey
2025-07-18 11:53:01 -04:00
parent 80a8f650a1
commit 01070d4324
15 changed files with 289 additions and 410 deletions
+2 -2
View File
@@ -3143,14 +3143,14 @@ rl_message (const char *format, ...)
#if defined (HAVE_VSNPRINTF)
bneed = vsnprintf (msg_buf, msg_bufsiz, format, args);
if (bneed >= msg_bufsiz - 1)
if (bneed > msg_bufsiz - 1)
{
msg_bufsiz = bneed + 1;
msg_buf = xrealloc (msg_buf, msg_bufsiz);
va_end (args);
va_start (args, format);
vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
vsnprintf (msg_buf, msg_bufsiz, format, args);
}
#else
vsprintf (msg_buf, format, args);
+6 -2
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Mon Dec 30 11:27:47 EST 2024
.\" Last Change: Tue Jul 15 10:19:29 EDT 2025
.\"
.TH READLINE 3 "2024 December 30" "GNU Readline 8.3"
.TH READLINE 3 "2024 July 15" "GNU Readline 8.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
@@ -473,6 +473,10 @@ Type
.Q "stty \-a"
at a \fBbash\fP prompt to see your current terminal settings,
including the special control characters (usually \fBcchars\fP).
This binding takes place on each call to \fBreadline\fP,
so changes made by
.Q stty
can take effect.
.TP
.B blink\-matching\-paren (Off)
If set to \fBOn\fP, \fBreadline\fP attempts to briefly move the cursor to an
+4
View File
@@ -495,6 +495,10 @@ Readline equivalents.
These override the default Readline bindings described here.
Type @samp{stty -a} at a Bash prompt to see your current terminal settings,
including the special control characters (usually @code{cchars}).
This binding takes place on each call to @code{readline()},
so changes made by
@samp{stty}
can take effect.
@item blink-matching-paren
@vindex blink-matching-paren
+3 -3
View File
@@ -5,7 +5,7 @@ Copyright (C) 1988-2025 Free Software Foundation, Inc.
@set EDITION 8.3
@set VERSION 8.3
@set UPDATED 30 December 2024
@set UPDATED-MONTH December 2024
@set UPDATED 15 July 2025
@set UPDATED-MONTH July 2025
@set LASTCHANGE Mon Dec 30 11:27:03 EST 2024
@set LASTCHANGE Tue Jul 15 10:18:40 EDT 2025
+3 -34
View File
@@ -25,7 +25,7 @@
#endif
#include <bashtypes.h>
#if defined (HAVE_MEMFD_CREATE) || defined (HAVE_SHM_OPEN) || defined (HAVE_SHM_MKSTEMP)
#if defined (HAVE_MEMFD_CREATE) || defined (HAVE_SHM_MKSTEMP)
# include <sys/mman.h>
#endif
#include <filecntl.h>
@@ -41,17 +41,7 @@ static int anonunlink (const char *);
# define MFD_NOEXEC_SEAL 0
#endif
#if defined (HAVE_SHM_OPEN)
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
#endif
static int
anonshmunlink (const char *fn)
{
return (shm_unlink (fn));
}
#if defined (HAVE_SHM_MKSTEMP)
static int
anonshmopen (const char *name, int flags, char **fn)
{
@@ -62,35 +52,14 @@ anonshmopen (const char *name, int flags, char **fn)
if (fn)
*fn = 0;
#if defined (HAVE_SHM_MKSTEMP)
fname = savestring ("/shm-XXXXXXXXXX");
fd = shm_mkstemp (fname);
if (fd < 0)
free (fname);
#endif
if (fd < 0)
{
fname = sh_mktmpname (name, flags);
fd = shm_open (fname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0600);
}
if (fd < 0)
{
free (fname);
return fd;
}
if (shm_unlink (fname) < 0)
{
int o;
o = errno;
free (fname);
close (fd);
errno = o;
return -1;
}
if (fn)
*fn = fname;
else
@@ -122,7 +91,7 @@ anonopen (const char *name, int flags, char **fn)
/* Heuristic */
flag = (name && *name == '/') ? MT_TEMPLATE : MT_USETMPDIR;
#if defined (HAVE_SHM_OPEN)
#if defined (HAVE_SHM_MKSTEMP)
fd = anonshmopen (name, flag, fn);
if (fd >= 0)
return fd; /* anonshmopen sets *FN appropriately */