From d733dbc7031aaa417e45c38a34a9b72813176bbd Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 27 May 2010 12:45:15 +0200 Subject: [PATCH] Exit with failure if -k is specified and -O is not a regular file. --- NEWS | 2 ++ doc/ChangeLog | 63 +++++++++++++++++++++++++++------------------------ doc/wget.texi | 3 ++- src/ChangeLog | 5 ++++ src/main.c | 7 ++++++ 5 files changed, 50 insertions(+), 30 deletions(-) diff --git a/NEWS b/NEWS index e6cc336d..6faae62e 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ Please send GNU Wget bug reports to . ** Ignore zero length domains in $no_proxy. ** Set new cookies after an authorization failure. + +** Exit with failure if -k is specified and -O is not a regular file. * Changes in Wget 1.12 diff --git a/doc/ChangeLog b/doc/ChangeLog index 3193d925..f04334d6 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2010-05-27 Giuseppe Scrivano + + * wget.texi (Download Options): Document that -k can be used with -O + only with regular files. + 2010-05-08 Giuseppe Scrivano * Makefile.am: Update copyright years. @@ -89,10 +94,10 @@ 2008-11-15 Steven Schubiger - * sample.wgetrc: Comment the waitretry "default" value, + * sample.wgetrc: Comment the waitretry "default" value, because there is a global one now. - * wget.texi (Download Options): Mention the global + * wget.texi (Download Options): Mention the global default value. 2008-11-10 Micah Cowan @@ -104,7 +109,7 @@ added subsection headings. Update node pointers. - + 2008-11-05 Micah Cowan * wget.texi: Move --no-http-keep-alive from FTP Options to HTTP @@ -123,7 +128,7 @@ 2008-09-30 Steven Schubiger - * wget.texi (Wgetrc Commands): Add default_page, save_headers, + * wget.texi (Wgetrc Commands): Add default_page, save_headers, spider and user_agent to the list of recognized commands. 2008-09-10 Michael Kessler @@ -584,15 +589,15 @@ to 1.4. 2005-02-11 Mauro Tortonesi - + * wget.texi: Added Simone Piunno as new contributor. - + 2005-01-01 Mauro Tortonesi * wget.texi: Updated copyright information, added new contributors. 2004-11-20 Hans-Andreas Engel - + * wget.texi: Describe limitations of combining `-O' with `-k'. 2004-05-13 Nico R. @@ -901,12 +906,12 @@ * wget.texi (Recursive Retrieval Options): Explained that you need to use -r -l1 -p to get the two levels of requisites for a page. Also made a few other wording improvements. - + 2001-03-17 Dan Harkless - * Makefile.in: Using '^' in the sed call caused a weird failure on + * Makefile.in: Using '^' in the sed call caused a weird failure on Solaris 2.6. Changed it to a ','. Defined top_builddir. - + 2001-02-23 Dan Harkless * wget.texi: Corrections, clarifications, and English fixes to @@ -915,7 +920,7 @@ Alphabetized FTP options by long option name. Mentioned that .listing symlinked to /etc/passwd is not a security hole, but that other files could be, so root shouldn't run wget in user dirs. - + 2001-02-22 Dan Harkless * Makefile.in: Make wget man page and install it if we have @@ -928,12 +933,12 @@ fails -- fixed call of texi2pod.pl that did this wrong. * texi2pod.pl: Removed from CVS. Now automatically generated. - + * texi2pod.pl.in: This new file is processed into texi2pod.pl, getting the appropriate path to the Perl 5+ executable on this system and becoming executable (CVS files, by contrast, don't arrive executable). - + 2001-02-19 Dan Harkless * wget.texi (Download Options): Further improvement to --continue @@ -944,20 +949,20 @@ * wget.texi (Reporting Bugs): Deleted the setence about Cc-ing the bug report to Wget mailing list as the bug report address is an - alias for the mailing ist anyway. + alias for the mailing ist anyway. (Mailing List): Added URL for the alternate archive. - + * wget.texi: Bunch of cosmetical changes. - + * Makefile.in: Added targets for manpage generation using texi2pod.pl and pod2man (comes with Perl5). As we cannot rely on Perl5 being available on the system, manpage is not being built automatically. Updated '*clean' targets to remove 'sample.wgetrc.munged...', 'wget.pod', and 'wget.man'. - + * texi2pod.pl: New file copied from GCC distribution to facilitate automatic manpage generation. - + 2001-01-09 Dan Harkless * wget.texi (Download Options): Did a bunch of clarification and @@ -969,7 +974,7 @@ the best way to go about my aim. Removed them in favor of: * ChangeLog-branches/1.6_branch.ChangeLog: New file. - + 2000-12-31 Dan Harkless * Makefile.in (distclean): sample.wgetrc.munged_for_texi_inclusion @@ -978,11 +983,11 @@ regenerated, forcing people to have makeinfo installed unnecessarily. We could use a kludge of a 0-length file in the distro, but the file isn't that big and should compress very well. - + * wget.texi: Changed "VERSION 1.5.3+dev" to "VERSION 1.7-dev" and "UPDATED Feb 2000" to "UPDATED Dec 2000". Like the comment in the file says, it'd be nice if these were handled automatically... - + * ChangeLog: Since this flat file doesn't have multiple branches, looking at the dates would make you think that things went into 1.6 that actually just went into the 1.7-dev branch. Added "[Not @@ -1039,11 +1044,11 @@ * wget.texi (Recursive Retrieval Options): Improved --delete-after docs. (Download Options): Documented Rob Mayoff's new --bind-address option. (Wgetrc Commands): Documented Rob Mayoff's new bind_address command. - + 2000-10-20 Dan Harkless * wget.texi (Recursive Retrieval Options): Sugg. -E on 1-page download. - + 2000-10-19 Dan Harkless * wget.texi (HTTP Options): Documented my new -E / --html-extension. @@ -1051,7 +1056,7 @@ John Daily's "quad" values (which I renamed to "lockable Boolean"). When I documented Damir Dzeko's --referer, I forgot to add the .wgetrc equivalent; mentioned the "referrer" spelling issue. - + 2000-10-09 Dan Harkless * wget.texi (FTP Options): --retr-symlinks wasn't documented properly. @@ -1060,7 +1065,7 @@ * wget.texi (Recursive Retrieval Options): Documented new -p option. (Wgetrc Commands): Documented -p's equvialent, page_requisites. - + 2000-08-23 Dan Harkless * wget.texi (Download Options): Using -c on a file that's already fully @@ -1069,7 +1074,7 @@ * wget.texi (Logging and Input File Options): -B / --base was not documented as a separate item, and the .wgetrc version was misleading. - * wget.texi (Wgetrc Commands): Changed all instances of + * wget.texi (Wgetrc Commands): Changed all instances of ", the same as" to the more grammatical " -- the same as". 2000-08-22 Dan Harkless @@ -1095,12 +1100,12 @@ 2000-04-18 Dan Harkless * sample.wgetrc: Realized I put a global setting in the local section. - + 2000-04-13 Dan Harkless * Makefile.in (sample.wgetrc.munged_for_texi_inclusion): Added build, dependencies, and distclean cleanup of this new file. - + * sample.wgetrc: Uncommented waitretry and set it to 10, clarified some wording, and re-wrapped some text to 71 columns due to @sample indentation in wget.texi. @@ -1117,7 +1122,7 @@ times I ran `make install' after changing sample.wgetrc. Added blank lines around the message and a "", and reworded the message to be a bit more clear. - + * sample.wgetrc: Added entries for backup_converted and waitretry. * wget.texi (Download Options and Wgetrc Commands): Herold Heiko diff --git a/doc/wget.texi b/doc/wget.texi index 83894258..d5eaf4e5 100644 --- a/doc/wget.texi +++ b/doc/wget.texi @@ -579,7 +579,8 @@ some cases where this behavior can actually have some use. Note that a combination with @samp{-k} is only permitted when downloading a single document, as in that case it will just convert all relative URIs to external ones; @samp{-k} makes no sense for -multiple URIs when they're all being downloaded to a single file. +multiple URIs when they're all being downloaded to a single file; +@samp{-k} can be used only when the output is a regular file. @cindex clobbering, file @cindex downloading multiple times diff --git a/src/ChangeLog b/src/ChangeLog index cf478621..a84ff378 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-05-27 Giuseppe Scrivano + + * main.c (main): Exit with failure when -k is specified and -O is not + a regular file. + 2010-05-27 Giuseppe Scrivano * http.c (gethttp): Consider new cookies retrieved when the diff --git a/src/main.c b/src/main.c index 8cacb893..9edec13b 100644 --- a/src/main.c +++ b/src/main.c @@ -1217,6 +1217,13 @@ WARNING: Can't reopen standard output in binary mode;\n\ if (fstat (fileno (output_stream), &st) == 0 && S_ISREG (st.st_mode)) output_stream_regular = true; } + if (!output_stream_regular && opt.convert_links) + { + printf (_("-k can be used together with -O only if outputting to \ +a regular file.\n")); + print_usage (); + exit(1); + } } #ifdef __VMS -- 2.39.2