NetBSD Problem Report #18681

Received: (qmail 28663 invoked by uid 605); 17 Oct 2002 15:41:24 -0000
Message-Id: <200210171515.g9HFFM108213@pizza.causeuse.org>
Date: Thu, 17 Oct 2002 17:15:23 +0200 (CEST)
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
Sender: gnats-bugs-owner@netbsd.org
Reply-To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
To: gnats-bugs@gnats.netbsd.org
Cc: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
Subject: comms/hylafax 'faxd' started unconditionally
X-Send-Pr-Version: 3.95

>Number:         18681
>Category:       pkg
>Synopsis:       rc.d script does not allow starting hfaxd through inetd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 17 15:42:00 +0000 2002
>Closed-Date:    Tue Dec 29 05:14:12 +0000 2015
>Last-Modified:  Tue Dec 29 05:14:12 +0000 2015
>Originator:     Hauke Fath <hauke@espresso.rhein-neckar.de>
>Release:        NetBSD 1.6
>Organization:
Einzeln auftretender Radfahrer
>Environment:
System: NetBSD pizza.causeuse.org 1.6 NetBSD 1.6 (PIZZA) #1: 
Wed Sep 11 23:26:21 CEST 2002 
hauke@pizza.causeuse.org:/usr/src/sys/arch/sparc/compile/PIZZA sparc
Architecture: sparc
Machine: sparc
# $NetBSD: hylafax.sh,v 1.4 2002/09/20 02:01:55 grant Exp $

>Description:
	The hylafax 'hfaxd' can be operated standalone, or from
	inetd. The latter makes sense for a small site sending a few
	faxes a day.

	The '/etc/rc.d/hylafax' script starts 'hfaxd' unconditionally,
	blocking the inetd option.

>How-To-Repeat:
	Install comms/hylafax, then set up a hfaxd entry in
	inetd.conf; wonder why it does not work.

>Fix:
	Apply the equivalent of the following patch to see whether
	hfaxd is started by inetd before starting it standalone:

--- /usr/pkg/etc/rc.d/hylafax	Thu Oct 17 16:54:13 2002
+++ /etc/rc.d/hylafax	Wed Jun 26 22:38:00 2002
@@ -10,9 +10,12 @@
 case ${command} in
 start)
 	if [ -x /usr/pkg/libexec/hfaxd -a -f /var/spool/hylafax/etc/config ] ; then
-	    echo -n 'Starting hfaxd'
-	    /usr/pkg/libexec/hfaxd -i 4559 -o 4557 -s 444 
-
+	    echo -n 'Starting'
+	    # start hfaxd standalone if not run by inetd
+	    if ! `egrep '^[^#]+hfaxd.+$' /etc/inetd.conf >/dev/null`; then
+		echo -n ' hfaxd'
+		/usr/pkg/libexec/hfaxd -i 4559 -o 4557 -s 444 
+	    fi
 	    echo ' faxq.'
 	    /usr/pkg/sbin/faxq
 	fi
>Release-Note:
>Audit-Trail:

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
Cc: netbsd-bugs@netbsd.org, <gnats-bugs@gnats.netbsd.org>
Subject: Re: pkg/18681: comms/hylafax 'faxd' started unconditionally
Date: Thu, 17 Oct 2002 09:11:15 -0700 (PDT)

 On Thu, 17 Oct 2002, Hauke Fath wrote:

 > 	The '/etc/rc.d/hylafax' script starts 'hfaxd' unconditionally,
 > 	blocking the inetd option.

 I think instead of checking for inetd.conf setting for it, the
 rc.d/hylafax script should be fixed to use the proper rc.d file syntax.
 Then it would not run automatically unless "hylafax=yes" was set in
 rc.conf.

 Maybe like:

 . /etc/rc.subr

 name="hylafax"
 procname="hfaxd"
 rcvar=$name
 command="@PREFIX@/libexec/hfaxd"
 pidfile="/var/run/hfaxd.pid"
 required_files="/var/spool/${name}/etc/config"

 load_rc_config $name
 run_rc_command "$1"

 (Not tested. Also, could use "hfaxd" as name instead. Also, since it
 could be used on non-NetBSD systems maybe this could be made to check for
 /etc/rc.subr like the apache and cupsd commands do.)

 Then if you want inetd then use inetd.conf and don't set "hylafax=yes".

 (By the way, /var/spool/hylafax/etc/config seems like a strange, non-pkg
 file location.)

    Jeremy C. Reed
    http://bsd.reedmedia.net/


From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: "Jeremy C. Reed" <reed@reedmedia.net>
Cc: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>, netbsd-bugs@netbsd.org,
  gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18681: comms/hylafax 'faxd' started unconditionally
