[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Segmentation fault with current development version of wg

From: Tim Rühsen
Subject: Re: [Bug-wget] Segmentation fault with current development version of wget
Date: Wed, 1 May 2013 21:19:32 +0200
User-agent: KMail/1.13.7 (Linux/3.7-trunk-amd64; KDE/4.8.4; x86_64; ; )

Am Mittwoch, 1. Mai 2013 schrieb Darshit Shah:
> First, sorry for the quick and dirty hack which was the perfect example of
> how NOT to do things.

Than it was a good example ;-)

> Secondly, it lies upon me that this feature wasn't tested before submitting
> the patch. I had however relied on the Test Environment and since it passed
> everything there, I thought it was working correctly. Guess, we should add
> a test for this soon. --recursive is a commonly used switch with Wget and
> not having a test to prevent regressions on it is very bad.

There are several tests using -r.
The question is why the problem doesn't come out.

> I am fixing this issue, but it is a terribly ugly hack. If someone could
> help improve it I'd be most truly grateful.
> I have a couple of ideas, but I will need to work them out and implement
> them when I have the time.
> The reason it has to be so ugly is that, we cannot use strcmp or strcasecmp
> on a NULL String, and we cannot initialize opt.method since that would
> break some sanity checks which are in place so that --post-* and --body-*
> commands don't conflict with each other.

Your test isn't really ugly.
I (and most C programmers) favor
        opt.method && strcasecmp(opt.method,"POST") == 0
instead of
        opt.method ? strcasecmp(opt.method,"POST") == 0 : false
But that is not really important.

It is pretty common, that one or both args to strcmp may be NULL. The really 
ugly thing is, that there are no string function alternatives that handle NULL 
pointers. I regularly use my own versions like strcmp_null() to avoid extra 

Regards, Tim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]