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

Artur R. Czechowski arturcz at hell.pl
Wed Jan 4 23:20:30 UTC 2006

On Thu, Dec 22, 2005 at 10:21:52PM -0800, Steve Langasek wrote:
> I'd rather see some analysis to show where the bug actually belongs instead
> of guessing and reassigning.
Well, some analysis you asked for. I use glibc-2.3.5-11 with libc6-dbg

export LD_LIBRARY_PATH=/usr/lib/debug
gdb /usr/sbin/apache
br _getopt_internal_r (it is called from getopt_long, here is the logic)
r -X
(breakpoint activated some times due to apache parameters)
I run the script calling rrd_graph and I'm inside:

#0  _getopt_internal_r (argc=22, argv=0x8141b78, 
    optstring=0xb78dcb10 "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:", longopts=0xb78f1a20, longind=0xbf81f324, long_only=0, d=0xb7d54400)
    at getopt.c:398

I set display for following expressions: argv[d->optind], d->optind,
d->optarg, optarg.

Stepping by next until getopt.c:451.

Some iteration of:
          while (d->optind < argc && NONOPTION_P)
and I have:
d->optind = 2
d->optarg = 0x0
argv[d->optind] = 0x8141be4 "--start"

Some steps inside the code. And, after getopt.c:679:
                d->optarg = argv[d->optind++];
I have:
3: d->optarg = 0x8141bfc "-2d"
2: d->optind = 4
1: argv[d->optind] = 0x8141c14 "--x-grid"

So far it's OK.
Still stepping.

Back to:
_getopt_internal (argc=22, argv=0x8141b78, 
    optstring=0xb7928b10 "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:", longopts=0xb793da20, longind=0xbfa6a7c4, long_only=0) at getopt.c:1169

There are three lines:
  optind = getopt_data.optind;
  optarg = getopt_data.optarg;
  optopt = getopt_data.optopt;

After executing those lines I have:

(gdb) print getopt_data.optind
$1 = 4
(gdb) print getopt_data.optarg
$2 = 0x8141bfc "-2d"

and (sic!):
(gdb) print optind
$4 = 4
(gdb) print optarg
$5 = 0x0

So, the question is: why the assignment in getopt.c:1170:
  optarg = getopt_data.optarg;
does not work?

I would like to remind you that getopt_long from libc works correctly
(details in this buglog) in most cases. But combination of apache, php4,
rrdtool and php4-rrdtool makes it unworking.

zjadłam ruskie i barszcz ukraiński.
ciekawe czy od tego dostanę automatycznie złotych zębów

More information about the pkg-php-maint mailing list