Re: [Bug-wget] bug #46584: wget --spider always returns zero exit status
It's correct. That is because `git format-patch` is often used together with `git send-email`. It formats the patch as an email that can be directly passed to your MUA. What you sent is a correct form of the patch that is easy for us to apply. However, notice that you sent the patch on the wrong thread. I'll review the patch on the correct thread. * pwa...@gmail.net.pl[160919 19:07]: I'm not yet fully familiar with git format-patch (weird for me that it's adding email-like headers. Is it suppose to be email creation tool for patches?), I believe it will work for you. Thanks Piotr W dniu 19.09.2016 o 18:56, Darshit Shah pisze: Hi Piotr, How did you create this patch? Because git refuses to accept it. Patch format detection fails. Please regenerate all your patches using `git format-patch` so that we can apply the patches locally. * Wajda, Piotr [160916 22:48]: Hi, I'd like to start contributing to wget. I've chosen http://savannah.gnu.org/bugs/index.php?46584 for a good start. Please let me know if attached patch is sane. Thanks Piotr diff --git a/src/ftp.c b/src/ftp.c index 39f20fa..e05d57b 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1191,6 +1191,7 @@ Error in server response, closing control connection.\n")); if (opt.spider) { bool exists = false; + bool all_exist = true; struct fileinfo *f; uerr_t _res = ftp_get_listing (u, original_url, con, ); /* Set the DO_RETR command flag again, because it gets unset when @@ -1206,6 +1207,8 @@ Error in server response, closing control connection.\n")); { exists = true; break; +} else { + all_exist = false; } f = f->next; } @@ -1226,7 +1229,11 @@ Error in server response, closing control connection.\n")); con->csock = -1; fd_close (dtsock); fd_close (local_sock); - return RETRFINISHED; + if(all_exist) { + return RETRFINISHED; + } else { + return FTPNSFOD; + } } if (opt.verbose) From f0ccb77460d4bd41b45de7d2ddb54294b91e9e3b Mon Sep 17 00:00:00 2001 From: ja Date: Sun, 18 Sep 2016 18:47:37 +0200 Subject: [PATCH] Don't print to stdout in background. [31;01m---[39;49;00m src/main.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) [01mdiff --git a/src/main.c b/src/main.c[39;49;00m [01mindex ac6ee2c..f324253 100644[39;49;00m [31;01m--- a/src/main.c[39;49;00m [32m+++ b/src/main.c[39;49;00m [01m[35m@@ -113,7 +113,7 @@ int numurls = 0;[39;49;00m setting up gettext's message catalog using bindtextdomain and textdomain. Does nothing if NLS is disabled or missing. */ [31;01m-#if defined(SIGHUP) || defined(SIGUSR1)[39;49;00m [32m+#if defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)[39;49;00m /* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it will proceed operation as usual, trying to write into a log file. If that is impossible, the output will be turned off. */ [01m[35m@@ -131,12 +131,20 @@ redirect_output_signal (int sig)[39;49;00m if (sig == SIGUSR1) signal_name = "SIGUSR1"; #endif [32m+#ifdef SIGCONT[39;49;00m [32m+ if(sig == SIGCONT) {[39;49;00m [32m+/* If process goes to foreground, don't redirect output */[39;49;00m [32m+if(getpgrp() == tcgetpgrp(STDOUT_FILENO))[39;49;00m [32m+ return;[39;49;00m [32m+signal_name = "SIGCONT";[39;49;00m [32m+ }[39;49;00m [32m+#endif[39;49;00m log_request_redirect_output (signal_name); progress_schedule_redirect (); signal (sig, redirect_output_signal); } [31;01m-#endif /* defined(SIGHUP) || defined(SIGUSR1) */[39;49;00m [32m+#endif /* defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)*/[39;49;00m static void i18n_initialize (void) [01m[35m@@ -2003,6 +2011,9 @@ only if outputting to a regular file.\n"));[39;49;00m #ifdef SIGUSR1 signal (SIGUSR1, redirect_output_signal); #endif [32m+#ifdef SIGCONT[39;49;00m [32m+ signal (SIGCONT, redirect_output_signal);[39;49;00m [32m+#endif[39;49;00m #ifdef SIGPIPE /* Writing to a closed socket normally signals SIGPIPE, and the process exits. What we want is to ignore SIGPIPE and just check [31;01m-- [39;49;00m 1.7.9.5 -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6 signature.asc Description: PGP signature
Re: [Bug-wget] bug #45790: wget prints it's progress even when background
Hi Piotr, The patch looks fine. However, when Wget is foregrounded again, the progress bar remains invisible. When the process is foregrounded again, you should undo the effects of `redirect_output_signal()` * pwa...@gmail.net.pl[160919 18:01]: Hi Darshit, Sorry for pasting patch into email incorrectly. I've send 2 other patches before, but as attachments, so they should be fine. Thanks Piotr W dniu 19.09.2016 o 17:28, Darshit Shah pisze: Hi Piotr, Thanks for your interest in Wget. I shall review your patch soon. However, for future reference please do not send patches that are pasted into the mail like this. It makes it extremely difficult for us to apply the patch. I was unable to apply the provided diff after simply saving your email. Either use `git format-patch` to create a patch file that you attach to the emails, or use `git send-email` to correctly send an inline diff. * pwa...@gmail.net.pl [160918 18:41]: Hi, I've implemented fix for bug #45790. Basically I used approach Noel showed in comment. Please check below diff if it's sane. diff --git a/src/main.c b/src/main.c index ac6ee2c..f324253 100644 --- a/src/main.c +++ b/src/main.c @@ -113,7 +113,7 @@ int numurls = 0; setting up gettext's message catalog using bindtextdomain and textdomain. Does nothing if NLS is disabled or missing. */ -#if defined(SIGHUP) || defined(SIGUSR1) +#if defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT) /* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it will proceed operation as usual, trying to write into a log file. If that is impossible, the output will be turned off. */ @@ -131,12 +131,20 @@ redirect_output_signal (int sig) if (sig == SIGUSR1) signal_name = "SIGUSR1"; #endif +#ifdef SIGCONT + if(sig == SIGCONT) { +/* If process goes to foreground, don't redirect output */ +if(getpgrp() == tcgetpgrp(STDOUT_FILENO)) + return; +signal_name = "SIGCONT"; + } +#endif log_request_redirect_output (signal_name); progress_schedule_redirect (); signal (sig, redirect_output_signal); } -#endif /* defined(SIGHUP) || defined(SIGUSR1) */ +#endif /* defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)*/ static void i18n_initialize (void) @@ -2003,6 +2011,9 @@ only if outputting to a regular file.\n")); #ifdef SIGUSR1 signal (SIGUSR1, redirect_output_signal); #endif +#ifdef SIGCONT + signal (SIGCONT, redirect_output_signal); +#endif #ifdef SIGPIPE /* Writing to a closed socket normally signals SIGPIPE, and the process exits. What we want is to ignore SIGPIPE and just check Thanks Piotr -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6 signature.asc Description: PGP signature
Re: [Bug-wget] bug #45790: wget prints it's progress even when background
Ok, I'll fix that. Thanks Piotr W dniu 19.09.2016 o 19:30, Darshit Shah pisze: Hi Piotr, The patch looks fine. However, when Wget is foregrounded again, the progress bar remains invisible. When the process is foregrounded again, you should undo the effects of `redirect_output_signal()` * pwa...@gmail.net.pl[160919 18:01]: Hi Darshit, Sorry for pasting patch into email incorrectly. I've send 2 other patches before, but as attachments, so they should be fine. Thanks Piotr W dniu 19.09.2016 o 17:28, Darshit Shah pisze: Hi Piotr, Thanks for your interest in Wget. I shall review your patch soon. However, for future reference please do not send patches that are pasted into the mail like this. It makes it extremely difficult for us to apply the patch. I was unable to apply the provided diff after simply saving your email. Either use `git format-patch` to create a patch file that you attach to the emails, or use `git send-email` to correctly send an inline diff. * pwa...@gmail.net.pl [160918 18:41]: Hi, I've implemented fix for bug #45790. Basically I used approach Noel showed in comment. Please check below diff if it's sane. diff --git a/src/main.c b/src/main.c index ac6ee2c..f324253 100644 --- a/src/main.c +++ b/src/main.c @@ -113,7 +113,7 @@ int numurls = 0; setting up gettext's message catalog using bindtextdomain and textdomain. Does nothing if NLS is disabled or missing. */ -#if defined(SIGHUP) || defined(SIGUSR1) +#if defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT) /* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it will proceed operation as usual, trying to write into a log file. If that is impossible, the output will be turned off. */ @@ -131,12 +131,20 @@ redirect_output_signal (int sig) if (sig == SIGUSR1) signal_name = "SIGUSR1"; #endif +#ifdef SIGCONT + if(sig == SIGCONT) { +/* If process goes to foreground, don't redirect output */ +if(getpgrp() == tcgetpgrp(STDOUT_FILENO)) + return; +signal_name = "SIGCONT"; + } +#endif log_request_redirect_output (signal_name); progress_schedule_redirect (); signal (sig, redirect_output_signal); } -#endif /* defined(SIGHUP) || defined(SIGUSR1) */ +#endif /* defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)*/ static void i18n_initialize (void) @@ -2003,6 +2011,9 @@ only if outputting to a regular file.\n")); #ifdef SIGUSR1 signal (SIGUSR1, redirect_output_signal); #endif +#ifdef SIGCONT + signal (SIGCONT, redirect_output_signal); +#endif #ifdef SIGPIPE /* Writing to a closed socket normally signals SIGPIPE, and the process exits. What we want is to ignore SIGPIPE and just check Thanks Piotr
Re: [Bug-wget] bug #48811: netrc password wins over interactive --ask-password
Sure. W dniu 19.09.2016 o 19:07, Darshit Shah pisze: This patch looks good. However, if we are touching this part of the code, I would like to take the opportunity to clean it up as well. From a brief glance it looks like the code for check for username and password can be abstracted into its own function. This way we can improve readability and reduce redundant code. Could you please refactor this so that both http and ftp use the same function to read the username and password? * Wajda, Piotr[160916 23:47]: I've tried to tackle another bug. I've moved reading from .netrc file to the end, when no user and no passwd is defined (for both http and ftp). Please review. Thanks Piotr -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6
Re: [Bug-wget] bug #46584: wget --spider always returns zero exit status
Apart from the patch format, the patch itself looks good. @Giuseppe: We will require Copyright assignments for Piotr right? This patch may be small, but there are a couple others in the pipeline. * Wajda, Piotr[160916 22:48]: Hi, I'd like to start contributing to wget. I've chosen http://savannah.gnu.org/bugs/index.php?46584 for a good start. Please let me know if attached patch is sane. Thanks Piotr diff --git a/src/ftp.c b/src/ftp.c index 39f20fa..e05d57b 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1191,6 +1191,7 @@ Error in server response, closing control connection.\n")); if (opt.spider) { bool exists = false; + bool all_exist = true; struct fileinfo *f; uerr_t _res = ftp_get_listing (u, original_url, con, ); /* Set the DO_RETR command flag again, because it gets unset when @@ -1206,6 +1207,8 @@ Error in server response, closing control connection.\n")); { exists = true; break; +} else { + all_exist = false; } f = f->next; } @@ -1226,7 +1229,11 @@ Error in server response, closing control connection.\n")); con->csock = -1; fd_close (dtsock); fd_close (local_sock); - return RETRFINISHED; + if(all_exist) { + return RETRFINISHED; + } else { + return FTPNSFOD; + } } if (opt.verbose) -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6 signature.asc Description: PGP signature
Re: [Bug-wget] bug #48811: netrc password wins over interactive --ask-password
This patch looks good. However, if we are touching this part of the code, I would like to take the opportunity to clean it up as well. From a brief glance it looks like the code for check for username and password can be abstracted into its own function. This way we can improve readability and reduce redundant code. Could you please refactor this so that both http and ftp use the same function to read the username and password? * Wajda, Piotr[160916 23:47]: I've tried to tackle another bug. I've moved reading from .netrc file to the end, when no user and no passwd is defined (for both http and ftp). Please review. Thanks Piotr -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6 signature.asc Description: PGP signature
Re: [Bug-wget] bug #46584: wget --spider always returns zero exit status
I'm not yet fully familiar with git format-patch (weird for me that it's adding email-like headers. Is it suppose to be email creation tool for patches?), I believe it will work for you. Thanks Piotr W dniu 19.09.2016 o 18:56, Darshit Shah pisze: Hi Piotr, How did you create this patch? Because git refuses to accept it. Patch format detection fails. Please regenerate all your patches using `git format-patch` so that we can apply the patches locally. * Wajda, Piotr[160916 22:48]: Hi, I'd like to start contributing to wget. I've chosen http://savannah.gnu.org/bugs/index.php?46584 for a good start. Please let me know if attached patch is sane. Thanks Piotr diff --git a/src/ftp.c b/src/ftp.c index 39f20fa..e05d57b 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1191,6 +1191,7 @@ Error in server response, closing control connection.\n")); if (opt.spider) { bool exists = false; + bool all_exist = true; struct fileinfo *f; uerr_t _res = ftp_get_listing (u, original_url, con, ); /* Set the DO_RETR command flag again, because it gets unset when @@ -1206,6 +1207,8 @@ Error in server response, closing control connection.\n")); { exists = true; break; +} else { + all_exist = false; } f = f->next; } @@ -1226,7 +1229,11 @@ Error in server response, closing control connection.\n")); con->csock = -1; fd_close (dtsock); fd_close (local_sock); - return RETRFINISHED; + if(all_exist) { + return RETRFINISHED; + } else { + return FTPNSFOD; + } } if (opt.verbose) >From f0ccb77460d4bd41b45de7d2ddb54294b91e9e3b Mon Sep 17 00:00:00 2001 From: ja Date: Sun, 18 Sep 2016 18:47:37 +0200 Subject: [PATCH] Don't print to stdout in background. --- src/main.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index ac6ee2c..f324253 100644 --- a/src/main.c +++ b/src/main.c @@ -113,7 +113,7 @@ int numurls = 0; setting up gettext's message catalog using bindtextdomain and textdomain. Does nothing if NLS is disabled or missing. */ -#if defined(SIGHUP) || defined(SIGUSR1) +#if defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT) /* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it will proceed operation as usual, trying to write into a log file. If that is impossible, the output will be turned off. */ @@ -131,12 +131,20 @@ redirect_output_signal (int sig) if (sig == SIGUSR1) signal_name = "SIGUSR1"; #endif +#ifdef SIGCONT + if(sig == SIGCONT) { +/* If process goes to foreground, don't redirect output */ +if(getpgrp() == tcgetpgrp(STDOUT_FILENO)) + return; +signal_name = "SIGCONT"; + } +#endif log_request_redirect_output (signal_name); progress_schedule_redirect (); signal (sig, redirect_output_signal); } -#endif /* defined(SIGHUP) || defined(SIGUSR1) */ +#endif /* defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)*/ static void i18n_initialize (void) @@ -2003,6 +2011,9 @@ only if outputting to a regular file.\n")); #ifdef SIGUSR1 signal (SIGUSR1, redirect_output_signal); #endif +#ifdef SIGCONT + signal (SIGCONT, redirect_output_signal); +#endif #ifdef SIGPIPE /* Writing to a closed socket normally signals SIGPIPE, and the process exits. What we want is to ignore SIGPIPE and just check -- 1.7.9.5
Re: [Bug-wget] bug #46584: wget --spider always returns zero exit status
Hi Piotr, How did you create this patch? Because git refuses to accept it. Patch format detection fails. Please regenerate all your patches using `git format-patch` so that we can apply the patches locally. * Wajda, Piotr[160916 22:48]: Hi, I'd like to start contributing to wget. I've chosen http://savannah.gnu.org/bugs/index.php?46584 for a good start. Please let me know if attached patch is sane. Thanks Piotr diff --git a/src/ftp.c b/src/ftp.c index 39f20fa..e05d57b 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1191,6 +1191,7 @@ Error in server response, closing control connection.\n")); if (opt.spider) { bool exists = false; + bool all_exist = true; struct fileinfo *f; uerr_t _res = ftp_get_listing (u, original_url, con, ); /* Set the DO_RETR command flag again, because it gets unset when @@ -1206,6 +1207,8 @@ Error in server response, closing control connection.\n")); { exists = true; break; +} else { + all_exist = false; } f = f->next; } @@ -1226,7 +1229,11 @@ Error in server response, closing control connection.\n")); con->csock = -1; fd_close (dtsock); fd_close (local_sock); - return RETRFINISHED; + if(all_exist) { + return RETRFINISHED; + } else { + return FTPNSFOD; + } } if (opt.verbose) -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6 signature.asc Description: PGP signature
Re: [Bug-wget] bug #45790: wget prints it's progress even when background
Hi Darshit, Sorry for pasting patch into email incorrectly. I've send 2 other patches before, but as attachments, so they should be fine. Thanks Piotr W dniu 19.09.2016 o 17:28, Darshit Shah pisze: Hi Piotr, Thanks for your interest in Wget. I shall review your patch soon. However, for future reference please do not send patches that are pasted into the mail like this. It makes it extremely difficult for us to apply the patch. I was unable to apply the provided diff after simply saving your email. Either use `git format-patch` to create a patch file that you attach to the emails, or use `git send-email` to correctly send an inline diff. * pwa...@gmail.net.pl[160918 18:41]: Hi, I've implemented fix for bug #45790. Basically I used approach Noel showed in comment. Please check below diff if it's sane. diff --git a/src/main.c b/src/main.c index ac6ee2c..f324253 100644 --- a/src/main.c +++ b/src/main.c @@ -113,7 +113,7 @@ int numurls = 0; setting up gettext's message catalog using bindtextdomain and textdomain. Does nothing if NLS is disabled or missing. */ -#if defined(SIGHUP) || defined(SIGUSR1) +#if defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT) /* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it will proceed operation as usual, trying to write into a log file. If that is impossible, the output will be turned off. */ @@ -131,12 +131,20 @@ redirect_output_signal (int sig) if (sig == SIGUSR1) signal_name = "SIGUSR1"; #endif +#ifdef SIGCONT + if(sig == SIGCONT) { +/* If process goes to foreground, don't redirect output */ +if(getpgrp() == tcgetpgrp(STDOUT_FILENO)) + return; +signal_name = "SIGCONT"; + } +#endif log_request_redirect_output (signal_name); progress_schedule_redirect (); signal (sig, redirect_output_signal); } -#endif /* defined(SIGHUP) || defined(SIGUSR1) */ +#endif /* defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)*/ static void i18n_initialize (void) @@ -2003,6 +2011,9 @@ only if outputting to a regular file.\n")); #ifdef SIGUSR1 signal (SIGUSR1, redirect_output_signal); #endif +#ifdef SIGCONT + signal (SIGCONT, redirect_output_signal); +#endif #ifdef SIGPIPE /* Writing to a closed socket normally signals SIGPIPE, and the process exits. What we want is to ignore SIGPIPE and just check Thanks Piotr
[Bug-wget] Still Failing: darnir/wget#85 (master - a2c4849)
Build Update for darnir/wget - Build: #85 Status: Still Failing Duration: 7 minutes and 19 seconds Commit: a2c4849 (master) Author: Tim Rühsen Message: Fix crash on 'srcset' inline URIs * src/html-url.c (tag_handle_img): Check append_url() for NULL return value before dereference. Crashed reproducable with parsing srcset="data:..." inline data. Reported-by: Coverity View the changeset: https://github.com/darnir/wget/compare/796e30dcea1e...a2c4849900d1 View the full build log and details: https://travis-ci.org/darnir/wget/builds/161062955 -- You can configure recipients for build notifications in your .travis.yml file. See https://docs.travis-ci.com/user/notifications
Re: [Bug-wget] bug #45790: wget prints it's progress even when background
Hi Piotr, Thanks for your interest in Wget. I shall review your patch soon. However, for future reference please do not send patches that are pasted into the mail like this. It makes it extremely difficult for us to apply the patch. I was unable to apply the provided diff after simply saving your email. Either use `git format-patch` to create a patch file that you attach to the emails, or use `git send-email` to correctly send an inline diff. * pwa...@gmail.net.pl[160918 18:41]: Hi, I've implemented fix for bug #45790. Basically I used approach Noel showed in comment. Please check below diff if it's sane. diff --git a/src/main.c b/src/main.c index ac6ee2c..f324253 100644 --- a/src/main.c +++ b/src/main.c @@ -113,7 +113,7 @@ int numurls = 0; setting up gettext's message catalog using bindtextdomain and textdomain. Does nothing if NLS is disabled or missing. */ -#if defined(SIGHUP) || defined(SIGUSR1) +#if defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT) /* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it will proceed operation as usual, trying to write into a log file. If that is impossible, the output will be turned off. */ @@ -131,12 +131,20 @@ redirect_output_signal (int sig) if (sig == SIGUSR1) signal_name = "SIGUSR1"; #endif +#ifdef SIGCONT + if(sig == SIGCONT) { +/* If process goes to foreground, don't redirect output */ +if(getpgrp() == tcgetpgrp(STDOUT_FILENO)) + return; +signal_name = "SIGCONT"; + } +#endif log_request_redirect_output (signal_name); progress_schedule_redirect (); signal (sig, redirect_output_signal); } -#endif /* defined(SIGHUP) || defined(SIGUSR1) */ +#endif /* defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)*/ static void i18n_initialize (void) @@ -2003,6 +2011,9 @@ only if outputting to a regular file.\n")); #ifdef SIGUSR1 signal (SIGUSR1, redirect_output_signal); #endif +#ifdef SIGCONT + signal (SIGCONT, redirect_output_signal); +#endif #ifdef SIGPIPE /* Writing to a closed socket normally signals SIGPIPE, and the process exits. What we want is to ignore SIGPIPE and just check Thanks Piotr -- Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6 signature.asc Description: PGP signature