about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gamin
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/gamin
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gamin')
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/deadlock.patch68
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt2
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/gamin/returnval.patch12
5 files changed, 139 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gamin/deadlock.patch b/nixpkgs/pkgs/development/libraries/gamin/deadlock.patch
new file mode 100644
index 000000000000..e2abc8ce2d97
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/deadlock.patch
@@ -0,0 +1,68 @@
+Fix for a deadlock:
+https://bugzilla.gnome.org/show_bug.cgi?id=667230
+
+From cc14440eface093548cb3bc7814da11d9a99d283 Mon Sep 17 00:00:00 2001
+From: Anssi Hannula <anssi@mageia.org>
+Date: Wed, 4 Jan 2012 00:23:55 +0200
+Subject: [PATCH] fix possible server deadlock in ih_sub_cancel
+
+ih_sub_foreach() calls ih_sub_cancel() while inotify_lock is locked.
+However, ih_sub_cancel() locks it again, and locking GMutex recursively
+causes undefined behaviour.
+
+Fix that by removing locking from ih_sub_cancel() as ih_sub_foreach()
+is its only user. Also make the function static so that it won't
+accidentally get used by other files without locking (inotify-helper.h
+is an internal server header).
+
+This should fix the intermittent deadlocks I've been experiencing
+causing KDE applications to no longer start, and probably also
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542361
+---
+ server/inotify-helper.c |    7 ++-----
+ server/inotify-helper.h |    1 -
+ 2 files changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/server/inotify-helper.c b/server/inotify-helper.c
+index d77203e..0789fa4 100644
+--- a/server/inotify-helper.c
++++ b/server/inotify-helper.c
+@@ -123,13 +123,11 @@ ih_sub_add (ih_sub_t * sub)
+ 
+ /**
+  * Cancels a subscription which was being monitored.
++ * inotify_lock must be held when calling.
+  */
+-gboolean
++static gboolean
+ ih_sub_cancel (ih_sub_t * sub)
+ {
+-	G_LOCK(inotify_lock);
+-
+-
+ 	if (!sub->cancelled)
+ 	{
+ 		IH_W("cancelling %s\n", sub->pathname);
+@@ -140,7 +138,6 @@ ih_sub_cancel (ih_sub_t * sub)
+ 		sub_list = g_list_remove (sub_list, sub);
+ 	}
+ 
+-	G_UNLOCK(inotify_lock);
+ 	return TRUE;
+ }
+ 
+diff --git a/server/inotify-helper.h b/server/inotify-helper.h
+index 5d3b6d0..d36b5fd 100644
+--- a/server/inotify-helper.h
++++ b/server/inotify-helper.h
+@@ -34,7 +34,6 @@ gboolean	 ih_startup		(event_callback_t ecb,
+ 					 found_callback_t fcb);
+ gboolean	 ih_running		(void);
+ gboolean	 ih_sub_add		(ih_sub_t *sub);
+-gboolean	 ih_sub_cancel		(ih_sub_t *sub);
+ 
+ /* Return FALSE from 'f' if the subscription should be cancelled */
+ void		 ih_sub_foreach		(void *callerdata, gboolean (*f)(ih_sub_t *sub, void *callerdata));
+-- 
+1.7.7.2
+
diff --git a/nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix
new file mode 100644
index 000000000000..a8f334fb3c39
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.nix
@@ -0,0 +1,10 @@
+# Generated by debian-patches.sh from debian-patches.txt
+let
+  prefix = "https://sources.debian.org/data/main/g/gamin/0.1.10-4.1/debian/patches";
+in
+[
+  {
+    url = "${prefix}/17_deprecated_const_return.patch";
+    sha256 = "0bssrqcmyivlpk2g0q71d1yavd4wv1lw34l8qipm0ndljjd6rbrk";
+  }
+]
diff --git a/nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt
new file mode 100644
index 000000000000..46d2420b21ed
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/debian-patches.txt
@@ -0,0 +1,2 @@
+gamin/0.1.10-4.1
+17_deprecated_const_return.patch
diff --git a/nixpkgs/pkgs/development/libraries/gamin/default.nix b/nixpkgs/pkgs/development/libraries/gamin/default.nix
new file mode 100644
index 000000000000..4cff22457403
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, fetchpatch, python, pkgconfig, glib }:
+
+stdenv.mkDerivation (rec {
+  name = "gamin-0.1.10";
+
+  src = fetchurl {
+    url = "https://www.gnome.org/~veillard/gamin/sources/${name}.tar.gz";
+    sha256 = "18cr51y5qacvs2fc2p1bqv32rs8bzgs6l67zhasyl45yx055y218";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ python glib ];
+
+  # `_GNU_SOURCE' is needed, e.g., to get `struct ucred' from
+  # <sys/socket.h> with Glibc 2.9.
+  configureFlags = [
+    "--disable-debug"
+    "--with-python=${python}"
+    "CPPFLAGS=-D_GNU_SOURCE"
+  ];
+
+  patches = [ ./deadlock.patch ]
+    ++ map fetchurl (import ./debian-patches.nix)
+    ++ stdenv.lib.optional stdenv.cc.isClang ./returnval.patch
+    ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+      name = "fix-pthread-mutex.patch";
+      url = "https://git.alpinelinux.org/cgit/aports/plain/main/gamin/fix-pthread-mutex.patch?h=3.4-stable&id=a1a836b089573752c1b0da7d144c0948b04e8ea8";
+      sha256 = "13igdbqsxb3sz0h417k6ifmq2n4siwqspj6slhc7fdl5wd1fxmdz";
+    });
+
+
+  meta = with stdenv.lib; {
+    homepage    = https://people.gnome.org/~veillard/gamin/;
+    description = "A file and directory monitoring system";
+    maintainers = with maintainers; [ lovek323 ];
+    license = licenses.gpl2;
+    platforms   = platforms.unix;
+  };
+}
+
+// stdenv.lib.optionalAttrs stdenv.isDarwin {
+  preBuild =  ''
+    sed -i 's/,--version-script=.*$/\\/' libgamin/Makefile
+  '';
+})
+
diff --git a/nixpkgs/pkgs/development/libraries/gamin/returnval.patch b/nixpkgs/pkgs/development/libraries/gamin/returnval.patch
new file mode 100644
index 000000000000..3944b14be64c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gamin/returnval.patch
@@ -0,0 +1,12 @@
+diff -rupN gamin-0.1.10-orig/server/gam_eq.c gamin-0.1.10/server/gam_eq.c
+--- gamin-0.1.10-orig/server/gam_eq.c	2015-04-05 19:25:54.000000000 -0400
++++ gamin-0.1.10/server/gam_eq.c	2015-04-05 19:26:00.000000000 -0400
+@@ -124,7 +124,7 @@ gam_eq_flush (gam_eq_t *eq, GamConnDataP
+ {
+ 	gboolean done_work = FALSE;
+ 	if (!eq)
+-		return;
++		return done_work;
+ 
+ #ifdef GAM_EQ_VERBOSE
+ 	GAM_DEBUG(DEBUG_INFO, "gam_eq: Flushing event queue for %s\n", gam_connection_get_pidname (conn));