Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: [PATCH] comms/hylafax
To:
Larry Moore <lmoore@starwon.com.au>
Cc:
OpenBSD Ports <ports@openbsd.org>, Antoine Jacoutot <ajacoutot@bsdfrog.org>
Date:
Fri, 18 Sep 2026 14:18:49 +0100

Download raw body.

Thread
> +++ ./pkg/hylafax.rc	Sun Jul  5 19:01:32 2026
> @@ -0,0 +1,21 @@
> +#!/bin/ksh
> +
> +# "meta" script running the following rc.d(8) scripts with the given argument;
> +# note that "daemon_*" variables are not passed to the child scripts.
> +_pkg_scripts="faxq hfaxd"

I _think_ we wanted to avoid these meta scripts; Antoine, do I remember
correctly?


> +@mode 555
>  libdata/hylafax/etc/faxmail/application/binary
>  libdata/hylafax/etc/faxmail/application/octet-stream
>  libdata/hylafax/etc/faxmail/application/pdf
> +@mode

I have a better fix for this in patch-port_install_sh_in.

Also the old PLIST was always running "ln -sf %D/libdata/hylafax
/var/spool/hylafax", resulting in an extraneous link from
/var/spool/hylafax/hylafax -> /usr/local/libdata/hylafax, I've fixed
that by only running ln if /var/spool/hylafax doesn't exist.

Updated diff below with the above and a few other small tweaks,
but we may want to remove hylafax.rc on top.

Index: Makefile
===================================================================
RCS file: /cvs/ports/comms/hylafax/Makefile,v
diff -u -p -r1.93 Makefile
--- Makefile	26 Mar 2026 09:12:23 -0000	1.93
+++ Makefile	18 Sep 2026 13:13:59 -0000
@@ -1,14 +1,14 @@
 COMMENT=		send/receive faxes and share modems
 
 DISTNAME=		hylafax-7.0.11
-REVISION=		0
+REVISION=		1
 CATEGORIES=		comms
 
 HOMEPAGE=		https://hylafax.sourceforge.io/
 SITES=			${SITE_SOURCEFORGE:=hylafax/}
 
 # License: BSD
-# http://www.hylafax.org/HylaFAQ/copyright.html
+# https://sourceforge.net/p/hylafax/HylaFAX+/HEAD/tree/trunk/COPYRIGHT
 PERMIT_PACKAGE=		Yes
 
 FLAVORS=		a4
@@ -47,7 +47,8 @@ CONFIGURE_ARGS=		--nointeractive \
 			--with-SCRIPT_SH="/bin/ksh" \
 			--with-INSTALLROOT="${DESTDIR}" \
 			--with-DIR_MAN="${TRUEPREFIX}/man" \
-			--with-DIR_LIBDATA="${TRUEPREFIX}/libdata/hylafax/etc"
+			--with-DIR_LIBDATA="${TRUEPREFIX}/libdata/hylafax/etc" \
+			--with-PATH_AFM="${TRUEPREFIX}/share/fonts/ghostscript"
 
 CONFIGURE_ENV+=		DISABLE_PODOFO=yes
 
Index: patches/patch-etc_faxsetup_sh_in
===================================================================
RCS file: /cvs/ports/comms/hylafax/patches/patch-etc_faxsetup_sh_in,v
diff -u -p -r1.5 patch-etc_faxsetup_sh_in
--- patches/patch-etc_faxsetup_sh_in	25 Mar 2026 15:47:01 -0000	1.5
+++ patches/patch-etc_faxsetup_sh_in	18 Sep 2026 13:13:59 -0000
@@ -21,18 +21,68 @@ Index: etc/faxsetup.sh.in
  PASSWD=/etc/passwd		# where to go for password entries
  PROTOUID=@FAXUID@		# user who's uid we use for FAX user
  defPROTOUID=3			# use this uid if PROTOUID doesn't exist