Date: Thu, 17 Oct 2002 18:20:47 +0200

 hi,

 On Thu, Oct 17, 2002 at 09:11:15AM -0700, Jeremy C. Reed wrote:
 > On Thu, 17 Oct 2002, Hauke Fath wrote:
 >=20
 > > 	The '/etc/rc.d/hylafax' script starts 'hfaxd' unconditionally,
 > > 	blocking the inetd option.
 >=20
 > I think instead of checking for inetd.conf setting for it, the
 > rc.d/hylafax script should be fixed to use the proper rc.d file
 > syntax.  Then it would not run automatically unless "hylafax=3Dyes" was
 > set in rc.conf.

 i agree.  but also don't forget to provide generic rc script which will
 work for other operating systems.


 regards,

 --=20
 -- Lubomir Sedlacik <salo@Xtrmntr.org>   ASCII Ribbon campaign against  /"\=
  --
 --                  <salo@silcnet.org>   e-mail in gratuitous HTML and  \ /=
  --
 --                                       Microsoft proprietary formats   X =
  --
 -- PGPkey: http://Xtrmntr.org/salo.pgp                                  / \=
  --
 -- Key Fingerprint: 75B2 2B96 CD75 0385 1C49  39B8 8B08 C30E 54BC 7263     =
  --

From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
To: "Jeremy C. Reed" <reed@reedmedia.net>
Cc: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>, netbsd-bugs@netbsd.org,
  <gnats-bugs@gnats.netbsd.org>
Subject: Re: pkg/18681: comms/hylafax 'faxd' started unconditionally
Date: Thu, 17 Oct 2002 21:14:27 +0200

 At 9:11 Uhr -0700 17.10.2002, Jeremy C. Reed wrote:
 >> 	The '/etc/rc.d/hylafax' script starts 'hfaxd' unconditionally,
 >> 	blocking the inetd option.
 >
 >I think instead of checking for inetd.conf setting for it, the
 >rc.d/hylafax script should be fixed to use the proper rc.d file syntax.
 >Then it would not run automatically unless "hylafax=yes" was set in
 >rc.conf.

 The problem here is that rc.d/hylafax starts _two_ daemons:

 o hfaxd, which is used for client communication and can be run from inetd
   as well as standalone

 o faxq, which does queue management and runs standalone.

 So, you'd have a 'hylafax' script that has two rc.conf switches 'hfaxd' and
 'faxq' where the former would be optional.

 Or, you'd have two scripts 'hfaxd' and 'faxq' where the former is optional
 and depends on the latter (like e.g. Netatalk is set up).

 >(By the way, /var/spool/hylafax/etc/config seems like a strange, non-pkg
 >file location.)

 Definitely.

 	hauke



 --
 /~\  The ASCII Ribbon Campaign
 \ /    No HTML/RTF in email
  X     No Word docs in email
 / \  Respect for open standards



From: grant@netbsd.org
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18681: comms/hylafax 'faxd' started unconditionally
Date: Fri, 18 Oct 2002 09:08:00 +1000

 On Thu, Oct 17, 2002 at 05:15:23PM +0200, Hauke Fath wrote:

 > >Description:
 > 	The hylafax 'hfaxd' can be operated standalone, or from
 > 	inetd. The latter makes sense for a small site sending a few
 > 	faxes a day.
 > 
 > 	The '/etc/rc.d/hylafax' script starts 'hfaxd' unconditionally,
 > 	blocking the inetd option.
 > 
 > >How-To-Repeat:
 > 	Install comms/hylafax, then set up a hfaxd entry in
 > 	inetd.conf; wonder why it does not work.

 if you don't want hfaxd to run in standalone mode, you can set
 hfaxd=NO.

 Does this not produce the desired result?

 g.


From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
To: grant@netbsd.org
Cc: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>, gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/18681: comms/hylafax 'faxd' started unconditionally
Date: Fri, 18 Oct 2002 10:53:04 +0200

 At 9:08 Uhr +1000 18.10.2002, grant@netbsd.org wrote:
 >if you don't want hfaxd to run in standalone mode, you can set
 >hfaxd=NO.
 >
 >Does this not produce the desired result?

 Yes. No.

 'http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/comms/hylafax/files/hylafax.sh?rev=1
 .4&content-type=text/x-cvsweb-markup'

 The 'hylafax' script checks whether hfaxd is present/executable and whether
 its config file is there, and then proceeds to start hfaxd. Unconditionally.

 Splitting the script in one per daemon like for Netatalk would probably be
 cleanest.

 	hauke


 --
 /~\  The ASCII Ribbon Campaign
 \ /    No HTML/RTF in email
  X     No Word docs in email
 / \  Respect for open standards


From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/18681: rc.d script does not allow starting hfaxd through
 inetd
