Skip to contentSkip to conversation

test/start-daemon: Ignore stale .pid files.

PATCH New Pete Zaitcev 1 participant 1 message Sep 22, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 test/start-daemon: Ignore stale .pid files.

The effect of this is to proceed with "make check" if
- stale file is present, and
- no process uses the PID recorded therein.
So, the worst that can happen is a revert to old behavior if an unrelated process reuses the PID. Should make no difference for RPM builds at all.

---
 test/start-daemon |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

You know, if we decide that we want to permit "make check" on unclean tree (which is where this patch aims), we might want to rm -r test/data too. Otherwise code 1111 lock conflicts are inevitable and check is likely to fail anyway.

test/start-daemon +7 -3
index da653d6..6985468 100755
@@ -1,10 +1,14 @@
 #!/bin/sh
 
-for d in cld chunkd tabled; do
+for d in cld chunkd tabled
+do
 	if [ -f $d.pid ]
 	then
-		echo "$d.pid file found.  daemon still running?"
-		exit 1
+		if kill -0 `cat $d.pid` 2> /dev/null
+		then
+			echo "$d.pid file found.  daemon still running?" >&2
+			exit 1
+		fi
 	fi
 done