~alpine/devel

2 2

[alpine-devel] [Patch] mini_httpd: crash on startup

Details
Message ID
<4F6E326B.3070401@arcor.de>
Sender timestamp
1332621931
DKIM signature
missing
Download raw message
Hi,

mini_httpd is quite picky about the availability of paths to the log and
pid files. If those folders do not exist, e.g. because they point to an
after the system boot empty tmpfs, mini_httpd (as such ACF) will crash.

The patch below ensures the folders are available. Please, consider
integrating it.

Regards, Tiger

--- /etc/init.d/mini_httpd.orig
+++ /etc/init.d/mini_httpd
@@ -6,0 +7 @@
+logfile=/var/log/mini_httpd/${SVCNAME}.log
@@ -14,0 +16,2 @@
+    mkdir -p "$(echo $pidfile | sed 's|/[^/]*$||')"
+    mkdir -p "$(echo $logfile | sed 's|/[^/]*$||')"
@@ -17 +20 @@
-        ${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf -l
/var/log/mini_httpd/${SVCNAME}.log}
+        ${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf -l $logfile}



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20120326204727.0e307d6a@alpinelinux.org>
In-Reply-To
<4F6E326B.3070401@arcor.de> (view parent)
Sender timestamp
1332787647
DKIM signature
missing
Download raw message
On Sat, 24 Mar 2012 21:45:31 +0100
Der Tiger <der.tiger.alpine@arcor.de> wrote:

> Hi,
> 
> mini_httpd is quite picky about the availability of paths to the log
> and pid files. If those folders do not exist, e.g. because they point
> to an after the system boot empty tmpfs, mini_httpd (as such ACF)
> will crash.

Hi, thanks for the feedback.

> 
> The patch below ensures the folders are available. Please, consider
> integrating it.

I get this error when tryin apply it:
fatal: cannot convert from ISO-8859-15 to UTF-8

> 
> Regards, Tiger
> 
> --- /etc/init.d/mini_httpd.orig
> +++ /etc/init.d/mini_httpd
> @@ -6,0 +7 @@
> +logfile=/var/log/mini_httpd/${SVCNAME}.log
> @@ -14,0 +16,2 @@
> +    mkdir -p "$(echo $pidfile | sed 's|/[^/]*$||')"
> +    mkdir -p "$(echo $logfile | sed 's|/[^/]*$||')"

openrc has a tool for this. checkpath.

how about something like:

checkpath -d ${pidfile%/*}
checkpath -d ${logfile%/*}

For documentation:
 apk add openrc-doc
 man runscript

We should add how to create dirs for pidfiles to the wiki. And no, we
cannot expect the package create subdirs under /var/run (or /run)
because /var/run could be a tmpfs mount.


> @@ -17 +20 @@
> -        ${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf -l
> /var/log/mini_httpd/${SVCNAME}.log}
> +        ${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf -l $logfile}
> 
> 
> 
> ---
> Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
> Help:         alpine-devel+help@lists.alpinelinux.org
> ---
> 



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Details
Message ID
<4F8082E4.5060904@arcor.de>
In-Reply-To
<20120326204727.0e307d6a@alpinelinux.org> (view parent)
Sender timestamp
1333822180
DKIM signature
missing
Download raw message
ReHi Natanael,

Thank you for your immediate reply! I'm sorry for the delay in answering
your mail!

>> The patch below ensures the folders are available. Please, consider
>> integrating it.
> I get this error when tryin apply it:
> fatal: cannot convert from ISO-8859-15 to UTF-8
Well, I'm a bl00dy continental generally using ISO format for e-mailing.
;-) I'll make sure to send future patches in UTF-8 format.

You'll find updated patches modified to your suggestions below.

Regards, Tiger

--- /etc/init.d/mini_httpd
+++ /etc/init.d/mini_httpd
@@ -4,6 +4,7 @@
 # $Header:
/var/cvsroot/gentoo-x86/www-servers/mini_httpd/files/mini_httpd.init,v
1.2 2007/08/26 21:20:21 bangert Exp $

 pidfile=/var/run/mini_httpd/${SVCNAME}.pid
+logfile=/var/log/mini_httpd/${SVCNAME}.log

 depend() {
 	need net
@@ -12,9 +13,11 @@

 start() {
 	ebegin "Starting $SVCNAME"
+	checkpath -d ${pidfile%/*}
+	checkpath -d ${logfile%/*}
 	start-stop-daemon --quiet --start --exec /usr/sbin/mini_httpd \
 		--pidfile $pidfile -- -i $pidfile \
-		${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf -l
/var/log/mini_httpd/${SVCNAME}.log}
+		${MINI_HTTPD_OPTS:--C /etc/${SVCNAME}.conf -l $logfile}
 	eend $?
 }

--- /etc/init.d/dhcpd
+++ /etc/init.d/dhcpd
@@ -73,6 +73,7 @@
 	pidfile="${pidfile:-/var/run/dhcp/dhcpd.pid}"

 	ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}"
+	checkpath -o dhcp:dhcp -d ${pidfile%/*}
 	start-stop-daemon --start --exec /usr/sbin/dhcpd \
 		--pidfile "${DHCPD_CHROOT}/${pidfile}" \
 		-- ${DHCPD_OPTS} -q -pf "${pidfile}" \



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)