From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH] readline: Update patches to include 11 - 13 Date: Tue, 13 Aug 2024 18:19:46 +0200 Message-ID: <20240813162000.1113995-11-adolf.belka@ipfire.org> In-Reply-To: <20240813162000.1113995-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9077357918914200819==" List-Id: --===============9077357918914200819== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable - Update patches from 1 - 10 to 1 - 13 - Update of rootfile not required - Changelog of patches 11 Some systems (e.g., macOS) send signals early on in interactive initia= lization, so readline should retry a failed open of the init file. 12 If a user happens to bind do-lowercase-version to something that isn't= a capital letter, so _rl_to_lower doesn't change anything and the result is still bound to do-lowercase-version, readline can recurse infinitely. 13 When readline is accumulating bytes until it reads a complete multibyte character, reading a byte that makes the multibyte character invalid can result in discarding the bytes in the partial character. Signed-off-by: Adolf Belka --- lfs/readline | 2 +- src/patches/readline/readline82-011 | 75 +++++++++ src/patches/readline/readline82-012 | 93 +++++++++++ src/patches/readline/readline82-013 | 234 ++++++++++++++++++++++++++++ 4 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 src/patches/readline/readline82-011 create mode 100644 src/patches/readline/readline82-012 create mode 100644 src/patches/readline/readline82-013 diff --git a/lfs/readline b/lfs/readline index 05d140de1..cfe4cbf18 100644 --- a/lfs/readline +++ b/lfs/readline @@ -72,7 +72,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) =20 - for i in $$(seq 1 10); do \ + for i in $$(seq 1 13); do \ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/readline/readline82-$= $(printf "%03d" "$${i}") || exit 1; \ done =20 diff --git a/src/patches/readline/readline82-011 b/src/patches/readline/readl= ine82-011 new file mode 100644 index 000000000..3ad7a8ffd --- /dev/null +++ b/src/patches/readline/readline82-011 @@ -0,0 +1,75 @@ + READLINE PATCH REPORT + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Readline-Release: 8.2 +Patch-ID: readline82-011 + +Bug-Reported-by: Grisha Levit +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2024-02/msg00= 075.html + +Bug-Description: + +Patch (apply with `patch -p0'): + +Some systems (e.g., macOS) send signals early on in interactive initializati= on, +so readline should retry a failed open of the init file. + +*** ../readline-8.2-patched/bind.c Wed Feb 9 11:02:22 2022 +--- bind.c Tue Apr 23 15:07:13 2024 +*************** +*** 979,987 **** + int i, file; + =20 +! file =3D -1; +! if (((file =3D open (filename, O_RDONLY, 0666)) < 0) || (fstat (file, &f= info) < 0)) + { + if (file >=3D 0) + close (file); + return ((char *)NULL); + } +--- 969,986 ---- + int i, file; + =20 +! file =3D open (filename, O_RDONLY, 0666); +! /* If the open is interrupted, retry once */ +! if (file < 0 && errno =3D=3D EINTR) + { ++ RL_CHECK_SIGNALS (); ++ file =3D open (filename, O_RDONLY, 0666); ++ } ++ =20 ++ if ((file < 0) || (fstat (file, &finfo) < 0)) ++ { ++ i =3D errno; + if (file >=3D 0) + close (file); ++ errno =3D i; + return ((char *)NULL); + } +*************** +*** 992,999 **** +--- 991,1001 ---- + if (file_size !=3D finfo.st_size || file_size + 1 < file_size) + { ++ i =3D errno; + if (file >=3D 0) + close (file); + #if defined (EFBIG) + errno =3D EFBIG; ++ #else ++ errno =3D i; + #endif + return ((char *)NULL); + +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + =20 +! 10 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + =20 +! 11 diff --git a/src/patches/readline/readline82-012 b/src/patches/readline/readl= ine82-012 new file mode 100644 index 000000000..cbcb4cdaf --- /dev/null +++ b/src/patches/readline/readline82-012 @@ -0,0 +1,93 @@ + READLINE PATCH REPORT + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Readline-Release: 8.2 +Patch-ID: readline82-012 + +Bug-Reported-by: Grisha Levit +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2023-11/m= sg00019.html + +Bug-Description: + +If a user happens to bind do-lowercase-version to something that isn't a +capital letter, so _rl_to_lower doesn't change anything and the result is +still bound to do-lowercase-version, readline can recurse infinitely. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/readline.c Thu Aug 11 18:35:37 2022 +--- readline.c Fri Feb 2 12:05:36 2024 +*************** +*** 900,905 **** + /* Special case rl_do_lowercase_version (). */ + if (func =3D=3D rl_do_lowercase_version) +! /* Should we do anything special if key =3D=3D ANYOTHERKEY? */ +! return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map)); + =20 + rl_executing_keymap =3D map; +--- 912,926 ---- + /* Special case rl_do_lowercase_version (). */ + if (func =3D=3D rl_do_lowercase_version) +! { +! /* Should we do anything special if key =3D=3D ANYOTHERKEY? */ +! newkey =3D _rl_to_lower ((unsigned char)key); +! if (newkey !=3D key) +! return (_rl_dispatch (newkey, map)); +! else +! { +! rl_ding (); /* gentle failure */ +! return 0; +! } +! } + =20 + rl_executing_keymap =3D map; +*************** +*** 1110,1114 **** + func =3D m[ANYOTHERKEY].function; + if (type =3D=3D ISFUNC && func =3D=3D rl_do_lowercase_version) +! r =3D _rl_dispatch (_rl_to_lower ((unsigned char)key), map); + else if (type =3D=3D ISFUNC) + { +--- 1131,1139 ---- + func =3D m[ANYOTHERKEY].function; + if (type =3D=3D ISFUNC && func =3D=3D rl_do_lowercase_version) +! { +! int newkey =3D _rl_to_lower ((unsigned char)key); +! /* check that there is actually a lowercase version to avoid infinite r= ecursion */ +! r =3D (newkey !=3D key) ? _rl_dispatch (newkey, map) : 1; +! } + else if (type =3D=3D ISFUNC) + { + +*** ../readline-8.2-patched/isearch.c Thu Aug 11 18:35:37 2022 +--- isearch.c Fri Feb 2 12:05:36 2024 +*************** +*** 429,433 **** + f =3D cxt->keymap[c].function; + if (f =3D=3D rl_do_lowercase_version) +! f =3D cxt->keymap[_rl_to_lower (c)].function; + } + =20 +--- 431,439 ---- + f =3D cxt->keymap[c].function; + if (f =3D=3D rl_do_lowercase_version) +! { +! f =3D cxt->keymap[_rl_to_lower (c)].function; +! if (f =3D=3D rl_do_lowercase_version) +! f =3D rl_insert; +! } + } + =20 + +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + =20 +! 11 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + =20 +! 12 diff --git a/src/patches/readline/readline82-013 b/src/patches/readline/readl= ine82-013 new file mode 100644 index 000000000..cb4164fbe --- /dev/null +++ b/src/patches/readline/readline82-013 @@ -0,0 +1,234 @@ + READLINE PATCH REPORT + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Readline-Release: 8.2 +Patch-ID: readline82-013 + +Bug-Reported-by: Grisha Levit +Bug-Reference-ID: