import tcsh-6.20.00-15.el8

This commit is contained in:
CentOS Sources 2022-05-10 03:01:48 -04:00 committed by Stepan Oksanichenko
parent e10b5948ec
commit 6fbc34cd83
4 changed files with 285 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,77 @@
From cab544f34758f71ab3070f343efb6daee68daf81 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 8 Sep 2021 11:00:35 +0200
Subject: [PATCH] Modifiers no longer breaks history
Fix bug reported by Jan Macku: alias postcmd '/bin/echo
-n "COMMAND:"'"'"'\!#:-$:gx'"'"'' echo 1 2 3 4 5
^P prints echo 1 2 3 4
Reason: domod() enters junk history entries with event number
HIST_PURGE aliasrun which is used to run postcmd modifies the history
appending those entries. Fix by explicitly cleaning up those entries in
aliasrun
Based on upstream patch: 04a68ad191cfcb87cdff70a6b913721e423cd28b from Christos Zoulas <christos@zoulas.com>
---
sh.decls.h | 1 +
sh.hist.c | 11 +++++++++++
tc.func.c | 2 ++
3 files changed, 14 insertions(+)
diff --git a/sh.decls.h b/sh.decls.h
index 8dc22d5..a75563b 100644
--- a/sh.decls.h
+++ b/sh.decls.h
@@ -218,6 +218,7 @@ extern int t_pmatch (const Char *, const Char *,
*/
extern void dohist (Char **, struct command *);
extern struct Hist *enthist (int, struct wordent *, int, int, int);
+extern void cleanhist (void);
extern void savehist (struct wordent *, int);
extern char *fmthist (int, ptr_t);
extern void rechist (Char *, int);
diff --git a/sh.hist.c b/sh.hist.c
index 1abd522..bafc711 100644
--- a/sh.hist.c
+++ b/sh.hist.c
@@ -1178,6 +1178,17 @@ dohist(Char **vp, struct command *c)
}
}
+void
+cleanhist(void)
+{
+ struct Hist *hp, *np;
+
+ for (hp = &Histlist; (np = hp->Hnext) != NULL;) {
+ if (np->Hnum != HIST_PURGE)
+ return;
+ hremove(np), hfree(np);
+ }
+}
char *
fmthist(int fmt, ptr_t ptr)
diff --git a/tc.func.c b/tc.func.c
index feb1c89..4849b55 100644
--- a/tc.func.c
+++ b/tc.func.c
@@ -999,6 +999,7 @@ aliasrun(int cnt, Char *s1, Char *s2)
getexit(osetexit);
if (seterr) {
+ cleanhist();
xfree(seterr);
seterr = NULL; /* don't repeatedly print err msg. */
}
@@ -1075,6 +1076,7 @@ aliasrun(int cnt, Char *s1, Char *s2)
}
cleanup_until(&w);
pendjob();
+ cleanhist();
/* Restore status */
setv(STRstatus, putn((tcsh_number_t)status), VAR_READWRITE);
}
--
2.31.1

View File

@ -0,0 +1,58 @@
From 534e2628b598b38801759535f38c228793253345 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 8 Sep 2021 10:52:43 +0200
Subject: [PATCH] Expose HIST_PURGE - Compare pointer against null - Use
initlex()
Based on upstream patch c14852867786c798f98a23d075e76a2e2acce204 from Christos Zoulas <christos@zoulas.com>
---
sh.h | 1 +
sh.lex.c | 6 ++----
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/sh.h b/sh.h
index a41e2e0..5f9cb14 100644
--- a/sh.h
+++ b/sh.h
@@ -1019,6 +1019,7 @@ EXTERN struct varent {
* The following are for interfacing redo substitution in
* aliases to the lexical routines.
*/
+#define HIST_PURGE -500000
EXTERN struct wordent *alhistp IZERO_STRUCT;/* Argument list (first) */
EXTERN struct wordent *alhistt IZERO_STRUCT;/* Node after last in arg list */
EXTERN Char **alvec IZERO_STRUCT,
diff --git a/sh.lex.c b/sh.lex.c
index b754fd3..065c78b 100644
--- a/sh.lex.c
+++ b/sh.lex.c
@@ -155,8 +155,7 @@ lex(struct wordent *hp)
histline.len = 0;
btell(&lineloc);
- hp->next = hp->prev = hp;
- hp->word = STRNULL;
+ initlex(hp);
hadhist = 0;
do
c = readc(0);
@@ -703,7 +702,7 @@ getexcl(Char sc)
lastev = eventno;
hp = gethent(sc);
- if (hp == 0)
+ if (hp == NULL)
return;
hadhist = 1;
dol = 0;
@@ -893,7 +892,6 @@ getsub(struct wordent *en)
* We raise the limit to 50000000
*/
-#define HIST_PURGE -50000000
static struct wordent *
dosub(Char sc, struct wordent *en, int global)
{
--
2.31.1

View File

@ -13,7 +13,7 @@
Name: tcsh
Summary: An enhanced version of csh, the C shell
Version: 6.20.00
Release: 13%{?dist}
Release: 15%{?dist}
License: BSD
URL: http://www.tcsh.org/
@ -57,11 +57,16 @@ 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
Patch015: tcsh-6.20.00-expose-HIST_PURGE.patch
Patch016: tcsh-6.20.00-dont-corrupt-history-using-modifiers.patch
# Downstream patches -- these should be always included when doing rebase:
# ------------------
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:
@ -190,6 +195,13 @@ fi
# =============================================================================
%changelog
* Mon Oct 18 2021 Siteshwar Vashisht <svashisht@redhat.com> - 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 <jamacku@redhat.com> - 6.20.00-14
- Modifiers no longer breaks history - (#1997981)
* Mon Nov 16 2020 Jan Macku <jamacku@redhat.com> - 6.20.00-13
- fix regression caused by corrupted history (#1818766)