[Pkg-zsh-commits] [zsh] 03/03: Cherry-pick 4414e54e from upstream: Fixes regression with shared or incremental history when trying to read .zsh_history with hist_fcntl_lock

Axel Beckert abe at deuxchevaux.org
Sat Sep 20 12:48:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch debian
in repository zsh.

commit be93912fb604b6d02a8a17105783f1a4ebd71717
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Sat Sep 20 14:42:50 2014 +0200

    Cherry-pick 4414e54e from upstream: Fixes regression with shared or incremental history when trying to read .zsh_history with hist_fcntl_lock
    
    Closes: #761597
---
 ...uble-locking-with-shared-or-incremental-history | 44 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 45 insertions(+)

diff --git a/debian/patches/cherry-pick-4414e54e-prevent-double-locking-with-shared-or-incremental-history b/debian/patches/cherry-pick-4414e54e-prevent-double-locking-with-shared-or-incremental-history
new file mode 100644
index 0000000..62ce2bd
--- /dev/null
+++ b/debian/patches/cherry-pick-4414e54e-prevent-double-locking-with-shared-or-incremental-history
@@ -0,0 +1,44 @@
+Origin: commit:4414e54ea7ffe50acca851c11c2ef49dc867c55d
+Author: Barton E. Schaefer <schaefer at zsh.org>
+Subject: 33116: followup to 32580 to prevent double-locking with shared or incremental history
+Bug-Debian: https://bugs.debian.org/761597
+
+diff --git a/Src/hist.c b/Src/hist.c
+index 770d559..d29a65a 100644
+--- a/Src/hist.c
++++ b/Src/hist.c
+@@ -2490,6 +2490,9 @@ flockhistfile(char *fn, int keep_trying)
+     struct flock lck;
+     int ctr = keep_trying ? 9 : 0;
+ 
++    if (flock_fd >= 0)
++	return 0; /* already locked */
++
+     if ((flock_fd = open(unmeta(fn), O_RDWR | O_NOCTTY)) < 0)
+ 	return errno == ENOENT ? 0 : 2; /* "successfully" locked missing file */
+ 
+@@ -2768,12 +2771,6 @@ lockhistfile(char *fn, int keep_trying)
+     if (!fn && !(fn = getsparam("HISTFILE")))
+ 	return 1;
+ 
+-#ifdef HAVE_FCNTL_H
+-    if (isset(HISTFCNTLLOCK) && flock_fd < 0) {
+-	return flockhistfile(fn, keep_trying);
+-    }
+-#endif
+-
+     if (!lockhistct++) {
+ 	struct stat sb;
+ 	int fd;
+@@ -2786,6 +2783,11 @@ lockhistfile(char *fn, int keep_trying)
+ # endif
+ #endif
+ 
++#ifdef HAVE_FCNTL_H
++	if (isset(HISTFCNTLLOCK))
++	    return flockhistfile(fn, keep_trying);
++#endif
++
+ 	lockfile = bicat(unmeta(fn), ".LOCK");
+ 	/* NOTE: only use symlink locking on a link()-having host in order to
+ 	 * avoid a change from open()-based locking to symlink()-based. */
diff --git a/debian/patches/series b/debian/patches/series
index 8d7c832..6bbc67f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 replace-texi2html-with-makeinfo
+cherry-pick-4414e54e-prevent-double-locking-with-shared-or-incremental-history

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/zsh.git



More information about the Pkg-zsh-commits mailing list