Thanks for the encouragement! I've attached a patch which should tell
the user there is a problem with the system wgetrc file and exit. Seems
suspiciously simple, can anyone spot any problems with it?
Reza Snowdon
On Wed, 2010-06-09 at 19:58 -0700, Micah Cowan wrote:
> On 06/09/2010 03:23 PM, [email protected] wrote:
> > Hi all
> >
> > I'm interested in contributing to wget, I spotted the wgetrc
> > (http://savannah.gnu.org/bugs/?20370) problem and thought this could be
> > a good starting point, however, when viewing the code it seems as
> > thought this is not an issue any more. Is the savannah page kept up to
> > date? I'd like some suggestion regarding which smaller problems could be
> > good to pursue for someone who isn't too familiar with the code base
> > (but hopes to be eventually :)).
>
> It's generally kept up-to-date, but mistakes do happen. However, from my
> reading of the current code, it's still an issue: we save away the
> results of running the system wgetrc, but always attempt to parse the
> user wgetrc even if we already know the system wgetrc failed.
>
> This should be a very, very simple thing to fix, and small enough that
> you shouldn't have to sign papers for it. Sounds like a great place to
> start!
>
--- wget_clean/wget/src/init.c 2010-06-11 00:31:32.000000000 +0100
+++ wget/src/init.c 2010-06-11 00:32:37.000000000 +0100
@@ -526,7 +526,8 @@
ln = 1;
while ((line = read_whole_line (fp)) != NULL)
{
- char *com = NULL, *val = NULL;
+
+ char *com = NULL, *val = NULL;
int comind;
/* Parse the line. */
@@ -587,6 +588,12 @@
else if (file_exists_p (SYSTEM_WGETRC))
ok &= run_wgetrc (SYSTEM_WGETRC);
#endif
+ /*If there are any problems parsing the system wgetrc file, tell the user
and exit*/
+ if (!ok)
+ {
+ fprintf(stderr, _("Parsing system wgetrc file failed; please check
'%s'.\n"), SYSTEM_WGETRC);
+ exit(2);
+ }
/* Override it with your own, if one exists. */
file = wgetrc_file_name ();
if (!file)