Fix segfault on starting ksh with no TERM env var
Resolves: RHEL-83283
This commit is contained in:
parent
502c242561
commit
f110868ac8
59
ksh-1.0.9-no-TERM-env-segfault.patch
Normal file
59
ksh-1.0.9-no-TERM-env-segfault.patch
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
From 26eec44e33ed4a48cb7ba34706d96387385d1980 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Johnothan King <johnothanking@protonmail.com>
|
||||||
|
Date: Thu, 22 Feb 2024 15:26:57 -0800
|
||||||
|
Subject: [PATCH] Fix segfault on starting ksh with no TERM env var (#723)
|
||||||
|
|
||||||
|
This commit fixes a crash that prevented ksh from starting up in
|
||||||
|
single user mode on DragonFlyBSD and NetBSD.
|
||||||
|
|
||||||
|
src/cmd/ksh93/edit/edit.c:
|
||||||
|
- Make sure the np node for $TERM is not null before checking for
|
||||||
|
an export attribute.
|
||||||
|
|
||||||
|
Co-authored-by: Martijn Dekker <martijn@inlv.org>
|
||||||
|
Resolves: https://github.com/ksh93/ksh/issues/722
|
||||||
|
---
|
||||||
|
src/cmd/ksh93/edit/edit.c | 2 +-
|
||||||
|
src/cmd/ksh93/tests/pty.sh | 14 ++++++++++++++
|
||||||
|
2 files changed, 15 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/cmd/ksh93/edit/edit.c b/src/cmd/ksh93/edit/edit.c
|
||||||
|
index 32e1e83..0ac54ba 100644
|
||||||
|
--- a/src/cmd/ksh93/edit/edit.c
|
||||||
|
+++ b/src/cmd/ksh93/edit/edit.c
|
||||||
|
@@ -614,7 +614,7 @@ void ed_setup(Edit_t *ep, int fd, int reedit)
|
||||||
|
static char *oldterm;
|
||||||
|
Namval_t *np = nv_search("TERM",sh.var_tree,0);
|
||||||
|
char *term = NULL;
|
||||||
|
- if(nv_isattr(np,NV_EXPORT))
|
||||||
|
+ if(np && nv_isattr(np,NV_EXPORT))
|
||||||
|
term = nv_getval(np);
|
||||||
|
if(!term)
|
||||||
|
term = "";
|
||||||
|
diff --git a/src/cmd/ksh93/tests/pty.sh b/src/cmd/ksh93/tests/pty.sh
|
||||||
|
index 5dbdf6c..b4f8e28 100755
|
||||||
|
--- a/src/cmd/ksh93/tests/pty.sh
|
||||||
|
+++ b/src/cmd/ksh93/tests/pty.sh
|
||||||
|
@@ -1255,5 +1255,19 @@ w _ksh_93u_m_cmdcompl\t
|
||||||
|
r :test-2: _ksh_93u_m_cmdcomplete_test_ \r\n$
|
||||||
|
!
|
||||||
|
|
||||||
|
+((multiline && (SHOPT_VSH || SHOPT_ESH))) && TERM=vt100 tst $LINENO <<"!"
|
||||||
|
+L crash when TERM is undefined
|
||||||
|
+# https://github.com/ksh93/ksh/issues/722
|
||||||
|
+
|
||||||
|
+d 40
|
||||||
|
+p :test-1:
|
||||||
|
+w unset TERM
|
||||||
|
+p :test-2:
|
||||||
|
+w "$SHELL"
|
||||||
|
+p :test-3:
|
||||||
|
+w print Exit status $?
|
||||||
|
+u ^Exit status 0\r\n$
|
||||||
|
+!
|
||||||
|
+
|
||||||
|
# ======
|
||||||
|
exit $((Errors<125?Errors:125))
|
||||||
|
--
|
||||||
|
2.49.0
|
||||||
|
|
10
ksh.spec
10
ksh.spec
@ -4,7 +4,7 @@ URL: http://www.kornshell.com/
|
|||||||
License: EPL-1.0
|
License: EPL-1.0
|
||||||
Epoch: 3
|
Epoch: 3
|
||||||
Version: 1.0.6
|
Version: 1.0.6
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
Source0: https://github.com/ksh93/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/ksh93/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||||
Source1: kshcomp.conf
|
Source1: kshcomp.conf
|
||||||
Source2: kshrc.rhs
|
Source2: kshrc.rhs
|
||||||
@ -38,6 +38,10 @@ Patch7: ksh-1.0.11-redir.patch
|
|||||||
#upstream commit: https://github.com/ksh93/ksh/commit/6668c3eb0bdc48335120e7c48590ab46af0ef0f3
|
#upstream commit: https://github.com/ksh93/ksh/commit/6668c3eb0bdc48335120e7c48590ab46af0ef0f3
|
||||||
Patch8: ksh-1.0.10-pjob.patch
|
Patch8: ksh-1.0.10-pjob.patch
|
||||||
|
|
||||||
|
#upstream commit: https://github.com/ksh93/ksh/commit/b15f63284bcd656729be61be6434376876be5bfc
|
||||||
|
#upstream commit: https://github.com/ksh93/ksh/commit/5e3a169785139809f1f733314f5660769c86d10c (test fix)
|
||||||
|
Patch9: ksh-1.0.9-no-TERM-env-segfault.patch
|
||||||
|
|
||||||
Conflicts: pdksh
|
Conflicts: pdksh
|
||||||
Requires: coreutils, diffutils
|
Requires: coreutils, diffutils
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
@ -159,6 +163,10 @@ fi
|
|||||||
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
|
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Mar 29 2025 Vincent Mihalkovic <vmihalko@redhat.com> - 3:1.0.6-8
|
||||||
|
- Fix segfault on starting ksh with no TERM env var
|
||||||
|
Resolves: RHEL-83283
|
||||||
|
|
||||||
* Mon Feb 17 2025 Vincent Mihalkovic <vmihalko@redhat.com> - 3:1.0.6-7
|
* Mon Feb 17 2025 Vincent Mihalkovic <vmihalko@redhat.com> - 3:1.0.6-7
|
||||||
- Change p_job variable type from short to int
|
- Change p_job variable type from short to int
|
||||||
Resolves: RHEL-64299
|
Resolves: RHEL-64299
|
||||||
|
Loading…
Reference in New Issue
Block a user