backport patch to fix segmentation fault problem

Signed-off-by: beta <beta@yfqm.date>
This commit is contained in:
beta 2025-01-08 13:39:07 +08:00
parent 151d4e6298
commit 05d5c14b0d
No known key found for this signature in database
GPG Key ID: C7C3F9C0ED57B6CD
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 7274faabe97ce53d6b464272d7e6ab6c1392837b Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 5 Oct 2022 10:41:16 -0400
Subject: [PATCH] Readline-8.2 patch 1: fix crash when readline is started with
an invalid locale specification
Conflict: The file ._.gitignore does not exist.
Reference: http://git.savannah.gnu.org/cgit/readline.git/commit/?id=7274faabe97ce53d6b464272d7e6ab6c1392837b
---
nls.c | 4 ++++
patchlevel | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/nls.c b/nls.c
index 5c6a13b..8c027d6 100644
--- a/nls.c
+++ b/nls.c
@@ -141,6 +141,10 @@ _rl_init_locale (void)
if (lspec == 0)
lspec = "";
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
+ if (ret == 0 || *ret == 0)
+ ret = setlocale (LC_CTYPE, (char *)NULL);
+ if (ret == 0 || *ret == 0)
+ ret = RL_DEFAULT_LOCALE;
#else
ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
#endif
diff --git a/patchlevel b/patchlevel
index d8c9df7..fdf4740 100644
--- a/patchlevel
+++ b/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-0
+1
--
2.46.0

View File

@ -1,6 +1,6 @@
Name: readline Name: readline
Version: 8.2 Version: 8.2
Release: 2 Release: 3
Summary: Readline library for editing typed command lines Summary: Readline library for editing typed command lines
License: GPLv3+ License: GPLv3+
@ -8,6 +8,7 @@ URL: http://tiswww.case.edu/php/chet/readline/rltop.html
Source0: http://git.savannah.gnu.org/cgit/readline.git/snapshot/%{name}-%{version}.tar.gz Source0: http://git.savannah.gnu.org/cgit/readline.git/snapshot/%{name}-%{version}.tar.gz
Patch0: readline-8.0-shlib.patch Patch0: readline-8.0-shlib.patch
Patch1: backport-Readline-8.2-patch-1-fix-crash-when-readline-is-star.patch
BuildRequires: gcc gcc-c++ ncurses-devel BuildRequires: gcc gcc-c++ ncurses-devel
@ -80,6 +81,9 @@ export CPPFLAGS="-I%{_includedir}/ncurses"
%changelog %changelog
* Wed Jan 8 2025 beta <beta@yfqm.date> - 8.2-3
- backport patch to fix segmentation fault problem
* Wed Feb 1 2023 chenziyang <chenziyang4@huawei.com> - 8.2-2 * Wed Feb 1 2023 chenziyang <chenziyang4@huawei.com> - 8.2-2
- upload readline-8.0-shlib.patch to fix undefined symbol problem - upload readline-8.0-shlib.patch to fix undefined symbol problem