Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Oct 2005 13:18:31 +0300
From:      Vasil Dimov <vd@datamax.bg>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        dom@helenmarks.co.uk
Subject:   ports/87512: [patch] devel/distcc daemon cannot create pid file
Message-ID:  <20051016101831.GA1087@qlovarnika.bg.datamax>
Resent-Message-ID: <200510161020.j9GAKIWd014046@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         87512
>Category:       ports
>Synopsis:       [patch] devel/distcc daemon cannot create pid file
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 16 10:20:18 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Vasil Dimov
>Release:        FreeBSD 6.0-RC1 amd64
>Organization:
DataMax
>Environment:

System: FreeBSD qlovarnika.bg.datamax 6.0-RC1 FreeBSD 6.0-RC1 #0: Mon Oct 10 17:41:04 EEST 2005     root@qlovarnika.bg.datamax:/usr/obj/usr/src/sys/QLOVARNIKA  amd64

>Description:

distcc daemon firstly drops root privileges and then attempts to create
it's pid file, which fails to happen for /var/run/distccd.pid for
obvious reasons.

the included patch also makes it possible to override the default pid
filename in distccd_flags.

>How-To-Repeat:

# cd /usr/ports/devel/distcc && make install clean
# echo 'distccd_enable="YES"' >> /etc/rc.conf.local
# /usr/local/etc/rc.d/distccd.sh start
(dcc_save_pid) ERROR: failed to open pid file: /var/run/distccd.pid: Permission denied

// daemon has started anyway

# /usr/local/etc/rc.d/distccd.sh stop
distccd not running? (check /var/run/distccd.pid).

# ps ax |grep distccd
distccd processes show up

>Fix:

--- distcc_pid.diff begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/devel/distcc/Makefile,v
retrieving revision 1.44
diff -u -r1.44 Makefile
--- Makefile	12 Jan 2005 04:31:32 -0000	1.44
+++ Makefile	16 Oct 2005 10:05:29 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	distcc
 PORTVERSION=	2.18.3
+PORTREVISION=	1
 CATEGORIES=	devel ipv6
 MASTER_SITES=	http://distcc.samba.org/ftp/distcc/
 
Index: files/distccd.sh.sample
===================================================================
RCS file: /home/ncvs/ports/devel/distcc/files/distccd.sh.sample,v
retrieving revision 1.4
diff -u -r1.4 distccd.sh.sample
--- files/distccd.sh.sample	12 Jan 2005 04:31:32 -0000	1.4
+++ files/distccd.sh.sample	16 Oct 2005 10:05:29 -0000
@@ -22,7 +22,19 @@
 rcvar=`set_rcvar`
 
 command=%%PREFIX%%/sbin/${name}
-pidfile=%%DISTCCD_PIDFILE%%
+# extract pid file from distccd_flags (if any)
+pidfile="`echo ${distccd_flags} |sed -nE -e 's/^.*-P ([^ ]+).*$/\1/p'`"
+# set default value
+pidfile=${pidfile:-%%DISTCCD_PIDFILE%%}
+
+distccd_precmd()
+{
+	# distccd drops root privileges and then attempts to create the pid file
+	touch ${pidfile}
+	chown distcc:distcc ${pidfile}
+}
+
+start_precmd="distccd_precmd"
 
 load_rc_config ${name}
 run_rc_command "$1"
--- distcc_pid.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051016101831.GA1087>