Fix dosource calls in the history file locking patch

This commit is contained in:
Roman Kollar 2012-10-29 17:56:25 +01:00
parent 5b57aa6aa3
commit 2acb8bfe0f
2 changed files with 26 additions and 38 deletions

View File

@ -1,6 +1,6 @@
From 6267f930ac9afead0f9f53122c63ceada9deb546 Mon Sep 17 00:00:00 2001
From f813180f2fc1d682dd097e4a05ef4d15000204ad Mon Sep 17 00:00:00 2001
From: Roman Kollar <rkollar@redhat.com>
Date: Mon, 29 Oct 2012 17:38:10 +0100
Date: Mon, 29 Oct 2012 17:52:52 +0100
Subject: [PATCH] Add .history file locking - shared readers, exclusive writer
Originally reported at Red Hat Bugzilla:
@ -8,19 +8,18 @@ https://bugzilla.redhat.com/show_bug.cgi?id=648592
Patch by Vojtech Vitek (V-Teq) <vvitek@redhat.com>
---
sh.c | 101 +++++++++++++++++++++++++++++++++--------------
sh.decls.h | 5 ++-
sh.dir.c | 2 +-
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 +-
9 files changed, 182 insertions(+), 103 deletions(-)
8 files changed, 185 insertions(+), 99 deletions(-)
diff --git a/sh.c b/sh.c
index dcd9116..5d90492 100644
index dcd9116..7f03077 100644
--- a/sh.c
+++ b/sh.c
@@ -140,6 +140,7 @@ struct saved_state {
@ -183,15 +182,16 @@ index dcd9116..5d90492 100644
/*
* Now if we are allowing commands to be interrupted, we let ourselves be
@@ -2153,24 +2188,25 @@ process(int catch)
}
/*ARGSUSED*/
-void
-dosource(Char **t, struct command *c)
+int
+dosource(Char **t, struct command *c, int flg)
@@ -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;
@ -214,7 +214,7 @@ index dcd9116..5d90492 100644
}
f = globone(*t++, G_ERROR);
@@ -2178,9 +2214,16 @@ dosource(Char **t, struct command *c)
@@ -2178,9 +2220,16 @@ dosource(Char **t, struct command *c)
cleanup_push(file, xfree);
xfree(f);
t = glob_all_or_error(t);
@ -234,19 +234,18 @@ index dcd9116..5d90492 100644
/*
diff --git a/sh.decls.h b/sh.decls.h
index db90288..d4332f3 100644
index db90288..fb15a01 100644
--- a/sh.decls.h
+++ b/sh.decls.h
@@ -37,7 +37,7 @@
* sh.c
@@ -38,6 +38,7 @@
*/
extern Char *gethdir (const Char *);
-extern void dosource (Char **, struct command *);
+extern int dosource (Char **, struct command *, int);
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 +98,7 @@ extern void cleanup_until_mark(void);
@@ -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 *);
@ -254,7 +253,7 @@ index db90288..d4332f3 100644
extern void opendir_cleanup(void *);
extern void sigint_cleanup(void *);
extern void sigprocmask_cleanup(void *);
@@ -219,7 +220,7 @@ extern struct Hist *enthist (int, struct wordent *, int, int, int);
@@ -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);
@ -263,19 +262,6 @@ index db90288..d4332f3 100644
extern void displayHistStats(const char *);
/*
diff --git a/sh.dir.c b/sh.dir.c
index ab89855..4bfe430 100644
--- a/sh.dir.c
+++ b/sh.dir.c
@@ -1342,7 +1342,7 @@ loaddirs(Char *fname)
loaddirs_cmd[1] = fname;
else
loaddirs_cmd[1] = STRtildotdirs;
- dosource(loaddirs_cmd, NULL);
+ dosource(loaddirs_cmd, NULL, 0);
cleanup_until(&bequiet);
}
diff --git a/sh.dol.c b/sh.dol.c
index 45b10e0..2ce7cb5 100644
--- a/sh.dol.c
@ -345,7 +331,7 @@ index 691add3..4e3f13c 100644
typedef unsigned long intptr_t;
#endif
diff --git a/sh.hist.c b/sh.hist.c
index 6a12737..bd26091 100644
index 6a12737..7e53c65 100644
--- a/sh.hist.c
+++ b/sh.hist.c
@@ -44,14 +44,6 @@ Char HistLit = 0;
@ -628,7 +614,7 @@ index 6a12737..bd26091 100644
loadhist_cmd[2] = STRtildothist;
- dosource(loadhist_cmd, NULL);
+ fd = dosource(loadhist_cmd, NULL, flg);
+ 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

View File

@ -122,6 +122,8 @@ fi
- Add Copyright file in %doc
- Readd tcsh-6.18.00-history-file-locking.patch
- Fix casting in lseek calls in the history file locking patch (#821796)
- Fix dosource calls in the history file locking patch (#847102)
Resolves: #842851
* Fri Aug 3 2012 Orion Poplawski <orion@nwra.com> - 6.18.00-3
- Drop tcsh-6.18.00-history-file-locking.patch for now (bug 842851)