diff --git a/.gitignore b/.gitignore index bd3a11a..f746946 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ tcsh-6.16.00.tar.gz tcsh-6.17.00.tar.gz /tcsh-6.18.00.tar.gz /tcsh-6.18.01.tar.gz +/tcsh-6.19.00.tar.gz diff --git a/sources b/sources index ab2ec58..13670ee 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -6eed09dbd4223ab5b6955378450d228a tcsh-6.18.01.tar.gz +f5f854833578647795bc906dd4bcb5d5 tcsh-6.19.00.tar.gz diff --git a/tcsh-6.14.00-tinfo.patch b/tcsh-6.14.00-tinfo.patch deleted file mode 100644 index c64fe15..0000000 --- a/tcsh-6.14.00-tinfo.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 2972adf2edc96aae26a82b94adab792c9520fa74 Mon Sep 17 00:00:00 2001 -From: "Vojtech Vitek (V-Teq)" -Date: Thu, 15 Mar 2012 02:10:35 +0100 -Subject: [PATCH 02/14] Search for tinfo library instead of termcap/(n)curses - etc. - ---- - configure.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.in b/configure.in -index c336e54..ef330a2 100644 ---- a/configure.in -+++ b/configure.in -@@ -299,7 +299,7 @@ fi - dnl Checks for libraries - AC_SEARCH_LIBS(crypt, crypt) - AC_SEARCH_LIBS(getspnam, sec) --AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses) -+AC_SEARCH_LIBS(tgetent, tinfo) - AC_SEARCH_LIBS(gethostbyname, nsl) - AC_SEARCH_LIBS(connect, socket) - AC_SEARCH_LIBS(catgets, catgets) --- -1.9.3 - diff --git a/tcsh-6.15.00-hist-sub.patch b/tcsh-6.15.00-hist-sub.patch index c3477e5..2d2c0f0 100644 --- a/tcsh-6.15.00-hist-sub.patch +++ b/tcsh-6.15.00-hist-sub.patch @@ -4,21 +4,24 @@ Date: Wed, 27 Aug 2014 13:39:53 +0200 Subject: [PATCH 04/14] Fix '\' can not be used to quote all delimiters Related: #435421 + +Adjusted for tcsh-6.19.00 by Fridolin Pokorny + --- tcsh.man | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcsh.man b/tcsh.man -index cb0709e..7085160 100644 +index 4fa59d2..b79bafe 100644 --- a/tcsh.man +++ b/tcsh.man -@@ -1046,7 +1046,7 @@ Substitute \fIl\fR for \fIr\fR. +@@ -1047,7 +1047,7 @@ Substitute \fIl\fR for \fIr\fR. \fIl\fR is simply a string like \fIr\fR, not a regular expression as in the eponymous \fIed\fR(1) command. Any character may be used as the delimiter in place of `/'; --a `\\' can be used to quote the delimiter inside \fIl\fR and \fIr\fR. +-a `\e' can be used to quote the delimiter inside \fIl\fR and \fIr\fR. +a `\\' can be used to quote the delimiter expect `(', `)', `|' and `>' inside \fIl\fR and \fIr\fR. - The character `&' in the \fIr\fR is replaced by \fIl\fR; `\\' also quotes `&'. + The character `&' in the \fIr\fR is replaced by \fIl\fR; `\e' also quotes `&'. If \fIl\fR is empty (``''), the \fIl\fR from a previous substitution or the \fIs\fR from a previous search or event number in event specification is used. -- diff --git a/tcsh-6.17.00-manpage-spelling.patch b/tcsh-6.17.00-manpage-spelling.patch deleted file mode 100644 index b92adcb..0000000 --- a/tcsh-6.17.00-manpage-spelling.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 3b0c32ede9deb74ab43d63e549e06d362cb3b31b Mon Sep 17 00:00:00 2001 -From: "Vojtech Vitek (V-Teq)" -Date: Sat, 29 Oct 2011 21:18:34 +0200 -Subject: [PATCH 08/14] Fix minor man page spelling mistakes - -Changes proposed by John Bradshaw. -rhbz#675137 - ---- - tcsh.man | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tcsh.man b/tcsh.man -index 322ee98..de8be03 100644 ---- a/tcsh.man -+++ b/tcsh.man -@@ -1748,7 +1748,7 @@ rather than to the file to which the link points (+) * - see if it has the specified relationship to the real user. If \fIfile\fR - does not exist or is inaccessible or, for the operators indicated by `*', - if the specified file type does not exist on the current system, --then all enquiries return false, i.e., `0'. -+then all inquiries return false, i.e., `0'. - .PP - These operators may be combined for conciseness: `\-\fIxy file\fR' is - equivalent to `\-\fIx file\fR && \-\fIy file\fR'. (+) For example, `\-fx' is true -@@ -3618,7 +3618,7 @@ whenever the environment variable changes the shell changes the corresponding - shell variable to match (unless the shell variable is read-only) and vice - versa. Note that although \fBcwd\fR and \fBPWD\fR have identical meanings, they - are not synchronized in this manner, and that the shell automatically --interconverts the different formats of \fBpath\fR and \fBPATH\fR. -+converts between the different formats of \fBpath\fR and \fBPATH\fR. - .TP 8 - .B addsuffix \fR(+) - If set, filename completion adds `/' to the end of directories and a space --- -1.9.3 - diff --git a/tcsh-6.18.00-history-file-locking.patch b/tcsh-6.18.00-history-file-locking.patch deleted file mode 100644 index 947ff65..0000000 --- a/tcsh-6.18.00-history-file-locking.patch +++ /dev/null @@ -1,705 +0,0 @@ -From b3c7d8537a3a9b89639ddfe49246a898cabc4454 Mon Sep 17 00:00:00 2001 -From: Roman Kollar -Date: Mon, 29 Oct 2012 17:52:52 +0100 -Subject: [PATCH 09/14] Add .history file locking - shared readers, exclusive - writer - -Originally reported at Red Hat Bugzilla: -https://bugzilla.redhat.com/show_bug.cgi?id=648592 - -Patch by Vojtech Vitek (V-Teq) - -Additional changes reflecting: -https://bugzilla.redhat.com/show_bug.cgi?id=879371 - -Changes by Fridolin Pokorny - ---- - sh.c | 105 ++++++++++++++++++++++++++++++++++++------------- - sh.decls.h | 4 +- - sh.dol.c | 2 +- - sh.err.c | 16 ++++++++ - sh.h | 18 +++++++++ - sh.hist.c | 131 +++++++++++++++++++++++++++++++------------------------------ - sh.lex.c | 8 ++-- - sh.sem.c | 2 +- - 8 files changed, 186 insertions(+), 100 deletions(-) - -diff --git a/sh.c b/sh.c -index dcd9116..f897317 100644 ---- a/sh.c -+++ b/sh.c -@@ -140,6 +140,7 @@ struct saved_state { - int cantell; - struct Bin B; - int justpr; -+ int close_unit; - }; - - static int srccat (Char *, Char *); -@@ -1369,7 +1370,7 @@ main(int argc, char **argv) - /* - * Source history before .login so that it is available in .login - */ -- loadhist(NULL, 0); -+ loadhist(NULL, HIST_FILE_RDLCK); - #ifndef LOGINFIRST - if (loginsh) - (void) srccat(varval(STRhome), STRsldotlogin); -@@ -1492,7 +1493,7 @@ static int - srccat(Char *cp, Char *dp) - { - if (cp[0] == '/' && cp[1] == '\0') -- return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL); -+ return srcfile(short2str(dp), (mflag ? 0 : HIST_ONLY), 0, NULL); - else { - Char *ep; - char *ptr; -@@ -1508,7 +1509,7 @@ srccat(Char *cp, Char *dp) - cleanup_push(ep, xfree); - ptr = short2str(ep); - -- rv = srcfile(ptr, (mflag ? 0 : 1), 0, NULL); -+ rv = srcfile(ptr, (mflag ? 0 : HIST_ONLY), 0, NULL); - cleanup_until(ep); - return rv; - } -@@ -1522,20 +1523,49 @@ static int - #else - int - #endif /*WINNT_NATIVE*/ --srcfile(const char *f, int onlyown, int flag, Char **av) -+srcfile(const char *f, int onlyown, int flg, Char **av) - { -- int unit; -- -- if ((unit = xopen(f, O_RDONLY|O_LARGEFILE)) == -1) -- return 0; -- cleanup_push(&unit, open_cleanup); -- unit = dmove(unit, -1); -- cleanup_ignore(&unit); -- cleanup_until(&unit); -- -- (void) close_on_exec(unit, 1); -- srcunit(unit, onlyown, flag, av); -- return 1; -+ int *unit; -+ -+ unit = xmalloc(sizeof(*unit)); -+ cleanup_push(unit, xfree); -+ *unit = xopen(f, O_LARGEFILE | -+ ((flg & HIST_FILE_WRLCK) ? (O_CREAT|O_RDWR) : O_RDONLY), 0600); -+ if (*unit == -1) -+ return 0; /* Error. */ -+ -+ cleanup_push(unit, open_cleanup); -+ *unit = dmove(*unit, -1); -+ (void) close_on_exec(*unit, 1); -+ -+ if (flg & (HIST_FILE_WRLCK | HIST_FILE_RDLCK)) { -+ struct flock fl; -+ -+ fl.l_type = (flg & HIST_FILE_WRLCK) ? F_WRLCK : F_RDLCK; -+ fl.l_whence = SEEK_SET; -+ fl.l_start = 0; -+ fl.l_len = 0; -+ -+ cleanup_push(unit, fcntl_cleanup); -+ if (fcntl(*unit, F_SETLKW, &fl) == -1) -+ cleanup_ignore(unit); -+ } -+ -+ srcunit(*unit, onlyown, flg, av); -+ -+ /* Unlock the unit, if we don't want to leave it locked (or open). */ -+ if ((flg & (HIST_FILE_WRLCK | HIST_FILE_RDLCK)) && -+ (!(flg & HIST_FILE_LOCK) || !(flg & HIST_FILE_OPEN))) -+ cleanup_until(unit); /* fcntl_cleanup */ -+ -+ /* Close the unit, if we don't want to leave it open. */ -+ if (!(flg & HIST_FILE_OPEN)) { -+ cleanup_until(unit); /* open_cleanup */ -+ cleanup_until(unit); /* xfree */ -+ return -1; /* Not error but invalid file descriptor. */ -+ } -+ -+ return *unit; /* File descriptor (fd > FSAFE). */ - } - - -@@ -1544,7 +1574,7 @@ srcfile(const char *f, int onlyown, int flag, Char **av) - * fd. - */ - static void --st_save(struct saved_state *st, int unit, int hflg, Char **al, Char **av) -+st_save(struct saved_state *st, int unit, int flg, Char **al, Char **av) - { - st->insource = insource; - st->SHIN = SHIN; -@@ -1593,10 +1623,14 @@ st_save(struct saved_state *st, int unit, int hflg, Char **al, Char **av) - st->onelflg = onelflg; - st->enterhist = enterhist; - st->justpr = justpr; -- if (hflg) -+ if (flg & (HIST_ONLY | HIST_MERGE)) - st->HIST = HIST; - else - st->HIST = '\0'; -+ if (flg & HIST_FILE_OPEN) -+ st->close_unit = 0; -+ else -+ st->close_unit = 1; - st->cantell = cantell; - cpybin(st->B, B); - -@@ -1635,7 +1669,7 @@ st_save(struct saved_state *st, int unit, int hflg, Char **al, Char **av) - evalp = 0; - alvec = al; - alvecp = 0; -- enterhist = hflg; -+ enterhist = flg & (HIST_ONLY | HIST_MERGE); - if (enterhist) - HIST = '\0'; - insource = 1; -@@ -1668,7 +1702,8 @@ st_restore(void *xst) - } - cpybin(B, st->B); - -- xclose(SHIN); -+ if (st->close_unit) -+ xclose(SHIN); - - insource = st->insource; - SHIN = st->SHIN; -@@ -1704,7 +1739,7 @@ st_restore(void *xst) - * we don't chance it. This occurs on ".cshrc"s and the like. - */ - static void --srcunit(int unit, int onlyown, int hflg, Char **av) -+srcunit(int unit, int onlyown, int flg, Char **av) - { - struct saved_state st; - -@@ -1730,7 +1765,7 @@ srcunit(int unit, int onlyown, int hflg, Char **av) - } - - /* Save the current state and move us to a new state */ -- st_save(&st, unit, hflg, NULL, av); -+ st_save(&st, unit, flg, NULL, av); - - /* - * Now if we are allowing commands to be interrupted, we let ourselves be -@@ -2069,7 +2104,7 @@ process(int catch) - * elsewhere... - */ - if (enterhist || (catch && intty && !whyles && !tellwhat && !arun)) -- savehist(¶ml, enterhist > 1); -+ savehist(¶ml, enterhist > 1 ? HIST_MERGE : 0); - - if (Expand && seterr) - Expand = 0; -@@ -2156,21 +2191,28 @@ process(int catch) - void - dosource(Char **t, struct command *c) - { -+ (void) dosource_flg(t, c, 0); -+} -+ -+int -+dosource_flg(Char **t, struct command *c, int flg) -+{ - Char *f; -- int hflg = 0; - char *file; -+ int fd; -+ int newflg = 0; - - USE(c); - t++; - if (*t && eq(*t, STRmh)) { - if (*++t == NULL) - stderror(ERR_NAME | ERR_HFLAG); -- hflg++; -+ newflg |= HIST_ONLY; - } - else if (*t && eq(*t, STRmm)) { - if (*++t == NULL) - stderror(ERR_NAME | ERR_MFLAG); -- hflg = 2; -+ newflg |= HIST_MERGE; - } - - f = globone(*t++, G_ERROR); -@@ -2178,9 +2220,16 @@ dosource(Char **t, struct command *c) - cleanup_push(file, xfree); - xfree(f); - t = glob_all_or_error(t); -- if ((!srcfile(file, 0, hflg, t)) && (!hflg) && (!bequiet)) -+ fd = srcfile(file, 0, (flg | newflg), t); -+ if ((!fd) && (!newflg) && (!bequiet)) - stderror(ERR_SYSTEM, file, strerror(errno)); -- cleanup_until(file); -+ -+ /* We need to preserve fd and it's cleaning routines on the top of the -+ * cleaning stack. Don't call cleanup_until() but clean it manually. */ -+ cleanup_ignore(file); -+ xfree(file); -+ -+ return fd; /* Valid/invalid file descriptor (>FSAVE, -1). Zero on error. */ - } - - /* -diff --git a/sh.decls.h b/sh.decls.h -index db90288..fb15a01 100644 ---- a/sh.decls.h -+++ b/sh.decls.h -@@ -38,6 +38,7 @@ - */ - extern Char *gethdir (const Char *); - extern void dosource (Char **, struct command *); -+extern int dosource_flg (Char **, struct command *, int); - extern void exitstat (void); - extern void goodbye (Char **, struct command *); - extern void importpath (Char *); -@@ -98,6 +99,7 @@ extern void cleanup_until_mark(void); - extern size_t cleanup_push_mark(void); - extern void cleanup_pop_mark(size_t); - extern void open_cleanup(void *); -+extern void fcntl_cleanup(void *); - extern void opendir_cleanup(void *); - extern void sigint_cleanup(void *); - extern void sigprocmask_cleanup(void *); -@@ -219,7 +221,7 @@ extern struct Hist *enthist (int, struct wordent *, int, int, int); - extern void savehist (struct wordent *, int); - extern char *fmthist (int, ptr_t); - extern void rechist (Char *, int); --extern void loadhist (Char *, int); -+extern int loadhist (Char *, int); - extern void displayHistStats(const char *); - - /* -diff --git a/sh.dol.c b/sh.dol.c -index 45b10e0..2ce7cb5 100644 ---- a/sh.dol.c -+++ b/sh.dol.c -@@ -1110,6 +1110,6 @@ again: - *obp = 0; - tmp = short2str(obuf); - (void) xwrite(0, tmp, strlen (tmp)); -- (void) lseek(0, (off_t) 0, L_SET); -+ (void) lseek(0, (off_t) 0, SEEK_SET); - cleanup_until(&inheredoc); - } -diff --git a/sh.err.c b/sh.err.c -index e157d6a..29d41c3 100644 ---- a/sh.err.c -+++ b/sh.err.c -@@ -514,6 +514,22 @@ open_cleanup(void *xptr) - } - - void -+fcntl_cleanup(void *xptr) -+{ -+ int *ptr; -+ struct flock fl; -+ -+ ptr = xptr; -+ -+ fl.l_type = F_UNLCK; -+ fl.l_whence = SEEK_SET; -+ fl.l_start = 0; -+ fl.l_len = 0; -+ -+ fcntl(*ptr, F_SETLK, &fl); -+} -+ -+void - opendir_cleanup(void *xdir) - { - DIR *dir; -diff --git a/sh.h b/sh.h -index 691add3..4e3f13c 100644 ---- a/sh.h -+++ b/sh.h -@@ -50,6 +50,24 @@ - # include - #endif - -+#include -+#include -+ -+/* -+ * History flags. -+ */ -+#define HIST_ONLY 0x001 -+#define HIST_SAVE 0x002 -+#define HIST_LOAD 0x004 -+#define HIST_REV 0x008 -+#define HIST_CLEAR 0x010 -+#define HIST_MERGE 0x020 -+#define HIST_TIME 0x040 -+#define HIST_FILE_WRLCK 0x080 /* Write lock */ -+#define HIST_FILE_RDLCK 0x100 /* Read lock */ -+#define HIST_FILE_OPEN 0x200 /* Leave file open */ -+#define HIST_FILE_LOCK 0x400 /* Leave file locked */ -+ - #if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && !defined(WINNT_NATIVE) - typedef unsigned long intptr_t; - #endif -diff --git a/sh.hist.c b/sh.hist.c -index 6a12737..7e53c65 100644 ---- a/sh.hist.c -+++ b/sh.hist.c -@@ -44,14 +44,6 @@ Char HistLit = 0; - static int heq (const struct wordent *, const struct wordent *); - static void hfree (struct Hist *); - --#define HIST_ONLY 0x01 --#define HIST_SAVE 0x02 --#define HIST_LOAD 0x04 --#define HIST_REV 0x08 --#define HIST_CLEAR 0x10 --#define HIST_MERGE 0x20 --#define HIST_TIME 0x40 -- - /* - * C shell - */ -@@ -143,7 +135,7 @@ discardExcess(int histlen) - void - savehist( - struct wordent *sp, -- int mflg) /* true if -m (merge) specified */ -+ int flg) - { - int histlen = 0; - Char *cp; -@@ -160,7 +152,7 @@ savehist( - histlen = histlen * 10 + *cp++ - '0'; - } - if (sp) -- (void) enthist(++eventno, sp, 1, mflg, histlen); -+ (void) enthist(++eventno, sp, 1, flg, histlen); - discardExcess(histlen); - } - -@@ -933,7 +925,7 @@ enthist( - int event, /* newly incremented global eventno */ - struct wordent *lp, - int docopy, -- int mflg, /* true if merge requested */ -+ int flg, - int histlen) /* -1 if unknown */ - { - struct Hist *p = NULL, *pp = &Histlist, *pTime = NULL; -@@ -953,7 +945,7 @@ enthist( - Htime = p->Htime; - /* If we are merging, and the old entry is at the place we want - * to insert the new entry, then remember the place. */ -- if (mflg && Htime != 0 && p->Hprev->Htime >= Htime) -+ if ((flg & HIST_MERGE) && Htime != 0 && p->Hprev->Htime >= Htime) - pTime = p->Hprev; - if (!fastMergeErase) - renumberHist(p); /* Reset Href of subsequent entries */ -@@ -1012,7 +1004,7 @@ enthist( - /* The head of history list is the default insertion point. - If merging, advance insertion point, in pp, according to Htime. */ - /* XXX -- In histdup=all, Htime values can be non-monotonic. */ -- if (mflg) { /* merge according to np->Htime */ -+ if (flg & HIST_MERGE) { /* merge according to np->Htime */ - pp = mergeInsertionPoint(np, pTime); - for (p = pp->Hnext; p && p->Htime == np->Htime; pp = p, p = p->Hnext) { - if (heq(&p->Hlex, &np->Hlex)) { -@@ -1051,9 +1043,9 @@ hfree(struct Hist *hp) - } - - PG_STATIC void --phist(struct Hist *hp, int hflg) -+phist(struct Hist *hp, int flg) - { -- if (hflg & HIST_ONLY) { -+ if (flg & HIST_ONLY) { - int old_output_raw; - - /* -@@ -1065,7 +1057,7 @@ phist(struct Hist *hp, int hflg) - old_output_raw = output_raw; - output_raw = 1; - cleanup_push(&old_output_raw, output_raw_restore); -- if (hflg & HIST_TIME) -+ if (flg & HIST_TIME) - /* - * Make file entry with history time in format: - * "+NNNNNNNNNN" (10 digits, left padded with ascii '0') -@@ -1096,7 +1088,7 @@ phist(struct Hist *hp, int hflg) - } - - PG_STATIC void --dophist(int n, int hflg) -+dophist(int n, int flg) - { - struct Hist *hp; - if (setintr) { -@@ -1105,7 +1097,7 @@ dophist(int n, int hflg) - pintr_push_enable(&old_pintr_disabled); - cleanup_until(&old_pintr_disabled); - } -- if ((hflg & HIST_REV) == 0) { -+ if (!(flg & HIST_REV)) { - /* Since the history list is stored most recent first, non-reversing - * print needs to print (backwards) up the list. */ - if ((unsigned)n >= histCount) -@@ -1119,10 +1111,10 @@ dophist(int n, int hflg) - if (hp == NULL) - return; /* nothing to print */ - for (; hp != &Histlist; hp = hp->Hprev) -- phist(hp, hflg); -+ phist(hp, flg); - } else { - for (hp = Histlist.Hnext; n-- > 0 && hp != NULL; hp = hp->Hnext) -- phist(hp, hflg); -+ phist(hp, flg); - } - } - -@@ -1130,7 +1122,7 @@ dophist(int n, int hflg) - void - dohist(Char **vp, struct command *c) - { -- int n, hflg = 0; -+ int n, flg = 0; - - USE(c); - if (getn(varval(STRhistory)) == 0) -@@ -1141,40 +1133,40 @@ dohist(Char **vp, struct command *c) - while (*++vp2) - switch (*vp2) { - case 'c': -- hflg |= HIST_CLEAR; -+ flg |= HIST_CLEAR; - break; - case 'h': -- hflg |= HIST_ONLY; -+ flg |= HIST_ONLY; - break; - case 'r': -- hflg |= HIST_REV; -+ flg |= HIST_REV; - break; - case 'S': -- hflg |= HIST_SAVE; -+ flg |= HIST_SAVE; - break; - case 'L': -- hflg |= HIST_LOAD; -+ flg |= HIST_LOAD; - break; - case 'M': -- hflg |= HIST_MERGE; -+ flg |= HIST_MERGE; - break; - case 'T': -- hflg |= HIST_TIME; -+ flg |= HIST_TIME; - break; - default: - stderror(ERR_HISTUS, "chrSLMT"); - break; - } - } -- if (hflg & HIST_CLEAR) { -+ if (flg & HIST_CLEAR) { - struct Hist *np, *hp; - for (hp = &Histlist; (np = hp->Hnext) != NULL;) - hremove(np), hfree(np); - } - -- if (hflg & (HIST_LOAD | HIST_MERGE)) -- loadhist(*vp, (hflg & HIST_MERGE) ? 1 : 0); -- else if (hflg & HIST_SAVE) -+ if (flg & (HIST_LOAD | HIST_MERGE)) -+ loadhist(*vp, (flg | HIST_FILE_RDLCK)); -+ else if (flg & HIST_SAVE) - rechist(*vp, 1); - else { - if (*vp) -@@ -1182,7 +1174,7 @@ dohist(Char **vp, struct command *c) - else { - n = getn(varval(STRhistory)); - } -- dophist(n, hflg); -+ dophist(n, flg); - } - } - -@@ -1224,8 +1216,8 @@ fmthist(int fmt, ptr_t ptr) - void - rechist(Char *fname, int ref) - { -- Char *snum; -- int fp, ftmp, oldidfds; -+ Char *snum; -+ int fd = -1, ftmp, oldidfds; - struct varent *shist; - static Char *dumphist[] = {STRhistory, STRmhT, 0, 0}; - -@@ -1255,15 +1247,12 @@ rechist(Char *fname, int ref) - * with numerous shells being in simultaneous use. Imagine - * any kind of window system. All these shells 'share' the same - * ~/.history file for recording their command line history. -- * Currently the automatic merge can only succeed when the shells -- * nicely quit one after another. - * -- * Users that like to nuke their environment require here an atomic -- * loadhist-creat-dohist(dumphist)-close -- * sequence. -- * -- * jw. -- */ -+ * Atomic merge loadhist-creat/ftrunc-dohist(dumphist)-close -+ * implemented using fcntl (shared readers, exclusive writer) -+ * by Vojtech Vitek (V-Teq) . -+ */ -+ - /* - * We need the didfds stuff before loadhist otherwise - * exec in a script will fail to print if merge is set. -@@ -1271,32 +1260,42 @@ rechist(Char *fname, int ref) - */ - oldidfds = didfds; - didfds = 0; -- if ((shist = adrof(STRsavehist)) != NULL && shist->vec != NULL) -- if (shist->vec[1] && eq(shist->vec[1], STRmerge)) -- loadhist(fname, 1); -- -- fp = xcreat(short2str(fname), 0600); -- cleanup_until(fname); -- if (fp == -1) { -- didfds = oldidfds; -- return; -+ if (((shist = adrof(STRsavehist)) != NULL && shist->vec != NULL) && -+ (shist->vec[1] && eq(shist->vec[1], STRmerge))) { -+ /* Read .history file, leave it's fd open for writing. */ -+ fd = loadhist(fname, HIST_MERGE|HIST_FILE_WRLCK|HIST_FILE_OPEN|HIST_FILE_LOCK); -+ if (fd > 0) { -+ /* Truncate the .history file. */ -+ (void) ftruncate(fd, 0); -+ (void) lseek(fd, (off_t) 0, SEEK_SET); -+ } -+ } -+ if (fd <= 0) { -+ /* Open .history file for writing (if not open yet). */ -+ fd = xopen(short2str(fname), O_LARGEFILE|O_CREAT|O_WRONLY|O_TRUNC, 0600); -+ if (fd != -1) -+ cleanup_push(&fd, open_cleanup); -+ } -+ if (fd != -1) { -+ ftmp = SHOUT; -+ SHOUT = fd; -+ dumphist[2] = snum; -+ /* Write history to the .history file. */ -+ dohist(dumphist, NULL); -+ SHOUT = ftmp; - } -- ftmp = SHOUT; -- SHOUT = fp; -- dumphist[2] = snum; -- dohist(dumphist, NULL); -- xclose(fp); -- SHOUT = ftmp; - didfds = oldidfds; -+ cleanup_until(fname); - } - - - /* This is the entry point for loading history data from a file. */ --void --loadhist(Char *fname, int mflg) -+int -+loadhist(Char *fname, int flg) - { - static Char *loadhist_cmd[] = {STRsource, NULL, NULL, NULL}; -- loadhist_cmd[1] = mflg ? STRmm : STRmh; -+ int fd; -+ loadhist_cmd[1] = (flg & HIST_MERGE) ? STRmm : STRmh; - - if (fname != NULL) - loadhist_cmd[2] = fname; -@@ -1305,15 +1304,17 @@ loadhist(Char *fname, int mflg) - else - loadhist_cmd[2] = STRtildothist; - -- dosource(loadhist_cmd, NULL); -+ fd = dosource_flg(loadhist_cmd, NULL, flg); - -- /* During history merging (enthist sees mflg set), we disable management of -- * Hnum and Href (because fastMergeErase is true). So now reset all the -+ /* During history merging (enthist sees merge flag), we disable management -+ * of Hnum and Href (because fastMergeErase is true). So now reset all the - * values based on the final ordering of the history list. */ -- if (mflg) { -+ if (flg & HIST_MERGE) { - int n = eventno; - struct Hist *hp = &Histlist; - while ((hp = hp->Hnext)) - hp->Hnum = hp->Href = n--; - } -+ -+ return fd; /* Valid/invalid file descriptor (>FSAVE, -1). Zero on error. */ - } -diff --git a/sh.lex.c b/sh.lex.c -index 80643f7..57ec7a9 100644 ---- a/sh.lex.c -+++ b/sh.lex.c -@@ -1595,7 +1595,7 @@ wide_read(int fildes, Char *buf, size_t nchars, int use_fclens) - /* Throwing away possible partial multibyte characters on error if the - stream is not seekable */ - err = errno; -- lseek(fildes, -(off_t)partial, L_INCR); -+ lseek(fildes, -(off_t)partial, SEEK_CUR); - errno = err; - return res != 0 ? res : r; - } -@@ -1610,7 +1610,7 @@ bgetc(void) - if (cantell) { - if (fseekp < fbobp || fseekp > feobp) { - fbobp = feobp = fseekp; -- (void) lseek(SHIN, fseekp, L_SET); -+ (void) lseek(SHIN, fseekp, SEEK_SET); - } - if (fseekp == feobp) { - #ifdef WIDE_STRINGS -@@ -1814,7 +1814,7 @@ btell(struct Ain *l) - void - btoeof(void) - { -- (void) lseek(SHIN, (off_t) 0, L_XTND); -+ (void) lseek(SHIN, (off_t) 0, SEEK_END); - aret = TCSH_F_SEEK; - fseekp = feobp; - alvec = NULL; -@@ -1832,7 +1832,7 @@ settell(void) - cantell = 0; - if (arginp || onelflg || intty) - return; -- if ((x = lseek(SHIN, (off_t) 0, L_INCR)) == -1) -+ if ((x = lseek(SHIN, (off_t) 0, SEEK_CUR)) == -1) - return; - fbuf = xcalloc(2, sizeof(Char **)); - fblocks = 1; -diff --git a/sh.sem.c b/sh.sem.c -index c880974..bc51b50 100644 ---- a/sh.sem.c -+++ b/sh.sem.c -@@ -892,7 +892,7 @@ doio(struct command *t, int *pipein, int *pipeout) - fd = xopen(tmp, O_WRONLY|O_APPEND|O_LARGEFILE); - #else /* !O_APPEND */ - fd = xopen(tmp, O_WRONLY|O_LARGEFILE); -- (void) lseek(fd, (off_t) 0, L_XTND); -+ (void) lseek(fd, (off_t) 0, SEEK_END); - #endif /* O_APPEND */ - } - else --- -1.9.3 - diff --git a/tcsh-6.18.00-history-merge.patch b/tcsh-6.18.00-history-merge.patch deleted file mode 100644 index e56e910..0000000 --- a/tcsh-6.18.00-history-merge.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 1c6ae703b3ecd79427572d3f2741e034e07a7267 Mon Sep 17 00:00:00 2001 -From: Fridolin Pokorny -Date: Wed, 27 Aug 2014 13:52:59 +0200 -Subject: [PATCH 10/14] merge histlist properly - -Resolves: #919452 - ---- - sh.hist.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/sh.hist.c b/sh.hist.c -index 7e53c65..2e47eaa 100644 ---- a/sh.hist.c -+++ b/sh.hist.c -@@ -99,7 +99,7 @@ hremove(struct Hist *hp) - - /* Prune length of history list to specified size by history variable. */ - PG_STATIC void --discardExcess(int histlen) -+discardExcess(int histlen, int flg) - { - struct Hist *hp, *np; - if (histTail == NULL) { -@@ -110,13 +110,13 @@ discardExcess(int histlen) - * the list is still too long scan the whole list as before. But only do a - * full scan if the list is more than 6% (1/16th) too long. */ - while (histCount > (unsigned)histlen && (np = Histlist.Hnext)) { -- if (eventno - np->Href >= histlen || histlen == 0) -+ if ((eventno - np->Href >= histlen || histlen == 0) && ! (flg & HIST_MERGE)) - hremove(np), hfree(np); - else - break; - } - while (histCount > (unsigned)histlen && (np = histTail) != &Histlist) { -- if (eventno - np->Href >= histlen || histlen == 0) -+ if ((eventno - np->Href >= histlen || histlen == 0) || flg & HIST_MERGE) - hremove(np), hfree(np); - else - break; -@@ -153,7 +153,7 @@ savehist( - } - if (sp) - (void) enthist(++eventno, sp, 1, flg, histlen); -- discardExcess(histlen); -+ discardExcess(histlen, flg); - } - - #define USE_JENKINS_HASH 1 --- -1.9.3 - diff --git a/tcsh-6.18.01-elf-interpreter.patch b/tcsh-6.18.01-elf-interpreter.patch index c842525..a583f13 100644 --- a/tcsh-6.18.01-elf-interpreter.patch +++ b/tcsh-6.18.01-elf-interpreter.patch @@ -5,60 +5,14 @@ Subject: [PATCH 12/14] report missing ELF interpreter Resolves: #711066 +Adjusted for tcsh-6.19.00 by Fridolin Pokorny + --- - config.h.in | 6 +++ configure.in | 5 ++- sh.err.c | 4 +- sh.exec.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 3 deletions(-) -diff --git a/config.h.in b/config.h.in -index 0ba48c4..9fb2921 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -36,6 +36,9 @@ - /* Define to 1 if you have the `dup2' function. */ - #undef HAVE_DUP2 - -+/* Define to 1 if you have the header file. */ -+#undef HAVE_ELF_H -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_FEATURES_H - -@@ -96,6 +99,9 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_PATHS_H - -+/* Define to 1 if you have the `pread' function. */ -+#undef HAVE_PREAD -+ - /* Define to 1 if you have the `sbrk' function. */ - #undef HAVE_SBRK - -diff --git a/configure.in b/configure.in -index ef330a2..8303bd4 100644 ---- a/configure.in -+++ b/configure.in -@@ -306,7 +306,7 @@ AC_SEARCH_LIBS(catgets, catgets) - AM_ICONV - - dnl Checks for header files --AC_CHECK_HEADERS([auth.h crypt.h features.h inttypes.h paths.h] dnl -+AC_CHECK_HEADERS([auth.h crypt.h elf.h features.h inttypes.h paths.h] dnl - [shadow.h stdint.h utmp.h utmpx.h]) - AC_CHECK_HEADERS([wchar.h], - [AC_CHECK_SIZEOF([wchar_t], [], [dnl -@@ -388,7 +388,8 @@ AC_CHECK_FUNC([setlocale], [have_setlocale=yes], [have_setlocale=no]) - AC_CHECK_FUNC([catgets], [have_catgets=yes], [have_catgets=no]) - AC_CHECK_FUNCS([dup2 getauthid getcwd gethostname getpwent] dnl - [getutent getutxent mallinfo memmove memset mkstemp nice] dnl -- [nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth]) -+ [nl_langinfo pread sbrk setpgid setpriority strerror strstr] dnl -+ [sysconf wcwidth]) - AC_FUNC_GETPGRP - AC_FUNC_MBRTOWC - if test "x${cross_compiling}" != xyes ; then diff --git a/sh.err.c b/sh.err.c index 29d41c3..262f9bf 100644 --- a/sh.err.c diff --git a/tcsh-6.18.01-introduce-tcsh_posix_status.patch b/tcsh-6.18.01-introduce-tcsh_posix_status.patch index d8ddd40..d91e80e 100644 --- a/tcsh-6.18.01-introduce-tcsh_posix_status.patch +++ b/tcsh-6.18.01-introduce-tcsh_posix_status.patch @@ -18,6 +18,8 @@ the upstream supported $anyerror. Resolves: #1129703 Related: #759132 +Adjusted for tcsh-6.19.00 by Fridolin Pokorny + --- sh.c | 2 ++ sh.h | 1 + @@ -28,10 +30,10 @@ Related: #759132 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/sh.c b/sh.c -index f897317..498bf25 100644 +index b760f04..242556a 100644 --- a/sh.c +++ b/sh.c -@@ -354,6 +354,8 @@ main(int argc, char **argv) +@@ -355,6 +355,8 @@ main(int argc, char **argv) anyerror = 1; /* for compatibility */ setcopy(STRanyerror, STRNULL, VAR_READWRITE); @@ -39,6 +41,7 @@ index f897317..498bf25 100644 + /* Default history size to 100 */ setcopy(STRhistory, str2short("100"), VAR_READWRITE); + sethistory(100); diff --git a/sh.h b/sh.h index 4e3f13c..74b7719 100644 diff --git a/tcsh-6.18.01-repeated-words-man.patch b/tcsh-6.18.01-repeated-words-man.patch deleted file mode 100644 index 23a8e34..0000000 --- a/tcsh-6.18.01-repeated-words-man.patch +++ /dev/null @@ -1,36 +0,0 @@ -From f98a29af2d74816aa1711d64c7280d4115f83d3f Mon Sep 17 00:00:00 2001 -From: Fridolin Pokorny -Date: Wed, 27 Aug 2014 13:54:20 +0200 -Subject: [PATCH 11/14] Removed repeated words in man - -Resolves: #948884 - ---- - tcsh.man | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tcsh.man b/tcsh.man -index de8be03..8cc45c8 100644 ---- a/tcsh.man -+++ b/tcsh.man -@@ -1401,7 +1401,7 @@ The \fBglobstar\fR shell variable can be set to allow `**' or `***' as - a file glob pattern that matches any string of characters including `/', - recursively traversing any existing sub-directories. For example, - `ls **.c' will list all the .c files in the current directory tree. --If used by itself, it will match match zero or more sub-directories -+If used by itself, it will match zero or more sub-directories - (e.g. `ls /usr/include/**/time.h' will list any file named `time.h' - in the /usr/include directory tree; `ls /usr/include/**time.h' will match - any file in the /usr/include directory tree ending in `time.h'; and -@@ -3887,7 +3887,7 @@ with `.' except for `.' and `..' - If set, the `**' and `***' file glob patterns will match any string of - characters including `/' traversing any existing sub-directories. (e.g. - `ls **.c' will list all the .c files in the current directory tree). --If used by itself, it will match match zero or more sub-directories -+If used by itself, it will match zero or more sub-directories - (e.g. `ls /usr/include/**/time.h' will list any file named `time.h' - in the /usr/include directory tree; whereas `ls /usr/include/**time.h' - will match any file in the /usr/include directory tree ending in `time.h'). --- -1.9.3 - diff --git a/tcsh-6.18.01-reverse-history-handling-in-loops.patch b/tcsh-6.18.01-reverse-history-handling-in-loops.patch deleted file mode 100644 index 3149b73..0000000 --- a/tcsh-6.18.01-reverse-history-handling-in-loops.patch +++ /dev/null @@ -1,196 +0,0 @@ -From 598b93bd179a98d0cf09bac7645e8f8e11af6b44 Mon Sep 17 00:00:00 2001 -From: Roman Kollar -Date: Fri, 12 Oct 2012 13:40:12 +0200 -Subject: [PATCH 14/14] Reverse patch for history handling in loops - -Originally reported at Red Hat Bugzilla: -https://bugzilla.redhat.com/show_bug.cgi?id=814069 - -Reverse patch for commit 23a51b0a709628af57729a07cbbfae3c95e98e6f in the upstream repo - -Adjusted by Jaromir Koncicky (jkoncick) to fit with version 6.18.01 - ---- - sh.func.c | 134 +------------------------------------------------------------- - 1 file changed, 1 insertion(+), 133 deletions(-) - -diff --git a/sh.func.c b/sh.func.c -index 869de12..61ef84c 100644 ---- a/sh.func.c -+++ b/sh.func.c -@@ -61,7 +61,6 @@ static void doagain (void); - static const char *isrchx (int); - static void search (int, int, Char *); - static int getword (struct Strbuf *); --static struct wordent *histgetword (struct wordent *); - static void toend (void); - static void xecho (int, Char **); - static int islocale_var (Char *); -@@ -754,7 +753,6 @@ search(int type, int level, Char *goal) - { - struct Strbuf word = Strbuf_INIT; - Char *cp; -- struct wordent *histent = NULL, *ohistent = NULL; - - Stype = type; - Sgoal = goal; -@@ -767,28 +765,12 @@ search(int type, int level, Char *goal) - } - cleanup_push(&word, Strbuf_cleanup); - do { -- -- if (intty) { -- histent = xmalloc(sizeof(*histent)); -- ohistent = xmalloc(sizeof(*histent)); -- ohistent->word = STRNULL; -- ohistent->next = histent; -- histent->prev = ohistent; -- } -- - if (intty && fseekp == feobp && aret == TCSH_F_SEEK) - printprompt(1, isrchx(type == TC_BREAK ? zlast : type)); - /* xprintf("? "), flush(); */ - (void) getword(&word); - Strbuf_terminate(&word); - -- if (intty && Strlen(word.s) > 0) { -- histent->word = Strsave(word.s); -- histent->next = xmalloc(sizeof(*histent)); -- histent->next->prev = histent; -- histent = histent->next; -- } -- - switch (srchx(word.s)) { - - case TC_ELSE: -@@ -864,126 +846,12 @@ search(int type, int level, Char *goal) - level = -1; - break; - } -- if (intty) { -- ohistent->prev = histgetword(histent); -- ohistent->prev->next = ohistent; -- savehist(ohistent, 0); -- freelex(ohistent); -- xfree(ohistent); -- } else -- (void) getword(NULL); -+ (void) getword(NULL); - } while (level >= 0); - end: - cleanup_until(&word); - } - --static struct wordent * --histgetword(struct wordent *histent) --{ -- int found = 0, first; -- eChar c, d; -- int e; -- struct Strbuf *tmp; -- tmp = xmalloc(sizeof(*tmp)); -- tmp->size = 0; -- tmp->s = NULL; -- c = readc(1); -- d = 0; -- e = 0; -- for (;;) { -- tmp->len = 0; -- Strbuf_terminate (tmp); -- while (c == ' ' || c == '\t') -- c = readc(1); -- if (c == '#') -- do -- c = readc(1); -- while (c != CHAR_ERR && c != '\n'); -- if (c == CHAR_ERR) -- goto past; -- if (c == '\n') -- goto nl; -- unreadc(c); -- found = 1; -- first = 1; -- do { -- e = (c == '\\'); -- c = readc(1); -- if (c == '\\' && !e) { -- if ((c = readc(1)) == '\n') { -- e = 1; -- c = ' '; -- } else { -- unreadc(c); -- c = '\\'; -- } -- } -- if ((c == '\'' || c == '"') && !e) { -- if (d == 0) -- d = c; -- else if (d == c) -- d = 0; -- } -- if (c == CHAR_ERR) -- goto past; -- -- Strbuf_append1(tmp, (Char) c); -- -- if (!first && !d && c == '(' && !e) { -- break; -- } -- first = 0; -- } while (d || e || (c != ' ' && c != '\t' && c != '\n')); -- tmp->len--; -- if (tmp->len) { -- Strbuf_terminate(tmp); -- histent->word = Strsave(tmp->s); -- histent->next = xmalloc(sizeof (*histent)); -- histent->next->prev = histent; -- histent = histent->next; -- } -- if (c == '\n') { -- nl: -- tmp->len = 0; -- Strbuf_append1(tmp, (Char) c); -- Strbuf_terminate(tmp); -- histent->word = Strsave(tmp->s); -- return histent; -- } -- } -- --past: -- switch (Stype) { -- -- case TC_IF: -- stderror(ERR_NAME | ERR_NOTFOUND, "then/endif"); -- break; -- -- case TC_ELSE: -- stderror(ERR_NAME | ERR_NOTFOUND, "endif"); -- break; -- -- case TC_BRKSW: -- case TC_SWITCH: -- stderror(ERR_NAME | ERR_NOTFOUND, "endsw"); -- break; -- -- case TC_BREAK: -- stderror(ERR_NAME | ERR_NOTFOUND, "end"); -- break; -- -- case TC_GOTO: -- setname(short2str(Sgoal)); -- stderror(ERR_NAME | ERR_NOTFOUND, "label"); -- break; -- -- default: -- break; -- } -- /* NOTREACHED */ -- return NULL; --} -- - static int - getword(struct Strbuf *wp) - { --- -1.9.3 - diff --git a/tcsh-6.18.01-skip-tty-tests.patch b/tcsh-6.18.01-skip-tty-tests.patch index 69d5c26..2e1e3d7 100644 --- a/tcsh-6.18.01-skip-tty-tests.patch +++ b/tcsh-6.18.01-skip-tty-tests.patch @@ -6,6 +6,8 @@ Subject: [PATCH 15/15] Skip tests unable to run without tty Upstream thread: http://mx.gw.com/pipermail/tcsh-bugs/2014-August/000896.html +Adjusted for tcsh-6.19.00 by Fridolin Pokorny + --- tests/commands.at | 2 +- tests/lexical.at | 2 +- @@ -13,23 +15,23 @@ http://mx.gw.com/pipermail/tcsh-bugs/2014-August/000896.html 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/commands.at b/tests/commands.at -index b2f0955..f5c3cbd 100644 +index 4ca5a0e..cdadb92 100644 --- a/tests/commands.at +++ b/tests/commands.at -@@ -1203,7 +1203,7 @@ AT_SETUP([source]) +@@ -1205,7 +1205,7 @@ AT_SETUP([source]) AT_DATA([script.csh], [[set var=$1 ]]) --AT_CHECK([[tcsh -f -c 'source -h script.csh foo; history' \ +-AT_CHECK([[tcsh -i -f -c 'source -h script.csh foo; history' \ +AT_CHECK([[test -t 0 || exit 77 ; tcsh -f -c 'source -h script.csh foo; history' \ | sed 's/ [^ ]* / TIME /']], , [ 1 TIME source -h script.csh foo ; history 2 TIME set var=$1 diff --git a/tests/lexical.at b/tests/lexical.at -index f5b1b0f..d15d6b0 100644 +index 885a940..e618578 100644 --- a/tests/lexical.at +++ b/tests/lexical.at -@@ -33,7 +33,7 @@ AT_SETUP([Comments]) +@@ -35,7 +35,7 @@ AT_CHECK([if [ ! -t 0 ]; then exit 77; fi],, [Skipping comment tests]) AT_CHECK([echo 'echo OK@%:@comment' | tcsh -f], , [OK ]) @@ -39,12 +41,12 @@ index f5b1b0f..d15d6b0 100644 ]) diff --git a/tests/variables.at b/tests/variables.at -index 424e4da..d6dd6e7 100644 +index b20dfac..3354061 100644 --- a/tests/variables.at +++ b/tests/variables.at -@@ -319,7 +319,7 @@ AT_CLEANUP +@@ -343,7 +343,7 @@ AT_SETUP([$ edit]) - AT_SETUP([$ edit]) + AT_CHECK([if [ ! -t 0 ]; then exit 77; fi],, [Skipping $edit tests]) -AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], , +AT_CHECK([test -t 0 || exit 77 ; TERM=something tcsh -f -c 'echo $?edit'], , diff --git a/tcsh-6.18.01-wait-hang.patch b/tcsh-6.18.01-wait-hang.patch deleted file mode 100644 index 24aff3a..0000000 --- a/tcsh-6.18.01-wait-hang.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 788faac41b56f8b08e60f3456ad56c5a36fffa4c Mon Sep 17 00:00:00 2001 -From: Pavel Raiskup -Date: Tue, 27 Jan 2015 07:05:26 +0100 -Subject: [PATCH 16/16] tcsh: fix 'wait' hang - -Make sure that SIGCHLD is blocked before we call -handle_pending_signals() for the first time and before we actually -check for pp->p_flags & PRUNNING to make sure that the SIGCHLD is -not leaked meanwhile. - -Resolves: rhbz#1181685 - ---- - Fixes | 4 ++++ - sh.proc.c | 26 +++++++++++++++++++++++++- - 2 files changed, 29 insertions(+), 1 deletion(-) - -diff --git a/Fixes b/Fixes -index 8eac9d4..56915a9 100644 ---- a/Fixes -+++ b/Fixes -@@ -1,3 +1,7 @@ -+ 29. Pavel Raiskup fix hang with: -+ while (1) -+ ( date & ; wait ) -+ end - 6. V6.18.01 - 20120214 - 5. fix interruptible wait again - 4. ignore bogus compiler overflow message -diff --git a/sh.proc.c b/sh.proc.c -index e32ebda..0c5fc25 100644 ---- a/sh.proc.c -+++ b/sh.proc.c -@@ -593,22 +593,44 @@ void - dowait(Char **v, struct command *c) - { - struct process *pp; -+ -+ /* the current block mask to be able to restore */ -+ sigset_t old_mask; -+ -+ /* block mask for critical section: OLD_MASK U {SIGCHLD} */ -+ sigset_t block_mask; -+ -+ /* ignore those during blocking sigsuspend: -+ OLD_MASK / {SIGCHLD, possibly(SIGINT)} */ - sigset_t pause_mask; -+ - int opintr_disabled, gotsig; - - USE(c); - USE(v); - pjobs++; -+ - sigprocmask(SIG_BLOCK, NULL, &pause_mask); - sigdelset(&pause_mask, SIGCHLD); - if (setintr) - sigdelset(&pause_mask, SIGINT); -+ -+ /* critical section, block also SIGCHLD */ -+ sigprocmask(SIG_BLOCK, NULL, &block_mask); -+ sigaddset(&block_mask, SIGCHLD); -+ sigprocmask(SIG_BLOCK, &block_mask, &old_mask); -+ -+ /* detect older SIGCHLDs and remove PRUNNING flag from proclist */ -+ (void)handle_pending_signals(); -+ - loop: - for (pp = proclist.p_next; pp; pp = pp->p_next) - if (pp->p_procid && /* pp->p_procid == pp->p_jobid && */ - pp->p_flags & PRUNNING) { -- (void)handle_pending_signals(); -+ /* wait for (or pick up alredy blocked) SIGCHLD */ - sigsuspend(&pause_mask); -+ -+ /* make the 'wait' interuptable by CTRL-C */ - opintr_disabled = pintr_disabled; - pintr_disabled = 0; - gotsig = handle_pending_signals(); -@@ -618,6 +640,8 @@ loop: - goto loop; - } - pjobs = 0; -+ -+ sigprocmask(SIG_SETMASK, &old_mask, NULL); - } - - /* --- -2.1.0 - diff --git a/tcsh.spec b/tcsh.spec index 96c0c4e..012ead1 100644 --- a/tcsh.spec +++ b/tcsh.spec @@ -1,37 +1,24 @@ Summary: An enhanced version of csh, the C shell Name: tcsh -Version: 6.18.01 -Release: 13%{?dist} +Version: 6.19.00 +Release: 1%{?dist} License: BSD Group: System Environment/Shells -Source: http://ftp.funet.fi/pub/unix/shells/tcsh/%{name}-%{version}.tar.gz +Source: ftp://ftp.astron.com/pub/tcsh/%{name}-%{version}.tar.gz # Those patches should be given in git format-patch (no need to comment here) Patch1: tcsh-6.15.00-closem.patch -Patch2: tcsh-6.14.00-tinfo.patch Patch3: tcsh-6.14.00-unprintable.patch Patch4: tcsh-6.15.00-hist-sub.patch Patch8: tcsh-6.14.00-syntax.patch Patch9: tcsh-6.13.00-memoryuse.patch Patch11: tcsh-6.14.00-order.patch -# Proposed upstream - http://github.com/tcsh-org/tcsh/pull/1 -Patch28: tcsh-6.17.00-manpage-spelling.patch -# Proposed upstream - http://github.com/tcsh-org/tcsh/pull/2 -Patch31: tcsh-6.18.00-history-file-locking.patch -Patch33: tcsh-6.18.00-history-merge.patch -Patch34: tcsh-6.18.01-repeated-words-man.patch # Proposed upstream - http://mx.gw.com/pipermail/tcsh-bugs/2013-April/000833.html Patch35: tcsh-6.18.01-elf-interpreter.patch Patch36: tcsh-6.18.01-introduce-tcsh_posix_status.patch -Patch37: tcsh-6.18.01-reverse-history-handling-in-loops.patch Patch38: tcsh-6.18.01-skip-tty-tests.patch -# wait hang fix -# ~> #1181685 -# ~> upstream: git diff 9178ceb5..0d8de594 -Patch39: tcsh-6.18.01-wait-hang.patch - Provides: csh = %{version} Provides: /bin/tcsh, /bin/csh Requires(post): grep @@ -136,6 +123,22 @@ fi %changelog +* Wed May 27 2015 Fridolin Pokorny - 6.19.00-01 +- Update to tcsh-6.18.01 +- Drop tcsh-6.14.00-tinfo.patch, not used anymore +- Drop tcsh-6.17.00-manpage-spelling.patch, accepted by upstream +- Drop tcsh-6.18.00-history-file-locking.patch, upstream introduced own history + file locking +- Drop tcsh-6.18.00-history-merge.patch to respect upstream history handling +- Drop tcsh-6.18.01-repeated-words-man.patch, accepted by upstream +- Adjust tcsh-6.15.00-hist-sub.patch to merge new release +- Adjust tcsh-6.18.01-elf-interpreter.patch to merge new release +- Adjust tcsh-6.18.01-introduce-tcsh_posix_status.patch to merge new release +- Remove tcsh-6.18.01-reverse-history-handling-in-loops.patch, issue does not + occur anymore +- Adjust tcsh-6.18.01-skip-tty-tests.patch to merge new release +- Remove tcsh-6.18.01-wait-hang.patch, accepted by upstream + * Tue Jan 27 2015 Pavel Raiskup - 6.18.01-13 - fix 'wait' built-in hang (#1181685) - call %%autosetup after iconv, this avoids having uncommitted changes in