diff --git a/tcsh-6.18.01-call-stderror-consistently-and-avoid-inf-loops.patch b/tcsh-6.18.01-call-stderror-consistently-and-avoid-inf-loops.patch new file mode 100644 index 0000000000000000000000000000000000000000..c5915869b29bba621e2843a65c58b420c54a51bd --- /dev/null +++ b/tcsh-6.18.01-call-stderror-consistently-and-avoid-inf-loops.patch @@ -0,0 +1,35 @@ +From 38ffe6da549152a0c411407f5846d0b8896bc25c Mon Sep 17 00:00:00 2001 +From: Jan Macku +Date: Thu, 30 Jul 2020 09:42:39 +0200 +Subject: [PATCH] Call stderror consistently and avoid inf loops +Suggested by Kamil Dudka + +--- + sh.lex.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sh.lex.c b/sh.lex.c +index a10436c..fcaae97 100644 +--- a/sh.lex.c ++++ b/sh.lex.c +@@ -304,7 +304,7 @@ word(int parsehtime) + cleanup_push(&wbuf, Strbuf_cleanup); + loop: + if (enterhist && toolong++ > 256 * 1024) +- seterror(ERR_WTOOLONG); ++ stderror(ERR_WTOOLONG); + while ((c = getC(DOALL)) == ' ' || c == '\t') + continue; + if (cmap(c, _META | _ESC)) +@@ -364,7 +364,7 @@ loop: + dolflg = DOALL; + for (;;) { + if (enterhist && toolong++ > 256 * 1024) +- seterror(ERR_WTOOLONG); ++ stderror(ERR_WTOOLONG); + if (c1) { + if (c == c1) { + c1 = 0; +-- +2.25.4 + diff --git a/tcsh-6.18.01-prevent-phup-and-record-from-multiple-execution.patch b/tcsh-6.18.01-prevent-phup-and-record-from-multiple-execution.patch new file mode 100644 index 0000000000000000000000000000000000000000..ab99045df1ca8a40924aa86c35575ebc2d6aa5a4 --- /dev/null +++ b/tcsh-6.18.01-prevent-phup-and-record-from-multiple-execution.patch @@ -0,0 +1,31 @@ +From 67db04d8d8ada0aa2fb7dfdf83f3a408ad5a01dc Mon Sep 17 00:00:00 2001 +From: zoulasc +Date: Mon, 20 Jan 2020 11:29:01 -0500 +Subject: [PATCH] Prevent phup() and record() from being executed more than + once because writing history recursively deadlocks (Brett Frankenberger) +diff --git a/sh.c b/sh.c +index dd87172..75ba62d 100644 +--- a/sh.c ++++ b/sh.c +@@ -1839,6 +1839,10 @@ exitstat(void) + void + phup(void) + { ++ static int again = 0; ++ if (again++) ++ return; ++ + if (loginsh) { + setcopy(STRlogout, STRhangup, VAR_READWRITE); + #ifdef _PATH_DOTLOGOUT +@@ -2516,6 +2520,10 @@ defaultpath(void) + static void + record(void) + { ++ static int again = 0; ++ if (again++) ++ return; ++ + if (!fast) { + recdirs(NULL, adrof(STRsavedirs) != NULL); + rechist(NULL, adrof(STRsavehist) != NULL); diff --git a/tcsh-6.18.01-warrning-history-loading.patch b/tcsh-6.18.01-warrning-history-loading.patch new file mode 100644 index 0000000000000000000000000000000000000000..71b2df65ab6443f7a8e7bedb281a7f9380387c03 --- /dev/null +++ b/tcsh-6.18.01-warrning-history-loading.patch @@ -0,0 +1,25 @@ +From 4723e1754cd28657183358334fe77fe328f01bd0 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Fri, 18 Oct 2019 13:35:49 -0400 +Subject: [PATCH] When the load of history caused an error, say so. +diff --git a/sh.err.c b/sh.err.c +index c676f5e..010b23c 100644 +--- a/sh.err.c ++++ b/sh.err.c +@@ -43,6 +43,7 @@ + #endif + + char *seterr = NULL; /* Holds last error if there was one */ ++extern int enterhist; + + #define ERR_FLAGS 0xf0000000 + #define ERR_NAME 0x10000000 +@@ -630,6 +631,8 @@ stderror(unsigned int id, ...) + */ + flush();/*FIXRESET*/ + haderr = 1; /* Now to diagnostic output */ ++ if (enterhist) ++ xprintf("Can't load history: ");/*FIXRESET*/ + if (flags & ERR_NAME) + xprintf("%s: ", bname);/*FIXRESET*/ + if ((flags & ERR_OLD)) { diff --git a/tcsh.spec b/tcsh.spec index cc8821c615794c6c4eb5f04fe9b6cc94df0ac4b8..e70f08b1a7ffbd2d04b832daf56e04e01ea71339 100644 --- a/tcsh.spec +++ b/tcsh.spec @@ -3,7 +3,7 @@ Summary: An enhanced version of csh, the C shell Name: tcsh Version: 6.18.01 -Release: 17%{?dist} +Release: 17%{?dist}.1 License: BSD Group: System Environment/Shells Source: http://ftp.funet.fi/pub/unix/shells/tcsh/%{name}-%{version}.tar.gz @@ -38,7 +38,9 @@ Patch48: tcsh-6.18.01-fix-memory-leak-for-cdpath.patch # Patch49 reverted Patch50: tcsh-6.18.01-fix-memory-consumption-while-loading-corrupted-history.patch Patch51: tcsh-6.18.01-fix-infinite-loop-after-ctrlC.patch - +Patch52: tcsh-6.18.01-warrning-history-loading.patch +Patch53: tcsh-6.18.01-prevent-phup-and-record-from-multiple-execution.patch +Patch54: tcsh-6.18.01-call-stderror-consistently-and-avoid-inf-loops.patch Provides: csh = %{version} Requires(post): grep @@ -84,6 +86,9 @@ like syntax. %patch48 -p1 %patch50 -p1 %patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 for i in Fixes WishList; do iconv -f iso-8859-1 -t utf-8 "$i" > "${i}_" && \ @@ -157,8 +162,12 @@ fi %{_mandir}/man1/*.1* %changelog +* Tue Jul 14 2020 Jan Macku - 6.18.01-17.el7.1 +- fix regression caused by corrupted history (#1846271) +- fix typo in spec + * Tue Jun 09 2020 Jan Macku - 6.18.01-17 -- fix regression caused by bacported patch, command var is now set as before (#1842722) +- fix regression caused by backported patch, command var is now set as before (#1842722) * Fri Oct 25 2019 Jan Macku - 6.18.01-16 - fix for rapid memory consumption caused by corrupted history (#1598502)