Rebase to tcsh-6.23.00

Resolves: #2022337
This commit is contained in:
Jan Macku 2021-11-15 14:40:53 +01:00
parent 8626dddabc
commit 19c98fa89d
5 changed files with 10 additions and 137 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ tcsh-6.17.00.tar.gz
/tcsh-6.22.02.tar.gz
/tcsh-6.22.03.tar.gz
/tcsh-6.22.04.tar.gz
/tcsh-6.23.00.tar.gz

View File

@ -1 +1 @@
SHA512 (tcsh-6.22.04.tar.gz) = 3956df52124d496dc0e67e4e3e801787f31690f96a60399953e401648d5b4cfb06baa9833c32cb771177b3e89b7a27e5765534db073206568fe773598a55e873
SHA512 (tcsh-6.23.00.tar.gz) = 8ea491e9409f12ab113bf5551398cb827692a50340318b050d0f8278d3cd9c133ba89a407dc692d9c4bd69957ecd6d4d92db7ccfacc7064ace3b09e3bd562f30

View File

@ -1,62 +0,0 @@
From c14852867786c798f98a23d075e76a2e2acce204 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 23 Aug 2021 08:30:57 -0400
Subject: [PATCH] - Expose HIST_PURGE - Compare pointer against null - Use
initlex()
---
sh.h | 2 ++
sh.lex.c | 6 ++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sh.h b/sh.h
index 3c285a9e..77e801c6 100644
--- a/sh.h
+++ b/sh.h
@@ -78,6 +78,7 @@ typedef unsigned long intptr_t;
#if defined(KANJI) && defined(WIDE_STRINGS) && defined(HAVE_NL_LANGINFO) && defined(CODESET)
#define AUTOSET_KANJI
#endif
+
/*
* Sanity
*/
@@ -1027,6 +1028,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 5b0c6d8d..afe053e5 100644
--- a/sh.lex.c
+++ b/sh.lex.c
@@ -153,8 +153,7 @@ lex(struct wordent *hp)
if (!postcmd_active)
btell(&lineloc);
- hp->next = hp->prev = hp;
- hp->word = STRNULL;
+ initlex(hp);
hadhist = 0;
do
c = readc(0);
@@ -711,7 +710,7 @@ getexcl(Char sc)
lastev = eventno;
hp = gethent(sc);
- if (hp == 0)
+ if (hp == NULL)
return;
hadhist = 1;
dol = 0;
@@ -901,7 +900,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)
{

View File

@ -1,70 +0,0 @@
From 04a68ad191cfcb87cdff70a6b913721e423cd28b Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 23 Aug 2021 08:31:59 -0400
Subject: [PATCH] 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
---
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 e230becd..1ac9716e 100644
--- a/sh.decls.h
+++ b/sh.decls.h
@@ -217,6 +217,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 14d862a3..40660bdc 100644
--- a/sh.hist.c
+++ b/sh.hist.c
@@ -1184,6 +1184,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 9f2b1a29..df4aa7a3 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);
}

View File

@ -12,8 +12,8 @@
Name: tcsh
Summary: An enhanced version of csh, the C shell
Version: 6.22.04
Release: 3%{?dist}
Version: 6.23.00
Release: 1%{?dist}
License: BSD
URL: http://www.tcsh.org/
@ -43,8 +43,7 @@ BuildRequires: ncurses-devel
# Upstream patches -- official upstream patches released by upstream since the
# ---------------- last rebase that are necessary for any reason:
Patch001: tcsh-6.22.04-expose-HIST_PURGE.patch
Patch002: tcsh-6.22.04-modifiers-no-longer-breaks-history.patch
# Downstream patches -- these should be always included when doing rebase:
# ------------------
@ -178,6 +177,11 @@ fi
# =============================================================================
%changelog
* Mon Nov 15 2021 Jan Macku <jamacku@redhat.com> - 6.23.00-1
- Update to tcsh-6.23.00 (#2022337)
- Drop tcsh-6.22.04-expose-HIST_PURGE.patch - applied by upstream
- Drop tcsh-6.22.04-modifiers-no-longer-breaks-history.patch - applied by upstream
* Tue Aug 24 2021 Jan Macku <jamacku@redhat.com> - 6.22.04-3
- Fix issue when modifiers breaks history