mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 23:53:18 +02:00
changes for multibyte characters with intermediate state; small change to readline forced redisplay
This commit is contained in:
@@ -3950,3 +3950,43 @@ lib/readline/history.c
|
||||
9/23
|
||||
----
|
||||
[bash-5.2 frozen]
|
||||
|
||||
9/26
|
||||
----
|
||||
[bash-5.2 released]
|
||||
|
||||
9/27
|
||||
----
|
||||
mailcheck.c
|
||||
- time_to_check_mail: don't bother if we're in the middle of readline
|
||||
completion or command dispatching.
|
||||
From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019462
|
||||
|
||||
lib/readline/display.c
|
||||
- rl_forced_update_display: use memset to clear out visible_line
|
||||
instead of trying to use a loop; line_size is the size.
|
||||
Report from <srobertson@peratonlabs.com>
|
||||
|
||||
print_cmd.c
|
||||
- indirection_level_string: use MBRLEN and an initialized mbstate_t
|
||||
object to avoid altering an internal mbstate_t.
|
||||
From Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
subst.c
|
||||
- string_extract_verbatim: use an explicit mbstate_t object and pass
|
||||
it to MBRLEN and mbrtowc to avoid altering the state that
|
||||
ADVANCE_CHAR is using.
|
||||
From Koichi Murase <myoga.murase@gmail.com>
|
||||
- setifs: use an explicit mbstate_t object and pass it to MBRLEN so
|
||||
to avoid altering an internal mbstate_t.
|
||||
From Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
builtins/printf.def
|
||||
- asciicode: use an explicit mbstate_t object and pass it to mbrtowc
|
||||
to avoid using an incorrect internal mbstate_t
|
||||
From Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
lib/sh/{mbscasecmp,mbscmp}.c
|
||||
- mbscasecmp,mbscmp: use different mbstate_t objects for the different
|
||||
strings so they don't affect each others' intermediate mbstate.
|
||||
From Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
This file is printf.def, from which is created printf.c.
|
||||
It implements the builtin "printf" in Bash.
|
||||
|
||||
Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2022 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -1343,7 +1343,7 @@ asciicode ()
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
slen = strlen (garglist->word->word+1);
|
||||
wc = 0;
|
||||
mblength = mbtowc (&wc, garglist->word->word+1, slen);
|
||||
mblength = mbrtowc (&wc, garglist->word->word+1, slen, &state);
|
||||
if (mblength > 0)
|
||||
ch = wc; /* XXX */
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac for Bash 5.2, version 5.045.
|
||||
# From configure.ac for Bash 5.2, version 5.046.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for bash 5.2-rc4.
|
||||
# Generated by GNU Autoconf 2.71 for bash 5.2-maint.
|
||||
#
|
||||
# Report bugs to <bug-bash@gnu.org>.
|
||||
#
|
||||
@@ -612,8 +612,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='bash'
|
||||
PACKAGE_TARNAME='bash'
|
||||
PACKAGE_VERSION='5.2-rc4'
|
||||
PACKAGE_STRING='bash 5.2-rc4'
|
||||
PACKAGE_VERSION='5.2-maint'
|
||||
PACKAGE_STRING='bash 5.2-maint'
|
||||
PACKAGE_BUGREPORT='bug-bash@gnu.org'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1467,7 +1467,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures bash 5.2-rc4 to adapt to many kinds of systems.
|
||||
\`configure' configures bash 5.2-maint to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1533,7 +1533,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of bash 5.2-rc4:";;
|
||||
short | recursive ) echo "Configuration of bash 5.2-maint:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1740,7 +1740,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
bash configure 5.2-rc4
|
||||
bash configure 5.2-maint
|
||||
generated by GNU Autoconf 2.71
|
||||
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
@@ -2397,7 +2397,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by bash $as_me 5.2-rc4, which was
|
||||
It was created by bash $as_me 5.2-maint, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
@@ -3176,7 +3176,7 @@ ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
BASHVERS=5.2
|
||||
RELSTATUS=rc4
|
||||
RELSTATUS=maint
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
|
||||
@@ -22369,7 +22369,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by bash $as_me 5.2-rc4, which was
|
||||
This file was extended by bash $as_me 5.2-maint, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -22437,7 +22437,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
bash config.status 5.2-rc4
|
||||
bash config.status 5.2-maint
|
||||
configured by $0, generated by GNU Autoconf 2.71,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
+2
-2
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 5.2, version 5.045])dnl
|
||||
AC_REVISION([for Bash 5.2, version 5.046])dnl
|
||||
|
||||
define(bashvers, 5.2)
|
||||
define(relstatus, rc4)
|
||||
define(relstatus, maint)
|
||||
|
||||
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/* shmbutil.h -- utility functions for multibyte characters. */
|
||||
|
||||
/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002-2022 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
|
||||
@@ -684,7 +684,7 @@ init_line_structures (int minsize)
|
||||
if (line_size > minsize)
|
||||
minsize = line_size;
|
||||
}
|
||||
realloc_line (minsize);
|
||||
realloc_line (minsize);
|
||||
|
||||
if (vis_lbreaks == 0)
|
||||
{
|
||||
@@ -2681,13 +2681,11 @@ int
|
||||
rl_forced_update_display (void)
|
||||
{
|
||||
register char *temp;
|
||||
register int tlen;
|
||||
|
||||
if (visible_line)
|
||||
{
|
||||
temp = visible_line;
|
||||
while (*temp)
|
||||
*temp++ = '\0';
|
||||
}
|
||||
memset (visible_line, 0, line_size);
|
||||
|
||||
rl_on_new_line ();
|
||||
forced_display++;
|
||||
(*rl_redisplay_function) ();
|
||||
|
||||
+5
-6
@@ -1,6 +1,6 @@
|
||||
/* mbscasecmp - case-insensitive multibyte string comparison. */
|
||||
|
||||
/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2009-2022 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -37,16 +37,15 @@ mbscasecmp (mbs1, mbs2)
|
||||
{
|
||||
int len1, len2, mb_cur_max;
|
||||
wchar_t c1, c2, l1, l2;
|
||||
mbstate_t state1 = { 0 }, state2 = { 0 };
|
||||
|
||||
len1 = len2 = 0;
|
||||
/* Reset multibyte characters to their initial state. */
|
||||
(void) mblen ((char *) NULL, 0);
|
||||
|
||||
mb_cur_max = MB_CUR_MAX;
|
||||
|
||||
do
|
||||
{
|
||||
len1 = mbtowc (&c1, mbs1, mb_cur_max);
|
||||
len2 = mbtowc (&c2, mbs2, mb_cur_max);
|
||||
len1 = mbrtowc (&c1, mbs1, mb_cur_max, &state1);
|
||||
len2 = mbrtowc (&c2, mbs2, mb_cur_max, &state2);
|
||||
|
||||
if (len1 == 0)
|
||||
return len2 == 0 ? 0 : -1;
|
||||
|
||||
+5
-6
@@ -1,6 +1,6 @@
|
||||
/* mbscmp - multibyte string comparison. */
|
||||
|
||||
/* Copyright (C) 1995-2018 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995-2022 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -38,16 +38,15 @@ mbscmp (mbs1, mbs2)
|
||||
{
|
||||
int len1, len2, mb_cur_max;
|
||||
wchar_t c1, c2;
|
||||
mbstate_t state1 = { 0 }, state2 = { 0 };
|
||||
|
||||
len1 = len2 = 0;
|
||||
/* Reset multibyte characters to their initial state. */
|
||||
(void) mblen ((char *) NULL, 0);
|
||||
|
||||
mb_cur_max = MB_CUR_MAX;
|
||||
|
||||
do
|
||||
{
|
||||
len1 = mbtowc (&c1, mbs1, mb_cur_max);
|
||||
len2 = mbtowc (&c2, mbs2, mb_cur_max);
|
||||
len1 = mbrtowc (&c1, mbs1, mb_cur_max, &state1);
|
||||
len2 = mbrtowc (&c2, mbs2, mb_cur_max, &state2);
|
||||
|
||||
if (len1 == 0)
|
||||
return len2 == 0 ? 0 : -1;
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
#include "mailcheck.h"
|
||||
#include <tilde/tilde.h>
|
||||
|
||||
#if defined (READLINE)
|
||||
# include <readline/readline.h>
|
||||
#endif
|
||||
|
||||
/* Values for flags word in struct _fileinfo */
|
||||
#define MBOX_INITIALIZED 0x01
|
||||
|
||||
@@ -88,6 +92,11 @@ time_to_check_mail ()
|
||||
time_t now;
|
||||
intmax_t seconds;
|
||||
|
||||
#if defined (READLINE)
|
||||
if (RL_ISSTATE (RL_STATE_COMPLETING|RL_STATE_DISPATCHING))
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
temp = get_string_value ("MAILCHECK");
|
||||
|
||||
/* Negative number, or non-numbers (such as empty string) cause no
|
||||
|
||||
+2
-1
@@ -451,6 +451,7 @@ indirection_level_string ()
|
||||
char *ps4;
|
||||
char ps4_firstc[MB_LEN_MAX+1];
|
||||
int ps4_firstc_len, ps4_len, ineed, old;
|
||||
DECLARE_MBSTATE;
|
||||
|
||||
ps4 = get_string_value ("PS4");
|
||||
if (indirection_string == 0)
|
||||
@@ -473,7 +474,7 @@ indirection_level_string ()
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
ps4_len = strnlen (ps4, MB_CUR_MAX);
|
||||
ps4_firstc_len = MBLEN (ps4, ps4_len);
|
||||
ps4_firstc_len = MBRLEN (ps4, ps4_len, &state);
|
||||
if (ps4_firstc_len == 1 || ps4_firstc_len == 0 || ps4_firstc_len < 0)
|
||||
{
|
||||
ps4_firstc[0] = ps4[0];
|
||||
|
||||
@@ -1173,6 +1173,7 @@ string_extract_verbatim (string, slen, sindex, charlist, flags)
|
||||
register int i;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
wchar_t *wcharlist;
|
||||
mbstate_t mbstmp;
|
||||
#endif
|
||||
int c;
|
||||
char *temp;
|
||||
@@ -1226,11 +1227,15 @@ string_extract_verbatim (string, slen, sindex, charlist, flags)
|
||||
if (locale_utf8locale && slen > i && UTF8_SINGLEBYTE (string[i]))
|
||||
mblength = (string[i] != 0) ? 1 : 0;
|
||||
else
|
||||
mblength = MBLEN (string + i, slen - i);
|
||||
{
|
||||
mbstmp = state;
|
||||
mblength = MBRLEN (string + i, slen - i, &mbstmp);
|
||||
}
|
||||
if (mblength > 1)
|
||||
{
|
||||
wchar_t wc;
|
||||
mblength = mbtowc (&wc, string + i, slen - i);
|
||||
mbstmp = state;
|
||||
mblength = mbrtowc (&wc, string + i, slen - i, &mbstmp);
|
||||
if (MB_INVALIDCH (mblength))
|
||||
{
|
||||
if (MEMBER (c, charlist))
|
||||
@@ -12020,8 +12025,9 @@ setifs (v)
|
||||
else
|
||||
{
|
||||
size_t ifs_len;
|
||||
DECLARE_MBSTATE;
|
||||
ifs_len = strnlen (ifs_value, MB_CUR_MAX);
|
||||
ifs_firstc_len = MBLEN (ifs_value, ifs_len);
|
||||
ifs_firstc_len = MBRLEN (ifs_value, ifs_len, &state);
|
||||
}
|
||||
if (ifs_firstc_len == 1 || ifs_firstc_len == 0 || MB_INVALIDCH (ifs_firstc_len))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user