Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com X-Server-Uuid: 2d3b7162-db1d-11d3-b8ee-0008c7dfb6f1 Message-ID: <718198F862F1D411B10F0002A50A4DB101A4F098@e90wwce3.dx.deere.com> From: "Polley Christopher W" To: "'cygwin AT cygwin DOT com'" Subject: Bug in wget 1.7 & prev init.c: wgetrc environment var Date: Thu, 8 Nov 2001 12:23:37 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) X-WSS-ID: 17F4122324739-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit In wget 1.7 and 1.6, if the WGETRC environment variable is set but the file specified is inaccessible, the message: wget: (null): No such file or directory. is displayed and the program exits with status 1. Debugging traces the problem to the following function in init.c (ca. line 261) /* Return the path to the user's .wgetrc. This is either the value of `WGETRC' environment variable, or `$HOME/.wgetrc'. If the `WGETRC' variable exists but the file does not exist, the function will exit(). */ static char * wgetrc_file_name (void) { char *env, *home; char *file = NULL; /* Try the environment. */ env = getenv ("WGETRC"); if (env && *env) { if (!file_exists_p (env)) { fprintf (stderr, "%s: %s: %s.\n", exec_name, file, strerror (errno)); exit (1); } return xstrdup (env); } .... where the error message is printed Firstly, file is a null pointer at the time that this error message is printed; env is the correct pointer to use here. Secondly, there is no explanation of why the program is looking for this file. A possible fix is as follows: 278c278 < fprintf (stderr, "%s: Unable to access WGETRC specified in environment: %s: %s.\n", exec_name, env, strerror (errno)); --- > fprintf (stderr, "%s: %s: %s.\n", exec_name, file, strerror (errno)); the resultant output is now (when WGETRC is set to c:\.wgetrc, and this file doesn't exist): wget: Unable to access WGETRC specified in environment: c:\.wgetrc: No such file or directory. Note: debugging and patching was done with version 1.6 source. I have upgraded my executable to 1.7 and the bug still exists, but I haven't obtained the source code to see if there are any changes in this function between ver 1.6 and 1.7. Warm Regards, Chris -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/