On 27/11/10 05:48, Micah Cowan wrote:
On 11/26/2010 03:02 PM, Reza wrote:
Hi all

I was thinking of fixing this: http://savannah.gnu.org/bugs/?20370 . I
remember the main concern being that the user wget would be unable to
recover if the system wgetrc (first file) was broken.

FWIW, I don't think that concern was ever an impediment to fixing this
bug: it had already always been the case that brokenness in the system
wgetrc would be unrecoverable. The only thing this bugfix addresses is
the fact that, even though the error is unrecoverable, wget still reads
and parses the user's config file, despite the fact that it already
knows it's going to fail.


Thanks for the replies, the attached patch should fix the problem. If anyone spots anything, do let me know :).

Reza
=== modified file 'src/ChangeLog'
--- src/ChangeLog	2010-11-22 17:04:42 +0000
+++ src/ChangeLog	2010-11-27 10:45:56 +0000
@@ -1,3 +1,9 @@
+2010-11-27  Reza Snowdon  <[email protected]> 
+
+        * init.c (initialize): If 'ok' is not zero; exit, as
+	this indicates there was a problem parsing 'SYSTEM_WGETRC'.
+        Fixes bug #20370  
+
 2010-11-22  Giuseppe Scrivano  <[email protected]>
 
 	Revert last commit.

=== modified file 'src/init.c'
--- src/init.c	2010-10-28 22:20:31 +0000
+++ src/init.c	2010-11-27 11:03:36 +0000
@@ -588,6 +588,15 @@
   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'. \
+Or specify a different file using --config\n"), SYSTEM_WGETRC);
+      exit(2);
+    }
   /* Override it with your own, if one exists.  */
   file = wgetrc_file_name ();
   if (!file)

Reply via email to