public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [BUG and PATCH] Does dcron need a space at the end of each
@ 2002-03-20 21:40 Christian HOFFMANN
  2002-03-21  2:12 ` [gentoo-dev] " Matthew Dillon
  0 siblings, 1 reply; 4+ messages in thread
From: Christian HOFFMANN @ 2002-03-20 21:40 UTC (permalink / raw
  To: gentoo-dev, dillon

I just fired gdb to find the source of this problem and found the source 
of the problem being at line 178 of database.c

was: 			buf[strlen(ptr)-1] = 0;
is now on my system:	buf[strlen(ptr)] = 0;

This line was chopping 2 char at the end of the line the last one of the 
command and the newline. You have to remove one char but indexing 
starts at 0 and strlen give the number of char.

I'm new to patch submission, howto ?

Regards

------- Forwarded message follows -------
From:           	christian.hoffmann@noos.fr
To:             	gentoo-user@gentoo.org
Subject:        	[gentoo-user] Does dcron need a space at 
the end of each line in the crontab ?
Date sent:      	Tue, 19 Mar 2002 22:58:51 +0100

Hi,

I was trying to use dcron on my linux box and found it not working.

To make it work I had to add a space at each end of line in my crontab.

Is this "feature" documented somewhere or is it a bug ?

I use dcron-2.7-r7 with a 2.4.17-r5 kernel on a Gentoo Linux 
distribution.



-----------------------------------------------
Christian HOFFMANN <christian.hoffmann@noos.fr>



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

* [gentoo-dev] Re: [BUG and PATCH] Does dcron need a space at the end of each
  2002-03-20 21:40 [gentoo-dev] [BUG and PATCH] Does dcron need a space at the end of each Christian HOFFMANN
@ 2002-03-21  2:12 ` Matthew Dillon
  2002-03-21 20:34   ` Christian HOFFMANN
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Dillon @ 2002-03-21  2:12 UTC (permalink / raw
  To: Christian HOFFMANN; +Cc: gentoo-dev

:I just fired gdb to find the source of this problem and found the source 
:of the problem being at line 178 of database.c
:
:was: 			buf[strlen(ptr)-1] = 0;
:is now on my system:	buf[strlen(ptr)] = 0;
:
:This line was chopping 2 char at the end of the line the last one of the 
:command and the newline. You have to remove one char but indexing 
:starts at 0 and strlen give the number of char.
:
:I'm new to patch submission, howto ?
:
:Regards

    Well, I do not know who is maintaining the linux version of dcron.
    I maintain my master source but I don't think the linux sites are
    picking it up.

    In regards to this bug, I think the problem is that it should be
    'ptr[strlen(ptr)-1] = 0' rather then 'buf[strlen(ptr)-1] = 0'.
    That is, it is trying to remove the newline at the end of the
    buffer.  The bug occurs if you have spaces at the front of the line.

    Please try 'ptr[strlen(ptr)-1] = 0' and see if that solves your
    problem.

						-Matt



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

* Re: [gentoo-dev] Re: [BUG and PATCH] Does dcron need a space at the end of each
  2002-03-21  2:12 ` [gentoo-dev] " Matthew Dillon
@ 2002-03-21 20:34   ` Christian HOFFMANN
  2002-03-22 19:59     ` Matthew Dillon
  0 siblings, 1 reply; 4+ messages in thread
From: Christian HOFFMANN @ 2002-03-21 20:34 UTC (permalink / raw
  To: Matthew Dillon, gentoo-dev

I tested your proposed modification, it works far better than mine.

I was just wrong in the beginning, my problem was lines starting with a 
space (for allignment purpose) and my patch break the others tasks on 
lines not starting with a space.

Now dcron work for lines starting or not with a space or tabs or...

For your information dcron2.7 is the standard cron for the Gentoo 
Linux distribution. http://www.gentoo.org

> 
> :I just fired gdb to find the source of this problem and found the source 
> :of the problem being at line 178 of database.c
> :
> :was: 			buf[strlen(ptr)-1] = 0;
> :is now on my system:	buf[strlen(ptr)] = 0;
> :
> :This line was chopping 2 char at the end of the line the last one of the 
> :command and the newline. You have to remove one char but indexing 
> :starts at 0 and strlen give the number of char.
> :
> :I'm new to patch submission, howto ?
> :
> :Regards
> 
>     Well, I do not know who is maintaining the linux version of dcron.
>     I maintain my master source but I don't think the linux sites are
>     picking it up.
> 
>     In regards to this bug, I think the problem is that it should be
>     'ptr[strlen(ptr)-1] = 0' rather then 'buf[strlen(ptr)-1] = 0'.
>     That is, it is trying to remove the newline at the end of the
>     buffer.  The bug occurs if you have spaces at the front of the line.
> 
>     Please try 'ptr[strlen(ptr)-1] = 0' and see if that solves your
>     problem.
> 
> 						-Matt
> 
> _______________________________________________
> gentoo-dev mailing list
> gentoo-dev@gentoo.org
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev
> 

-----------------------------------------------
Christian HOFFMANN <christian.hoffmann@noos.fr>



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

* Re: [gentoo-dev] Re: [BUG and PATCH] Does dcron need a space at the end of each
  2002-03-21 20:34   ` Christian HOFFMANN
@ 2002-03-22 19:59     ` Matthew Dillon
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Dillon @ 2002-03-22 19:59 UTC (permalink / raw
  To: Christian HOFFMANN; +Cc: gentoo-dev

:
:I tested your proposed modification, it works far better than mine.
:
:I was just wrong in the beginning, my problem was lines starting with a 
:space (for allignment purpose) and my patch break the others tasks on 
:lines not starting with a space.
:
:Now dcron work for lines starting or not with a space or tabs or...
:
:For your information dcron2.7 is the standard cron for the Gentoo 
:Linux distribution. http://www.gentoo.org

    Ok.  I have updated the master code on my site, which you can get to
    via:

	http://apollo.backplane.com/FreeSrc/

    I can't test it under Linux so its up to you folks to download it,
    compare it with the version you are distributing now, test it, and 
    so forth.  I have included the meat of the bug fix below.

							-Matt

Index: database.c
===================================================================
RCS file: /cvs/dcron/database.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- database.c	10 Feb 1999 06:22:37 -0000	1.1
+++ database.c	22 Mar 2002 17:56:55 -0000	1.2
@@ -174,7 +174,7 @@
 			++ptr;
 
 		    if (*ptr)
-			buf[strlen(ptr)-1] = 0;
+			ptr[strlen(ptr)-1] = 0;
 
 		    if (*ptr == 0 || *ptr == '#')
 			continue;


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

end of thread, other threads:[~2002-03-22 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-20 21:40 [gentoo-dev] [BUG and PATCH] Does dcron need a space at the end of each Christian HOFFMANN
2002-03-21  2:12 ` [gentoo-dev] " Matthew Dillon
2002-03-21 20:34   ` Christian HOFFMANN
2002-03-22 19:59     ` Matthew Dillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox