diff --git a/SOURCES/tcsh-6.20.00-012-warrning-history-loading.patch b/SOURCES/tcsh-6.20.00-012-warrning-history-loading.patch new file mode 100644 index 0000000..71b2df6 --- /dev/null +++ b/SOURCES/tcsh-6.20.00-012-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/SOURCES/tcsh-6.20.00-013-prevent-phup-and-record-from-multiple-execution.patch b/SOURCES/tcsh-6.20.00-013-prevent-phup-and-record-from-multiple-execution.patch new file mode 100644 index 0000000..ab99045 --- /dev/null +++ b/SOURCES/tcsh-6.20.00-013-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/SOURCES/tcsh-6.20.00-014-call-stderror-consistently-and-avoid-inf-loops.patch b/SOURCES/tcsh-6.20.00-014-call-stderror-consistently-and-avoid-inf-loops.patch new file mode 100644 index 0000000..c591586 --- /dev/null +++ b/SOURCES/tcsh-6.20.00-014-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/SPECS/tcsh.spec b/SPECS/tcsh.spec index fd70d9f..ea6c813 100644 --- a/SPECS/tcsh.spec +++ b/SPECS/tcsh.spec @@ -13,7 +13,7 @@ Name: tcsh Summary: An enhanced version of csh, the C shell Version: 6.20.00 -Release: 12%{?dist} +Release: 13%{?dist} License: BSD URL: http://www.tcsh.org/ @@ -54,7 +54,9 @@ Patch008: tcsh-6.20.00-008-guard-ascii-only-reversion.patch Patch009: tcsh-6.20.00-009-fix-regexp-for-backlash-quoting-tests.patch Patch010: tcsh-6.20.00-010-fix-memory-consumption-while-loading-corrupted-history.patch Patch011: tcsh-6.20.00-011-fix-infinite-loop-after-ctrlC.patch - +Patch012: tcsh-6.20.00-012-warrning-history-loading.patch +Patch013: tcsh-6.20.00-013-prevent-phup-and-record-from-multiple-execution.patch +Patch014: tcsh-6.20.00-014-call-stderror-consistently-and-avoid-inf-loops.patch # Downstream patches -- these should be always included when doing rebase: # ------------------ @@ -188,6 +190,9 @@ fi # ============================================================================= %changelog +* Mon Nov 16 2020 Jan Macku - 6.20.00-13 +- fix regression caused by corrupted history (#1818766) + * Fri Nov 01 2019 Jan Macku - 6.20.00-12 - rebuilt