-@@ -1265,7 +1265,7 @@ if onClient; then
+@@ -1259,34 +1259,67 @@ if onClient; then
+ 			}	
+ 		'
+ 	}
++	genFontmap()
++	{
++	    FONTMAP_FILE=$1
++	    Note ""
++	    Note "Generating Fontmap $FONTMAP_FILE."
++	    Note ""
++
++	    $ECHO "% HylaFAX FontMap file generated by faxsetup on `date 2>/dev/null`" > $FONTMAP_FILE
++	    for d in `$ECHO $2 | $SED 's/:/ /g'`; do
++		if [ -d "$d" ]; then
++		    cd $d
++		    for f in `ls | grep '\.afm'`; do
++			$AWK -F '[ ]' '/FontName/ {print "/"$2"\t("FILENAME")\t;"; exit}; // {}' $f >> $FONTMAP_FILE
++		    done
++		fi
++	    done
++	    if [ -z "`$GREP Courier $FONTMAP_FILE`" ]; then
++	    Note ""
++	    Note "Adding aliases to Fontmap $FONTMAP_FILE."
++	    Note ""
++		$ECHO "" >> $FONTMAP_FILE
++		$ECHO "% Aliases" >> $FONTMAP_FILE
++		$ECHO "" >> $FONTMAP_FILE
++		$ECHO "/Courier		/NimbusMonL-Regu ;" >> $FONTMAP_FILE
++		$ECHO "/Courier-Bold		/NimbusMonL-Bold ;" >> $FONTMAP_FILE
++		$ECHO "/Helvetica		/NimbusSanL-Regu ;" >> $FONTMAP_FILE
++		$ECHO "/Helvetica-Oblique	/NimbusSanL-ReguItal ;" >> $FONTMAP_FILE
++		$ECHO "/Helvetica-Bold		/NimbusSanL-Bold ;" >> $FONTMAP_FILE
++		$ECHO "/Times-Bold		/NimbusRomNo9L-Medi ;" >> $FONTMAP_FILE
++	    fi
++	}
+ 	# If configure --with-PATH_AFM=<path> was used then we need to include it first.
+ 	RUNTIME_PATH_AFM=$PATH_AFM:`getGSFonts`
+ 	if [ -n "$RUNTIME_PATH_AFM" \
  				-a "$RUNTIME_PATH_AFM" != "$PATH_AFM" ]; then 
  	    Note ""
++	    #
++	    # When ghostscript is built with COMPILE_INITS=1, the fonts are compiled in to the ghostscript executable.
++	    # The textfmt(1) program in HylaFAX uses fonts in afm font files.
++	    # The Fontmap.HylaFAX file is created from afm font files found in the paths listed in RUNTIME_PATH_AFM.
++	    #
++	    genFontmap $DIR_SPOOL/etc/Fontmap.HylaFAX $RUNTIME_PATH_AFM
  	    FONTPATHS=`echo $RUNTIME_PATH_AFM | sed 's/:/ /g'`
 -	    $PATH_GSRIP -q -sDEVICE=tiffg3 -sFONTPATH="$FONTPATHS" $DIR_SPOOL/bin/genfontmap.ps > $DIR_SPOOL/etc/Fontmap.HylaFAX 2>/dev/null
