[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Wget manpage missing options
From: |
Giuseppe Scrivano |
Subject: |
Re: [Bug-wget] Wget manpage missing options |
Date: |
Wed, 10 Jul 2013 22:04:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Hi Tomas,
Tomas Hozza <address@hidden> writes:
> I tried to test the --backups with wget-1.14 and the following command
>
> wget --backups=2 http://fedoraproject.org/static/hotspot.txt
>
> but result is not what I expected based on the documentation. if you
> download the file more than once, wget will not backup the original
> file with filename <name>.<num> but rather save the new file with
> "incremented" name.
>
> I also tried wget with -N option. wget refuses to download another
> copy of the file if already present, despite of the --backups option.
>
> Hope I tested it properly.
thanks to have tested it, indeed it was working in a different way. I
don't think this feature had any user before, considering how broken it
is.
This patch should make it conformant to the documentation, if nobody
complains, I will push this series to master.
>From 9d5481e1f1f3f70f21e7f529f214da390bf6188a Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Wed, 10 Jul 2013 20:59:34 +0200
Subject: [PATCH] Make --backups work as documented
---
src/ChangeLog | 7 +++++++
src/http.c | 6 ------
src/url.c | 3 ++-
src/url.h | 6 ++++++
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 6894975..7df4037 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2013-07-10 Giuseppe Scrivano <address@hidden>
+
+ * http.c (read_response_body) [ALLOW_CLOBBER]: Move definition to..
+ * url.h [ALLOW_CLOBBER]: .. Here. Do not clobber when backups are used.
+ * url.c (url_file_name): Use the ALLOW_CLOBBER macro instead of
+ repeating the code.
+
2013-07-08 Steven M. Schweda <address@hidden>
* retr.c (rotate_backups): Support for VMS files.
diff --git a/src/http.c b/src/http.c
index 669f0fe..830a519 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1641,12 +1641,6 @@ read_response_body (struct http_stat *hs, int sock, FILE
*fp, wgint contlen,
} while (0)
#endif /* def __VMS [else] */
-/* The flags that allow clobbering the file (opening with "wb").
- Defined here to avoid repetition later. #### This will require
- rework. */
-#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
- || opt.dirstruct || opt.output_document)
-
/* Retrieve a document through HTTP protocol. It recognizes status
code, and correctly handles redirections. It closes the network
socket. If it receives an error from the functions below it, it
diff --git a/src/url.c b/src/url.c
index 5e2b9a3..bf9d697 100644
--- a/src/url.c
+++ b/src/url.c
@@ -1669,11 +1669,12 @@ url_file_name (const struct url *u, char
*replaced_filename)
2) Retrieval with regetting.
3) Timestamping is used.
4) Hierarchy is built.
+ 5) Backups are specified.
The exception is the case when file does exist and is a
directory (see `mkalldirs' for explanation). */
- if ((opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct)
+ if (ALLOW_CLOBBER
&& !(file_exists_p (fname) && !file_non_directory_p (fname)))
{
unique = fname;
diff --git a/src/url.h b/src/url.h
index b7f4366..cd3782b 100644
--- a/src/url.h
+++ b/src/url.h
@@ -47,6 +47,12 @@ as that of the covered work. */
* file descriptor. */
#define CHOMP_BUFFER 19
+/* The flags that allow clobbering the file (opening with "wb").
+ Defined here to avoid repetition later. #### This will require
+ rework. */
+#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
+ || opt.dirstruct || opt.output_document || opt.backups > 0)
+
/* Specifies how, or whether, user auth information should be included
* in URLs regenerated from URL parse structures. */
enum url_auth_mode {
--
1.8.3.1
--
Giuseppe