aboutsummaryrefslogtreecommitdiffstats
path: root/main/gparted/gparted.in-Use-reliable-way-of-detecting-gpartedbin-.patch
diff options
context:
space:
mode:
authorPrzemyslaw Pawelczyk <przemoc@zoho.com>2016-12-04 02:31:51 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2016-12-05 16:18:21 +0000
commit8edabd3c8648368ce51d32a4bbcde61cdf7de3e7 (patch)
treec6203877434bda7ebc7b8bd81e55d62dbf263030 /main/gparted/gparted.in-Use-reliable-way-of-detecting-gpartedbin-.patch
parent8e66643b26e958ab57aa9507d5ebd0ad9fa719a2 (diff)
downloadaports-8edabd3c8648368ce51d32a4bbcde61cdf7de3e7.tar.bz2
aports-8edabd3c8648368ce51d32a4bbcde61cdf7de3e7.tar.xz
main/gparted: Use reliable way of detecting gpartedbin process existence.
Otherwise gparted won't start saying that gpartedbin is already running. Problem has been spotted on AL 3.4.6 by Thijs de Vries and reported on IRC channel (#alpine-linux). Patch should be applied also on 3.4-stable w/ obvious adaptations (preserving 3.4-stable's pkgver, bumping pkgrel, fixing collisions in source and *sums) and less obvious one (removing prepare() function, because otherwise patch won't be applied).
Diffstat (limited to 'main/gparted/gparted.in-Use-reliable-way-of-detecting-gpartedbin-.patch')
-rw-r--r--main/gparted/gparted.in-Use-reliable-way-of-detecting-gpartedbin-.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/main/gparted/gparted.in-Use-reliable-way-of-detecting-gpartedbin-.patch b/main/gparted/gparted.in-Use-reliable-way-of-detecting-gpartedbin-.patch
new file mode 100644
index 0000000000..d9e935b2ee
--- /dev/null
+++ b/main/gparted/gparted.in-Use-reliable-way-of-detecting-gpartedbin-.patch
@@ -0,0 +1,46 @@
+From 640709cd2eeb5037b871e6d96ffc186779bcf387 Mon Sep 17 00:00:00 2001
+From: Przemyslaw Pawelczyk <przemoc@gmail.com>
+Date: Sun, 4 Dec 2016 01:55:43 +0100
+Subject: [PATCH] gparted.in: Use reliable way of detecting gpartedbin process
+ existence.
+
+Grepping ps output had only one advantage, it's using tools available in
+any POSIX system. pidof looks for exact process name, regardless of
+the path used to call the binary (which is not true for pgrep).
+pidof is provided by busybox, procps-ng, sysvinit-tools or as a
+stand-alone package on some systems.
+
+We cannot guarantee that if gpartedbin is running there, then it's
+really gpartedbin and not something else renamed to it.
+We could try to detect if it is at least gpartedbin from a known
+location by checking $(readlink /proc/$PID/exe), but it wouldn't prevent
+user from running its own compiled gpartedbin from other location.
+
+ps, pgrep or pidof are simply not the right tools to prevent running
+more than one instance of the program. If such feature is really
+needed, then it should be built into the program to make it truly
+reliable (assuming correct implementation, obviously).
+Alternatively, if the program always run via one and only one
+supervisor, then the supervisor should be able to do the right job,
+because only parent process can reliably tell when it created the child,
+or when the child process execed into given binary or died.
+---
+ gparted.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gparted.in b/gparted.in
+index c435bac..625e50f 100755
+--- a/gparted.in
++++ b/gparted.in
+@@ -30,7 +30,7 @@
+ #
+ # Only permit one instance of GParted to execute at a time
+ #
+-if test "z`ps -e | grep gpartedbin`" != "z"; then
++if pidof -s gpartedbin >/dev/null; then
+ echo "The process gpartedbin is already running."
+ echo "Only one gpartedbin process is permitted."
+ exit 1
+--
+2.8.3
+