import tcsh-6.20.00-14.el8

This commit is contained in:
CentOS Sources 2021-10-21 04:20:59 +00:00 committed by Stepan Oksanichenko
parent eb7fe809dc
commit c48c724b32
3 changed files with 141 additions and 1 deletions

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: 14%{?dist}
License: BSD
URL: http://www.tcsh.org/
@ -57,6 +57,8 @@ 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:
# ------------------
@ -190,6 +192,9 @@ fi
# =============================================================================
%changelog
* 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)