-+	    $PATH_GSRIP -q -dNOSAFER -sDEVICE=tiffg3 -sFONTPATH="$FONTPATHS" $DIR_SPOOL/bin/genfontmap.ps > $DIR_SPOOL/etc/Fontmap.HylaFAX 2>/dev/null
- 	    # Ghostscript 8.71 segfaults on that, but produces a valid Fontmap file, so we don't test exit code, but examine the product, instead.
+-	    # Ghostscript 8.71 segfaults on that, but produces a valid Fontmap file, so we don't test exit code, but examine the product, instead.
  	    {
  		#
-@@ -1280,8 +1280,8 @@ if onClient; then
+-		# genfontmap.ps really just gives us a copy of Fontmap.GS, and in later Ghostscript versions there
+-		# are many Fontmap.GS references that are left undefined.  This may work for Ghostscript, but 
+-		# it does not work for us.  So, we need to do what we can to define them.
+-		#
+ 		fontmap=$DIR_SPOOL/etc/Fontmap.HylaFAX
+ 		newfontmap=$TMPDIR/Fontmap.HylaFAX.new.$$
+ 		tmpfile=$TMPDIR/fontmap-fixup.$$
+ 		$CP $fontmap $newfontmap
  		for fontname in `$CAT $fontmap | $GREP "	/" | $SED -e 's/^[^\/]*\///g' -e 's/ .*//g'`; do 
- 		    if [ -z "`$GREP "^($fontname)" $fontmap`" ]; then
+-		    if [ -z "`$GREP "^($fontname)" $fontmap`" ]; then
++		    if [ -z "`$GREP "^/$fontname" $fontmap`" ]; then
  			# There is a blind reference to this font.  Fix that.
 -			for fontpath in `$PATH_GSRIP -h | $GREP -A 100 "Search path:" | $GREP " :" | $SED 's/://g'`; do 
 -			    $GREP -l -d recurse -a "FontDirectory/$fontname known" $fontpath 2>/dev/null; 
@@ -41,7 +91,16 @@ Index: etc/faxsetup.sh.in
  			done | $SED q > $tmpfile
  			fontfile=`$CAT $tmpfile`
  			if [ -n "$fontfile" ]; then
-@@ -2425,12 +2425,7 @@ if onServer; then
+-			    echo "($fontname)	($fontfile) ;" >> $newfontmap
+-		        else
++			    $ECHO "/$fontname	($fontfile) ;" >> $newfontmap
++		        fi
++		        fontalias=`$ECHO $fontname | $SED -e 's/^\/*\///g'`
++		        if [ -z "`$GREP "^/$fontalias" $fontmap`" ]; then
+ 			    echo "Warning: No font file found for \"$fontname\" but the font map includes it."
+ 			fi
+ 		    fi
+@@ -2425,12 +2458,7 @@ if onServer; then
  
      findproc()
      {
@@ -55,3 +114,54 @@ Index: etc/faxsetup.sh.in
  	echo "$pid"
      }
  
+@@ -2446,9 +2474,9 @@ if onServer; then
+ 	    echo
+ 	fi
+ 	if isOK "$x"; then
+-	    if [ -x /bin/systemctl ]; then
+-		echo "Executing '/bin/systemctl stop hylafax-hfaxd'..."
+-		/bin/systemctl stop hylafax-hfaxd
++	    if [ -x /usr/sbin/rcctl ]; then
++		echo "Executing '/usr/sbin/rcctl stop hfaxd'..."
++		/usr/sbin/rcctl stop hfaxd
+ 	    elif kill $HFAXD; then
+ 		echo "Sent a SIGTERM to processes $HFAXD."
+ 	    else
+@@ -2497,9 +2525,9 @@ EOF
+ 	    echo
+ 	fi
+ 	if isOK "$x"; then
+-	    if [ -x /bin/systemctl ]; then
+-		echo "Executing '/bin/systemctl stop hylafax-faxq'..."
+-		/bin/systemctl stop hylafax-faxq
++	    if [ -x /usr/sbin/rcctl ]; then
++		echo "Executing '/usr/sbin/rcctl stop faxq'..."
++		/usr/sbin/rcctl stop faxq
+ 	    else
+ 		$DIR_SBIN/faxquit >/dev/null 2>&1
+ 	    fi
+@@ -2589,18 +2617,18 @@ EOF
+     fi
+     if isOK "$x"; then
+ 	echo ""
+-	if [ -x /bin/systemctl ]; then
+-	    echo "Executing '/bin/systemctl start hylafax-faxq'..."
+-	    /bin/systemctl start hylafax-faxq
+-	    echo "Executing '/bin/systemctl start hylafax-hfaxd'..."
+-	    /bin/systemctl start hylafax-hfaxd
++	if [ -x /usr/sbin/rcctl ]; then
++	    echo "Executing '/usr/sbin/rcctl start faxq'..."
++	    /usr/sbin/rcctl start faxq
++	    echo "Executing '/usr/sbin/rcctl start hfaxd'..."
++	    /usr/sbin/rcctl start hfaxd
+ 	elif [ -x ${DIR_SYSVINIT}/hylafax ]; then
+ 	    echo ${DIR_SYSVINIT}/hylafax start
+ 	    ${DIR_SYSVINIT}/hylafax start
+ 	else
+ 	    echo $DIR_SBIN/faxq; $DIR_SBIN/faxq
+ 	    hfaxdopts=
+-	    if isOK "$HFAXD_SERVER"; then hfaxdopts="-i hylafax "; fi
++	    if isOK "$HFAXD_SERVER"; then hfaxdopts="-f all -l 0.0.0.0 -i hylafax -l ::0 -i hylafax "; fi
+ 	    if isOK "$HFAXD_SNPP_SERVER"; then hfaxdopts="$hfaxdopts\-s snpp"; fi
+ 	    echo "$DIR_SBIN/hfaxd $hfaxdopts"; eval "$DIR_SBIN/hfaxd $hfaxdopts"
+ 	fi
Index: patches/patch-etc_hylafax_in
===================================================================
RCS file: patches/patch-etc_hylafax_in
diff -N patches/patch-etc_hylafax_in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-etc_hylafax_in	18 Sep 2026 13:13:59 -0000
@@ -0,0 +1,38 @@
+--- etc/hylafax.in.orig	Wed Oct 13 03:42:48 2021
++++ etc/hylafax.in	Sat Jul 11 07:20:51 2026
+@@ -90,9 +90,6 @@ fi
+ if [ -z "$HFAXD_SNPP_SERVER" ]; then
+     HFAXD_SNPP_SERVER=@HFAXD_SNPP_SERVER@
+ fi
+-if [ -z "$HFAXD_ARGS" ]; then
+-    HFAXD_ARGS=
+-fi
+ 
+ IS_ON=/etc/chkconfig		# NB: chkconfig is IRIX- and Linux-specific
+ FAXQ=$SBIN/faxq
+@@ -101,6 +98,10 @@ FAXQUIT=$SBIN/faxquit
+ FAXPORT=hylafax			# designated port for new protocol
+ SNPPPORT=444			# official port for SNPP
+ 
++if [ -z "$HFAXD_ARGS" ]; then
++    HFAXD_ARGS="-f all -l 0.0.0.0 -i $FAXPORT -l ::0 "
++fi
++
+ if test ! -x $IS_ON ; then
+     IS_ON=true
+ fi
+@@ -150,13 +151,7 @@ fi
+ #
+ killall()
+ {
+-	# NB: ps ax should give an error on System V, so we try it first!
+-	pid="`ps ax 2>/dev/null | $AWK \"\
+-		/[\/ (]$2[ )]/	{print \\$1;}
+-		/[\/ ]$2\$/	{print \\$1;}\"`"
+-	test "$pid" ||
+-	    pid="`ps -e 2>/dev/null | $AWK \"/ $2[ ]*\$/ {print \\$1;}\"`"
+-	test "$pid" && kill $1 $pid; return
++	/usr/bin/pkill $1 $2
+ }
+ 
+ do_start()
Index: patches/patch-faxd_FaxMachineLog_c++
===================================================================
RCS file: patches/patch-faxd_FaxMachineLog_c++
diff -N patches/patch-faxd_FaxMachineLog_c++
--- patches/patch-faxd_FaxMachineLog_c++	25 Mar 2026 15:47:01 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-Index: faxd/FaxMachineLog.c++
---- faxd/FaxMachineLog.c++.orig
-+++ faxd/FaxMachineLog.c++
-@@ -70,7 +70,11 @@ FaxMachineLog::FaxMachineLog(int f, const fxStr& numbe
- 	struct loggingThreadData *r = (struct loggingThreadData *) malloc(sizeof(struct loggingThreadData));
- 	r->pfd = lpfd[0];
- 	r->wfd = fd;
-+#if defined(__OpenBSD__)
-+	if (1) {	// loggingThread has SIGABRTs in OpenBSD
-+#else
- 	if (pthread_create(&lt, NULL, &loggingThread, (void *) r) != 0) {
-+#endif
- 	    if (lpfd[0] > 0) Sys::close(lpfd[0]);
- 	    if (lpfd[1] > 0) Sys::close(lpfd[1]);
- 	    lpfd[0] = -1;
Index: patches/patch-faxd_sslfaxproxy_c++
===================================================================
RCS file: /cvs/ports/comms/hylafax/patches/patch-faxd_sslfaxproxy_c++,v
diff -u -p -r1.1 patch-faxd_sslfaxproxy_c++
--- patches/patch-faxd_sslfaxproxy_c++	25 Mar 2026 15:47:01 -0000	1.1
+++ patches/patch-faxd_sslfaxproxy_c++	18 Sep 2026 13:13:59 -0000
@@ -10,3 +10,11 @@ Index: faxd/sslfaxproxy.c++
      timeval curTime;
      gettimeofday(&curTime, 0);
      return curTime;
+@@ -94,6 +94,7 @@ sslFaxThread(void* sd)
+ done:
+     Sys::close(s->wfd);
+     Sys::close(s->rfd);
++    free(sd);
+     return (NULL);
+ }
+ 
Index: patches/patch-port_install_sh_in
===================================================================
RCS file: patches/patch-port_install_sh_in
diff -N patches/patch-port_install_sh_in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-port_install_sh_in	18 Sep 2026 13:13:59 -0000
@@ -0,0 +1,12 @@
+Index: port/install.sh.in
+--- port/install.sh.in.orig
++++ port/install.sh.in
+@@ -213,7 +213,7 @@ install()
+ 	    do_chXXX $CHGRP $target
+ 	fi
+ 	$VERBOSE "$CHMOD $target"
+-	do_chXXX $CHMOD $target
++	$CHMOD $target
+ 	if [ $STRIP != ":" ] && [ -x $ROOT$DESTDIR$f ]; then
+ 	    $STRIP $target >/dev/null 2>&1 || true
+ 	    $VERBOSE "$STRIP $target"
Index: pkg/MESSAGE
===================================================================
RCS file: pkg/MESSAGE
diff -N pkg/MESSAGE
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/MESSAGE	18 Sep 2026 13:13:59 -0000
@@ -0,0 +1,4 @@
+If you've updated your installation from an earlier version of HylaFAX 7.0.11,
+update your Fontmap.HylaFAX file by running:
+
+	# ${PREFIX}/sbin/faxsetup -client
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/comms/hylafax/pkg/PLIST,v
diff -u -p -r1.25 PLIST
--- pkg/PLIST	25 Mar 2026 15:47:01 -0000	1.25
+++ pkg/PLIST	18 Sep 2026 13:13:59 -0000
@@ -3,7 +3,7 @@
 @newuser _hylafax:902:_hylafax::HylaFAX Server:/var/spool/hylafax:/sbin/nologin
 @rcscript ${RCDIR}/faxq
 @rcscript ${RCDIR}/hfaxd
-@mode 555
+@rcscript ${RCDIR}/hylafax
 @bin bin/faxalter
 @bin bin/faxcover
 @bin bin/faxmail
@@ -11,20 +11,15 @@
 @bin bin/faxstat
 @bin bin/sendfax
 @bin bin/sendpage
-@mode
 @owner _hylafax
 @group dialer
 libdata/hylafax/
 libdata/hylafax/COPYRIGHT
 libdata/hylafax/archive/
 libdata/hylafax/bin/
-@mode 555
 libdata/hylafax/bin/archive
-@mode
 libdata/hylafax/bin/auto-rotate.ps
-@mode 555
 libdata/hylafax/bin/common-functions
-@mode
 libdata/hylafax/bin/dict/
 libdata/hylafax/bin/dict/de
 libdata/hylafax/bin/dict/en
@@ -42,12 +37,9 @@ libdata/hylafax/bin/dict/sr
 libdata/hylafax/bin/dict/tr
 libdata/hylafax/bin/dict/uk
 libdata/hylafax/bin/dict/zh
-@mode 555
 libdata/hylafax/bin/dictionary
 libdata/hylafax/bin/faxrcvd
-@mode
 libdata/hylafax/bin/genfontmap.ps
-@mode 555
 libdata/hylafax/bin/mkcover
 libdata/hylafax/bin/notify
 libdata/hylafax/bin/pcl2fax
@@ -56,14 +48,11 @@ libdata/hylafax/bin/pollrcvd
 libdata/hylafax/bin/ps2fax.dps
 libdata/hylafax/bin/ps2fax.gs
 libdata/hylafax/bin/ps2fax.imp
-@mode
 libdata/hylafax/bin/qp-encode.awk
 libdata/hylafax/bin/rfc2047-encode.awk
-@mode 555
 libdata/hylafax/bin/tiff2fax
 libdata/hylafax/bin/tiff2pdf
 libdata/hylafax/bin/wedged
-@mode
 libdata/hylafax/client/
 libdata/hylafax/config/
 libdata/hylafax/config/att-dataport
@@ -164,7 +153,6 @@ libdata/hylafax/etc/faxmail/application/
 libdata/hylafax/etc/faxmail/application/pdf
 libdata/hylafax/etc/faxmail/image/
 libdata/hylafax/etc/faxmail/image/tiff
-@mode 644
 libdata/hylafax/etc/hfaxd.conf
 @mode 600
 libdata/hylafax/etc/hosts.hfaxd
@@ -254,7 +242,6 @@ libdata/hylafax/tmp/
 @man man/man8/typetest.8c
 @man man/man8/wedged.8c
 @man man/man8/xferfaxstats.8c
-@mode 555
 @bin sbin/choptest
 @bin sbin/cqtest
 @bin sbin/dialtest
@@ -295,9 +282,8 @@ sbin/recvstats
 @bin sbin/tsitest
 @bin sbin/typetest
 sbin/xferfaxstats
-@mode
 share/doc/pkg-readmes/${PKGSTEM}
-@exec ln -sf %D/libdata/hylafax /var/spool/hylafax
+@exec [ -e /var/spool/hylafax ] || ln -sf %D/libdata/hylafax /var/spool/hylafax
 @exec mkfifo %D/libdata/hylafax/FIFO; chown _hylafax:dialer %D/libdata/hylafax/FIFO; chmod 600 %D/libdata/hylafax/FIFO
 @unexec rm %D/libdata/hylafax/FIFO
 @extraunexec rm -f /var/spool/hylafax
Index: pkg/README
===================================================================
RCS file: /cvs/ports/comms/hylafax/pkg/README,v
diff -u -p -r1.10 README
--- pkg/README	25 Mar 2026 15:47:01 -0000	1.10
+++ pkg/README	18 Sep 2026 13:13:59 -0000
@@ -25,10 +25,18 @@ something like this:
 and send a SIGHUP to init(8).
 
 
+Updating HylaFAX+ fontmap file
+==============================
+To refresh or create a missing HylaFAX fontmap file after an update simply run;
+
+    # ${TRUEPREFIX}/sbin/faxsetup -client
+
+
 Updating file ownership to use the new _hylafax account
 =======================================================
-To update the ownership of directories and files in the HylaFAX spool directory,
-perform one of the following.
+Old versions (6.x) of this package used the legacy UUCP account. This was
+changed to _hylafax when moving to 7.x. If your HylaFAX spool directory
+still contains files owned by _uucp / uid 66, update the ownership as follows.
 
 If the legacy UUCP account is still registerd;
 
Index: pkg/hylafax.rc
===================================================================
RCS file: pkg/hylafax.rc
diff -N pkg/hylafax.rc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/hylafax.rc	18 Sep 2026 13:13:59 -0000
@@ -0,0 +1,21 @@
+#!/bin/ksh
+
+# "meta" script running the following rc.d(8) scripts with the given argument;
+# note that "daemon_*" variables are not passed to the child scripts.
+_pkg_scripts="faxq hfaxd"
+
+if [[ $1 == restart ]]; then
+	$0 stop && $0 start
+	exit
+fi
+
+if [[ $1 == stop ]]; then
+	for _i in ${_pkg_scripts}; do _l="${_i} ${_l}"; done
+	_pkg_scripts=${_l% }
+fi
+
+for _i in ${_pkg_scripts}; do
+	if [[ -x /etc/rc.d/${_i} ]]; then
+		/etc/rc.d/${_i} $@ || exit $?
+	fi
+done