supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* svlogd: segfault
@ 2004-03-24 14:48 Alex Efros
  2004-03-24 22:11 ` Gerrit Pape
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Efros @ 2004-03-24 14:48 UTC (permalink / raw)


Hi!

Looks like svlogd (runit-1.0.0) will segfault if log/config file is empty:

# rm /var/log/dnscachex/config
# svlogd -tt /var/log/dnscachex
(working, Ctrl-C pressed)

# echo >/var/log/dnscachex/config
# svlogd -tt /var/log/dnscachex
(working, Ctrl-C pressed)

# echo -n >/var/log/dnscachex/config
# svlogd -tt /var/log/dnscachex
Segmentation fault
# 

Compilation details:

CFLAGS="-O3 -march=pentium4 -pipe -fomit-frame-pointer -funroll-loops"
   GCC: 3.3.2
 GLIBC: 2.3.2
KERNEL: 2.6.3


P.S. BTW, what is *RIGHT WAY* if I don't need any commands in log/config:
	1) delete log/config
	2) echo > log/config
	3) echo '*' > log/config
     ?

-- 
			WBR, Alex.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: svlogd: segfault
  2004-03-24 14:48 svlogd: segfault Alex Efros
@ 2004-03-24 22:11 ` Gerrit Pape
  2004-03-29  1:11   ` Clemens Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Gerrit Pape @ 2004-03-24 22:11 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

On Wed, Mar 24, 2004 at 04:48:30PM +0200, Alex Efros wrote:
> Looks like svlogd (runit-1.0.0) will segfault if log/config file is empty:

I can confirm this, a fix is attached.

> P.S. BTW, what is *RIGHT WAY* if I don't need any commands in log/config:
> 	1) delete log/config
> 	2) echo > log/config
> 	3) echo '*' > log/config

A missing log/config is fine.  A log/config only containing lines svlogd
ignores is also fine.  An empty log/config will be fine with the next
version.  I think this is made clear in the svlogd man page, if not,
could anybody suggest a better wording?

Thanks for the bug report, Gerrit.

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 557 bytes --]

Index: src/svlogd.c
===================================================================
RCS file: /var/lib/cvs/runit/src/svlogd.c,v
retrieving revision 1.11
diff -u -r1.11 svlogd.c
--- src/svlogd.c	19 Jan 2004 12:20:03 -0000	1.11
+++ src/svlogd.c	24 Mar 2004 22:07:06 -0000
@@ -349,7 +349,7 @@
     unsigned long port;
 
     if (verbose) strerr_warn4(INFO, "read: ", ld->name, "/config", 0);
-    for (i =0; i < sa.len -1; ++i) {
+    for (i =0; i +1 < sa.len; ++i) {
       if ((len =byte_chr(&sa.s[i], sa.len -i, '\n')) == 1) {
 	++i; continue;
       }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: svlogd: segfault
  2004-03-24 22:11 ` Gerrit Pape
@ 2004-03-29  1:11   ` Clemens Fischer
  2004-03-29  1:21     ` Paul Jarc
  0 siblings, 1 reply; 4+ messages in thread
From: Clemens Fischer @ 2004-03-29  1:11 UTC (permalink / raw)


* 2004-03-24 Gerrit Pape:

> diff -u -r1.11 svlogd.c
> --- src/svlogd.c	19 Jan 2004 12:20:03 -0000	1.11
> +++ src/svlogd.c	24 Mar 2004 22:07:06 -0000
> @@ -349,7 +349,7 @@
>      unsigned long port;
>  
>      if (verbose) strerr_warn4(INFO, "read: ", ld->name, "/config", 0);
> -    for (i =0; i < sa.len -1; ++i) {
> +    for (i =0; i +1 < sa.len; ++i) {
>        if ((len =byte_chr(&sa.s[i], sa.len -i, '\n')) == 1) {
>       	++i; continue;
>        }

sorry, i just cannot see the semantic difference between the while clauses
"i < sa.len -1" and "i +1 < sa.len".  what's the deal here?

  clemens


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: svlogd: segfault
  2004-03-29  1:11   ` Clemens Fischer
@ 2004-03-29  1:21     ` Paul Jarc
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Jarc @ 2004-03-29  1:21 UTC (permalink / raw)


"Clemens Fischer" <ino-qc@spotteswoode.de.eu.org> wrote:
> sorry, i just cannot see the semantic difference between the while clauses
> "i < sa.len -1" and "i +1 < sa.len".  what's the deal here?

If sa.len==0, sa.len-1==UINT_MAX.


paul


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-29  1:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24 14:48 svlogd: segfault Alex Efros
2004-03-24 22:11 ` Gerrit Pape
2004-03-29  1:11   ` Clemens Fischer
2004-03-29  1:21     ` Paul Jarc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).