summaryrefslogtreecommitdiffstats
path: root/tcsh-6.18.00-history-file-locking.patch
diff options
context:
space:
mode:
authorFridolin Pokorny <fpokorny@redhat.com>2013-03-28 13:22:02 +0100
committerFridolin Pokorny <fpokorny@redhat.com>2013-03-28 13:22:02 +0100
commitbed5d53e2507471a02fbec9aa0467c50bb3ad0d5 (patch)
treefaedd290e84179ae8037b7fca779c2709df29114 /tcsh-6.18.00-history-file-locking.patch
parentf379b9341b36f8053316fa1609a1c234473737c5 (diff)
downloadtcsh-rebase-6.19.00-bed5d53e2507471a02fbec9aa0467c50bb3ad0d5.tar.gz
tcsh-rebase-6.19.00-bed5d53e2507471a02fbec9aa0467c50bb3ad0d5.tar.xz
tcsh-rebase-6.19.00-bed5d53e2507471a02fbec9aa0467c50bb3ad0d5.zip
Fix history problems (#879371 and #919452), histlist length reflects $savehist
Diffstat (limited to 'tcsh-6.18.00-history-file-locking.patch')
-rw-r--r--tcsh-6.18.00-history-file-locking.patch97
1 files changed, 46 insertions, 51 deletions
diff --git a/tcsh-6.18.00-history-file-locking.patch b/tcsh-6.18.00-history-file-locking.patch
index d68c7ab..83cd5e4 100644
--- a/tcsh-6.18.00-history-file-locking.patch
+++ b/tcsh-6.18.00-history-file-locking.patch
@@ -7,21 +7,17 @@ Originally reported at Red Hat Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=648592
Patch by Vojtech Vitek (V-Teq) <vvitek@redhat.com>
+
+Additional changes reflecting:
+https://bugzilla.redhat.com/show_bug.cgi?id=879371
+
+Changes by Fridolin Pokorny <fpokorny@redhat.com>
+
---
- sh.c | 103 +++++++++++++++++++++++++++++++++++-------------
- 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, 185 insertions(+), 99 deletions(-)
-diff --git a/sh.c b/sh.c
-index dcd9116..7f03077 100644
---- a/sh.c
-+++ b/sh.c
+diff -upr tcsh-6.18.00_orig/sh.c tcsh-6.18.00_work/sh.c
+--- tcsh-6.18.00_orig/sh.c 2013-03-28 10:06:17.969859477 +0100
++++ tcsh-6.18.00_work/sh.c 2013-03-28 10:07:21.155082032 +0100
@@ -140,6 +140,7 @@ struct saved_state {
int cantell;
struct Bin B;
@@ -120,7 +116,7 @@ index dcd9116..7f03077 100644
}
-@@ -1544,7 +1574,7 @@ srcfile(const char *f, int onlyown, int flag, Char **av)
+@@ -1544,7 +1574,7 @@ srcfile(const char *f, int onlyown, int
* fd.
*/
static void
@@ -129,7 +125,7 @@ index dcd9116..7f03077 100644
{
st->insource = insource;
st->SHIN = SHIN;
-@@ -1593,10 +1623,14 @@ st_save(struct saved_state *st, int unit, int hflg, Char **al, Char **av)
+@@ -1593,10 +1623,14 @@ st_save(struct saved_state *st, int unit
st->onelflg = onelflg;
st->enterhist = enterhist;
st->justpr = justpr;
@@ -145,7 +141,7 @@ index dcd9116..7f03077 100644
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)
+@@ -1635,7 +1669,7 @@ st_save(struct saved_state *st, int unit
evalp = 0;
alvec = al;
alvecp = 0;
@@ -173,7 +169,7 @@ index dcd9116..7f03077 100644
{
struct saved_state st;
-@@ -1730,7 +1765,7 @@ srcunit(int unit, int onlyown, int hflg, Char **av)
+@@ -1730,7 +1765,7 @@ srcunit(int unit, int onlyown, int hflg,
}
/* Save the current state and move us to a new state */
@@ -182,6 +178,15 @@ index dcd9116..7f03077 100644
/*
* 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(&paraml, enterhist > 1);
++ savehist(&paraml, enterhist > 1 ? HIST_MERGE : 0);
+
+ if (Expand && seterr)
+ Expand = 0;
@@ -2156,21 +2191,28 @@ process(int catch)
void
dosource(Char **t, struct command *c)
@@ -233,10 +238,9 @@ index dcd9116..7f03077 100644
}
/*
-diff --git a/sh.decls.h b/sh.decls.h
-index db90288..fb15a01 100644
---- a/sh.decls.h
-+++ b/sh.decls.h
+diff -upr tcsh-6.18.00_orig/sh.decls.h tcsh-6.18.00_work/sh.decls.h
+--- tcsh-6.18.00_orig/sh.decls.h 2013-03-28 10:06:17.988859538 +0100
++++ tcsh-6.18.00_work/sh.decls.h 2013-03-28 10:06:42.897948590 +0100
@@ -38,6 +38,7 @@
*/
extern Char *gethdir (const Char *);
@@ -253,7 +257,7 @@ index db90288..fb15a01 100644
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);
+@@ -219,7 +221,7 @@ extern struct Hist *enthist (int, str
extern void savehist (struct wordent *, int);
extern char *fmthist (int, ptr_t);
extern void rechist (Char *, int);
@@ -262,10 +266,9 @@ index db90288..fb15a01 100644
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
+diff -upr tcsh-6.18.00_orig/sh.dol.c tcsh-6.18.00_work/sh.dol.c
+--- tcsh-6.18.00_orig/sh.dol.c 2013-03-28 10:06:17.988859538 +0100
++++ tcsh-6.18.00_work/sh.dol.c 2013-03-28 10:06:42.898948594 +0100
@@ -1110,6 +1110,6 @@ again:
*obp = 0;
tmp = short2str(obuf);
@@ -274,10 +277,9 @@ index 45b10e0..2ce7cb5 100644
+ (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
+diff -upr tcsh-6.18.00_orig/sh.err.c tcsh-6.18.00_work/sh.err.c
+--- tcsh-6.18.00_orig/sh.err.c 2013-03-28 10:06:17.972859480 +0100
++++ tcsh-6.18.00_work/sh.err.c 2013-03-28 10:06:42.824948331 +0100
@@ -514,6 +514,22 @@ open_cleanup(void *xptr)
}
@@ -301,10 +303,9 @@ index e157d6a..29d41c3 100644
opendir_cleanup(void *xdir)
{
DIR *dir;
-diff --git a/sh.h b/sh.h
-index 691add3..4e3f13c 100644
---- a/sh.h
-+++ b/sh.h
+diff -upr tcsh-6.18.00_orig/sh.h tcsh-6.18.00_work/sh.h
+--- tcsh-6.18.00_orig/sh.h 2013-03-28 10:06:17.988859538 +0100
++++ tcsh-6.18.00_work/sh.h 2013-03-28 10:06:42.899948597 +0100
@@ -50,6 +50,24 @@
# include <inttypes.h>
#endif
@@ -330,10 +331,9 @@ index 691add3..4e3f13c 100644
#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
+diff -upr tcsh-6.18.00_orig/sh.hist.c tcsh-6.18.00_work/sh.hist.c
+--- tcsh-6.18.00_orig/sh.hist.c 2013-03-28 10:06:17.967859465 +0100
++++ tcsh-6.18.00_work/sh.hist.c 2013-03-28 10:06:42.815948309 +0100
@@ -44,14 +44,6 @@ Char HistLit = 0;
static int heq (const struct wordent *, const struct wordent *);
static void hfree (struct Hist *);
@@ -631,11 +631,10 @@ index 6a12737..7e53c65 100644
+
+ 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)
+diff -upr tcsh-6.18.00_orig/sh.lex.c tcsh-6.18.00_work/sh.lex.c
+--- tcsh-6.18.00_orig/sh.lex.c 2013-03-28 10:06:17.971859478 +0100
++++ tcsh-6.18.00_work/sh.lex.c 2013-03-28 10:06:42.820948316 +0100
+@@ -1595,7 +1595,7 @@ wide_read(int fildes, Char *buf, size_t
/* Throwing away possible partial multibyte characters on error if the
stream is not seekable */
err = errno;
@@ -671,11 +670,10 @@ index 80643f7..57ec7a9 100644
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)
+diff -upr tcsh-6.18.00_orig/sh.sem.c tcsh-6.18.00_work/sh.sem.c
+--- tcsh-6.18.00_orig/sh.sem.c 2013-03-28 10:06:17.970859477 +0100
++++ tcsh-6.18.00_work/sh.sem.c 2013-03-28 10:06:42.819948308 +0100
+@@ -892,7 +892,7 @@ doio(struct command *t, int *pipein, int
fd = xopen(tmp, O_WRONLY|O_APPEND|O_LARGEFILE);
#else /* !O_APPEND */
fd = xopen(tmp, O_WRONLY|O_LARGEFILE);
@@ -684,6 +682,3 @@ index c880974..bc51b50 100644
#endif /* O_APPEND */
}
else
---
-1.7.11.7
-