[php-maint] Bug#344481: Mysterious crash in php4-rrdtool

Artur R. Czechowski arturcz at hell.pl
Fri Dec 23 01:44:21 UTC 2005


On Thu, Dec 22, 2005 at 04:45:25PM -0800, Steve Langasek wrote:
> On Fri, Dec 23, 2005 at 01:09:31AM +0100, Artur R. Czechowski wrote:
> > The rrd_graph_options() gets a string with parameters. The begin if this
> > string is (at least in my case, but this is common value in rrdtools):
> > --start -2d
> > The rrd_graph_options calls getopt_long to split parameters into tokens.
> > You can see the code in rrdtool's sources, file rrd_graph.c, line 2965.
> > getopt_long reckognises the --start parameter correctly and, according to
> > struct option returns opt as s. But, for some strange reasons, it sets
> > optarg for NULL.
> Erm, don't you need to write --start=-2d if you want an optarg that begins
> with a hyphen?
No. The "s:" in optstring and 1 as a second value in {"start",1,0,'s'} always
makes next token a parameter.

Try to compile and run following example:

#include <stdio.h>
#include <getopt.h>
struct option opt[] = {
	{"letter-a",1,0,'a'},
	{"letter-b",1,0,'b'},
	{0,0,0,0}
};
int main(int argc,char **argv) {
	int idx,c;
	while((c=getopt_long(argc,argv,"a:b:",opt,&idx))!=EOF)
		printf("option: %c, optarg: %s\n",c,optarg);
};

It gives:
arturcz at szczaw:/tmp/g$ ./gol --letter-a -2d
option: a, optarg: -2d
arturcz at szczaw:/tmp/g$ ./gol -a -2d
option: a, optarg: -2d

> Anyway, I don't see where any of the other packages you've mentioned are
> providing a broken implementation of getopt_long.  Shouldn't you check where
> this "broken" function is coming from, and file the bug there?
Wish I know how to do it. Simple grep in sources gives no results.
That's why it is so mysterious to me and I am asking for help at wider
auditorium.

Because only apache/php4(module) is a problematic combination I suspect
an apache. If it is sufficient for you I have no objections against
reassigning this bug to apache package.

Best regards
	Artur
-- 
<Beowulf> here http://www.messagelabs.com/home/default.asp they say that
          spam is more than 50% of email...
<Beowulf> let's start some flames in -devel!
* Beowulf writes something about Sarge not being released
					/from #debian-devel/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20051223/45788362/attachment.pgp


More information about the pkg-php-maint mailing list