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
Dear maintainer, please review the proposed patch! Volker
State Changed From-To: open->feedback Waiting for maintainer feedback
Hmmz, I just noted that this patch is imperfect, because we get Oct 16 14:18:04 zybyt distccd[79461]: (dcc_remove_pid) Warning: failed to remove pid file /var/run/distccd.pid: Permission denied at daemon shutdown. This really does not interfere start/stop operations, but is somehow irritating. From here I see two ways to go: 1. Hack the source not to attempt to remove the pid file and remove it from distccd.sh 2. Go for /var/run/distccd/pid && chown distcc /var/run/distccd. Dominic, Volker, what do you think?
Vasil, After maintainer timeout. I think the best way to solve pid problem is change source. Can you submit patch? Regards -- Marcus Alves Grando marcus(at)corp.grupos.com.br | Grupos Internet S/A mnag(at)FreeBSD.org | FreeBSD.org
Here is a patch (against current version of the port) that makes distcc daemon not to remove it's pid file when exiting, thus not emitting "permission denied" warning. --- distcc_pid.diff begins here --- diff -urN --exclude=CVS --exclude=README.html distcc.orig/Makefile distcc/Makefile --- distcc.orig/Makefile Tue Feb 1 10:31:56 2005 +++ distcc/Makefile Fri Nov 4 17:39:20 2005 @@ -7,6 +7,7 @@ PORTNAME= distcc PORTVERSION= 2.18.3 +PORTREVISION= 1 CATEGORIES= devel ipv6 MASTER_SITES= http://distcc.samba.org/ftp/distcc/ @@ -19,6 +20,7 @@ USE_BZIP2= yes USE_GMAKE= yes GNU_CONFIGURE= yes +CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL} WANT_GNOME= yes CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" DISTCCD_PIDFILE=/var/run/distccd.pid diff -urN --exclude=CVS --exclude=README.html distcc.orig/files/distccd.sh.sample distcc/files/distccd.sh.sample --- distcc.orig/files/distccd.sh.sample Tue Feb 1 10:31:56 2005 +++ distcc/files/distccd.sh.sample Fri Nov 4 17:38:43 2005 @@ -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" diff -urN --exclude=CVS --exclude=README.html distcc.orig/files/patch-src-dparent.c.diff distcc/files/patch-src-dparent.c.diff --- distcc.orig/files/patch-src-dparent.c.diff Thu Jan 1 02:00:00 1970 +++ distcc/files/patch-src-dparent.c.diff Fri Nov 4 17:35:21 2005 @@ -0,0 +1,20 @@ +--- src/dparent.c.orig Sun Oct 24 08:05:48 2004 ++++ src/dparent.c Fri Nov 4 17:35:09 2005 +@@ -285,6 +285,9 @@ + **/ + void dcc_remove_pid(void) + { ++ /* distcc user, we are running as, cannot delete files in /var/run ++ */ ++#if 0 + if (!arg_pid_file) + return; + +@@ -292,6 +295,7 @@ + rs_log_warning("failed to remove pid file %s: %s", + arg_pid_file, strerror(errno)); + } ++#endif + } + + --- distcc_pid.diff begins here --- -- Vasil Dimov
State Changed From-To: feedback->open Feedback received
State Changed From-To: open->closed Committed. Thanks!