diff --git a/SOURCES/tcsh-6.20.00-001-delay-arginp-interpreting-revert.patch b/SOURCES/tcsh-6.20.00-001-delay-arginp-interpreting-revert.patch new file mode 100644 index 0000000..df3774c --- /dev/null +++ b/SOURCES/tcsh-6.20.00-001-delay-arginp-interpreting-revert.patch @@ -0,0 +1,137 @@ +diff --git a/Fixes b/Fixes +--- a/Fixes ++++ b/Fixes +@@ -2,7 +2,6 @@ + 4. Don't play pointer tricks that are undefined in modern c (Brooks Davis) + 3. Fix out of bounds read (Brooks Davis) + 2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar) +- 1. PR/471: Delay arginp parsing + + 20. V6.20.00 - 20161124 + 19. Don't resize the screen if it did not change size. +diff --git a/sh.c b/sh.c +--- a/sh.c ++++ b/sh.c +@@ -249,7 +249,6 @@ main(int argc, char **argv) + char *tcp, *ttyn; + int f, reenter; + char **tempv; +- const char *targinp = NULL; + int osetintr; + struct sigaction oparintr; + +@@ -941,7 +940,30 @@ main(int argc, char **argv) + *p &= ASCII; + } + #endif +- targinp = tempv[0]; ++ arginp = SAVE(tempv[0]); ++ ++ /* ++ * we put the command into a variable ++ */ ++ if (arginp != NULL) ++ setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE); ++ ++ /* ++ * * Give an error on -c arguments that end in * backslash to ++ * ensure that you don't make * nonportable csh scripts. ++ */ ++ { ++ int count; ++ ++ cp = Strend(arginp); ++ count = 0; ++ while (cp > arginp && *--cp == '\\') ++ ++count; ++ if ((count & 1) != 0) { ++ exiterr = 1; ++ stderror(ERR_ARGC); ++ } ++ } + prompt = 0; + nofile = 1; + break; +@@ -1186,7 +1208,7 @@ main(int argc, char **argv) + sigset_interrupting(SIGXFSZ, queue_phup); + #endif + +- if (quitit == 0 && targinp == 0) { ++ if (quitit == 0 && arginp == 0) { + #ifdef SIGTSTP + (void) signal(SIGTSTP, SIG_IGN); + #endif +@@ -1304,7 +1326,7 @@ main(int argc, char **argv) + */ + sigset_interrupting(SIGCHLD, queue_pchild); + +- if (intty && !targinp) ++ if (intty && !arginp) + (void) ed_Setup(editing);/* Get the tty state, and set defaults */ + /* Only alter the tty state if editing */ + +@@ -1339,7 +1361,7 @@ main(int argc, char **argv) + #ifdef _PATH_DOTCSHRC + (void) srcfile(_PATH_DOTCSHRC, 0, 0, NULL); + #endif +- if (!targinp && !onelflg && !havhash) ++ if (!arginp && !onelflg && !havhash) + dohash(NULL,NULL); + #ifndef LOGINFIRST + #ifdef _PATH_DOTLOGIN +@@ -1359,7 +1381,7 @@ main(int argc, char **argv) + if (!srccat(varval(STRhome), STRsldottcshrc)) + (void) srccat(varval(STRhome), STRsldotcshrc); + +- if (!targinp && !onelflg && !havhash) ++ if (!arginp && !onelflg && !havhash) + dohash(NULL,NULL); + + /* +@@ -1379,7 +1401,7 @@ main(int argc, char **argv) + exitset--; + + /* Initing AFTER .cshrc is the Right Way */ +- if (intty && !targinp) { /* PWP setup stuff */ ++ if (intty && !arginp) { /* PWP setup stuff */ + ed_Init(); /* init the new line editor */ + #ifdef SIG_WINDOW + check_window_size(1); /* mung environment */ +@@ -1395,37 +1417,6 @@ main(int argc, char **argv) + setNS(STRecho); + + +- if (targinp) { +- /* If this -c command caused an error before, skip processing */ +- if (reenter && arginp) { +- exitcode = 1; +- goto done; +- } +- +- arginp = SAVE(targinp); +- /* +- * we put the command into a variable +- */ +- if (arginp != NULL) +- setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE); +- +- /* +- * * Give an error on -c arguments that end in * backslash to +- * ensure that you don't make * nonportable csh scripts. +- */ +- { +- int count; +- +- cp = Strend(arginp); +- count = 0; +- while (cp > arginp && *--cp == '\\') +- ++count; +- if ((count & 1) != 0) { +- exiterr = 1; +- stderror(ERR_ARGC); +- } +- } +- } + /* + * All the rest of the world is inside this call. The argument to process + * indicates whether it should catch "error unwinds". Thus if we are a diff --git a/SPECS/tcsh.spec b/SPECS/tcsh.spec index af7ffc3..4731c30 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: 14%{?dist} +Release: 15%{?dist} License: BSD URL: http://www.tcsh.org/ @@ -64,6 +64,9 @@ Patch016: tcsh-6.20.00-dont-corrupt-history-using-modifiers.patch # ------------------ Patch100: tcsh-6.20.00-manpage-memoryuse.patch +# This reverts patch001: tcsh-6.20.00-001-delay-arginp-interpreting.patch +# bug 1845684 +Patch101: tcsh-6.20.00-001-delay-arginp-interpreting-revert.patch # Downstream patches for RHEL -- patches that we keep only in RHEL for various # --------------------------- reasons, but are not enabled in Fedora: @@ -192,6 +195,10 @@ fi # ============================================================================= %changelog +* Mon Oct 18 2021 Siteshwar Vashisht - 6.20.00-15 +- Fix regression caused by bacported patch, command var is now set as before + Resolves: #1845684 + * Wed Sep 08 2021 Jan Macku - 6.20.00-14 - Modifiers no longer breaks history - (#1997981)