Date: Mon, 10 Aug 2015 06:18:45 +0000

 Here's a patch. Can someone test the new rc.d scripts before I commit?
 (if nobody does in a week or two I'll commit anyway, but I'd rather
 not commit untested stuff and I'm not in a position to be able to
 check myself)

 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/comms/hylafax/Makefile,v
 retrieving revision 1.71
 diff -u -r1.71 Makefile
 --- Makefile	12 Mar 2015 15:23:39 -0000	1.71
 +++ Makefile	10 Aug 2015 06:16:46 -0000
 @@ -1,6 +1,7 @@
  # $NetBSD: Makefile,v 1.71 2015/03/12 15:23:39 tnn Exp $

  DISTNAME=	hylafax-6.0.6
 +PKGREVISION=	1
  CATEGORIES=	comms
  MASTER_SITES=	ftp://ftp.hylafax.org/source/

 @@ -32,7 +33,7 @@

  FAXUSER?=	uucp
  FAXGROUP?=	dialer
 -RCD_SCRIPTS=	hylafax
 +RCD_SCRIPTS=	hfaxd faxq

  EGDIR=		share/examples/hylafax

 Index: files/faxq.sh
 ===================================================================
 RCS file: files/faxq.sh
 diff -N files/faxq.sh
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ files/faxq.sh	10 Aug 2015 06:16:46 -0000
 @@ -0,0 +1,21 @@
 +#!@RCD_SCRIPTS_SHELL@
 +#
 +# $NetBSD$
 +
 +# PROVIDE: faxq
 +# REQUIRE: DAEMON
 +# KEYWORD: shutdown
 +
 +$_rc_subr_loaded . /etc/rc.subr
 +
 +name=faxq
 +rcvar=$name
 +command=@PREFIX@/sbin/faxq
 +command_args=
 +#pidfile=@VARBASE@/run/faxq.pid
 +required_files=@VARBASE@/spool/hylafax/etc/config
 +
 +load_rc_config $name
 +run_rc_command "$1"
 +
 +	
 \ No newline at end of file
 Index: files/hfaxd.sh
 ===================================================================
 RCS file: files/hfaxd.sh
 diff -N files/hfaxd.sh
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ files/hfaxd.sh	10 Aug 2015 06:16:46 -0000
 @@ -0,0 +1,21 @@
 +#!@RCD_SCRIPTS_SHELL@
 +#
 +# $NetBSD$
 +
 +# PROVIDE: hfaxd
 +# REQUIRE: DAEMON
 +# KEYWORD: shutdown
 +
 +$_rc_subr_loaded . /etc/rc.subr
 +
 +name=hfaxd
 +rcvar=$name
 +command=@PREFIX@/libexec/hfaxd
 +command_args="-i 4559 -o 4557 -s 444"
 +#pidfile=@VARBASE@/run/hfaxd.pid
 +required_files=@VARBASE@/spool/hylafax/etc/config
 +
 +load_rc_config $name
 +run_rc_command "$1"
 +
 +	
 \ No newline at end of file
 Index: files/hylafax.sh
 ===================================================================
 RCS file: files/hylafax.sh
 diff -N files/hylafax.sh
 --- files/hylafax.sh	20 Sep 2002 02:01:55 -0000	1.4
 +++ /dev/null	1 Jan 1970 00:00:00 -0000
 @@ -1,35 +0,0 @@
 -#!@RCD_SCRIPTS_SHELL@
 -#
 -# $NetBSD: hylafax.sh,v 1.4 2002/09/20 02:01:55 grant Exp $
 -#
 -# PROVIDE: hylafax
 -# REQUIRE: DAEMON
 -
 -command=${1:-start}
 -
 -case ${command} in
 -start)
 -	if [ -x @PREFIX@/libexec/hfaxd -a -f /var/spool/hylafax/etc/config ] ; then
 -	    echo -n 'Starting hfaxd'
 -	    @PREFIX@/libexec/hfaxd -i 4559 -o 4557 -s 444 
 -
 -	    echo ' faxq.'
 -	    @PREFIX@/sbin/faxq
 -	fi
 -	;;
 -stop)
 -	PIDS=`ps -ax -o pid,command|egrep '[ /](faxq|hfaxd) '|awk '{printf " " $1}'`
 -	if [ -n "$PIDS" ];then
 -		echo "Stopping hylafax pids$PIDS."
 -		kill -TERM $PIDS
 -	else
 -		echo "hylafax not running?"
 -	fi
 -	;;
 -restart)
 -	( $0 stop )
 -	sleep 1
 -	$0 start
 -	;;
 -esac
 -exit 0


 -- 
 David A. Holland
 dholland@netbsd.org

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/18681 CVS commit: pkgsrc/comms/hylafax
Date: Tue, 29 Dec 2015 00:05:54 +0000

 Module Name:	pkgsrc
 Committed By:	dholland
 Date:		Tue Dec 29 00:05:54 UTC 2015

 Modified Files:
 	pkgsrc/comms/hylafax: Makefile
 Added Files:
 	pkgsrc/comms/hylafax/files: faxq.sh hfaxd.sh
 Removed Files:
 	pkgsrc/comms/hylafax/files: hylafax.sh

 Log Message:
 Modernize rc scripts, for PR 18681. Add hfaxd.sh, faxq.sh; remove
 hylafax.sh.


 To generate a diff of this commit:
 cvs rdiff -u -r1.71 -r1.72 pkgsrc/comms/hylafax/Makefile
 cvs rdiff -u -r0 -r1.1 pkgsrc/comms/hylafax/files/faxq.sh \
     pkgsrc/comms/hylafax/files/hfaxd.sh
 cvs rdiff -u -r1.4 -r0 pkgsrc/comms/hylafax/files/hylafax.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 29 Dec 2015 05:14:12 +0000
State-Changed-Why:
Committed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.