Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 2014 20:25:33 GMT
From:      Mark Felder <feld@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/185946: [patch] net/socat further rc script improvements
Message-ID:  <201401202025.s0KKPXp5048486@oldred.freebsd.org>
Resent-Message-ID: <201401202030.s0KKU4Di031132@freefall.freebsd.org>

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

>Number:         185946
>Category:       ports
>Synopsis:       [patch] net/socat further rc script improvements
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 20 20:30:03 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Mark Felder
>Release:        
>Organization:
>Environment:
>Description:
adding an rc script to socat was one of my earliest attempts at utilizing daemon(8). Any time you write a custom start_cmd routine you're losing several features rc.subr generously provides. We seem to have many offenders in the ports tree that write their own start_cmd because of daemon(8) and they really shouldn't :-(

This patch will make the socat rc script more reliable -- start/stop/status should *ALWAYS* work. It should also kindly tell you if it's already running.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
--- Makefile	(revision 339463)
+++ Makefile	(working copy)
@@ -3,7 +3,7 @@
 
 PORTNAME=	socat
 PORTVERSION=	1.7.2.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net ipv6
 MASTER_SITES=	http://www.dest-unreach.org/socat/download/ \
 		CRITICAL
Index: files/socat.in
===================================================================
--- files/socat.in	(revision 339463)
+++ files/socat.in	(working copy)
@@ -22,13 +22,18 @@
 
 : ${socat_enable="NO"}
 
-start_cmd="${name}_start"
+start_precmd="socat_prestart"
 pidfile=/var/run/socat.pid
-command="%%PREFIX%%/bin/socat"
+command=/usr/sbin/daemon
+command_args=" -f -p ${pidfile} /usr/local/bin/socat ${socat_flags}"
+procname=/usr/local/bin/socat
 
-socat_start() {
-	echo "Starting ${name}."
-	/usr/sbin/daemon -f -p ${pidfile} ${command} ${socat_flags}
+socat_prestart()
+{
+	# socat_flags gets applied too early if we don't do this.
+	# I didn't want to force people to update their rc.conf files
+	# and change the socat_flags to something else.
+	rc_flags=""
 }
 
 run_rc_command "$1"


>Release-Note:
>Audit-Trail:
>Unformatted:



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