wget -N -O should work if only retrieving one file

Bug #363170 reported by Nonconventionally Creative
12
Affects Status Importance Assigned to Milestone
wget (Ubuntu)
New
Wishlist
Unassigned

Bug Description

Binary package hint: wget

From the man page:
           Use of -O is not intended to mean simply "use the name file instead of the one in the URL;" rather, it is analogous to shell redirection: wget -O file http://foo
           is intended to work like wget -O - http://foo > file; file will be truncated immediately, and all downloaded content will be written there.

           For this reason, -N (for timestamp-checking) is not supported in combination with -O: since file is always newly created, it will always have a very new timestamp.
           A warning will be issued if this combination is used.

However, this does not make sense if you are only downloading one url (the simple sense), and want to specify the filename, such as if downloading a url like http://example.com?page=1 to file page1.html.

Revision history for this message
Micah Cowan (micahcowan) wrote : Re: [Bug 363170] [NEW] wget -N -O should work if only retrieving one file

Nonconventionally Creative wrote:
> Public bug reported:
>
> Binary package hint: wget
>
>>From the man page:
> Use of -O is not intended to mean simply "use the name file instead of the one in the URL;" rather, it is analogous to shell redirection: wget -O file http://foo
> is intended to work like wget -O - http://foo > file; file will be truncated immediately, and all downloaded content will be written there.
>
> For this reason, -N (for timestamp-checking) is not supported in combination with -O: since file is always newly created, it will always have a very new timestamp.
> A warning will be issued if this combination is used.
>
> However, this does not make sense if you are only downloading one url
> (the simple sense), and want to specify the filename, such as if
> downloading a url like http://example.com?page=1 to file page1.html.

As far as I'm concerned, -O was somewhat mis-designed. Yet, it's far too
late to change, as many existing scripts may rely on such misfeatures.
The best we can do is consider adding better options to replace it,
rather than attempt to mess with existing functionality that works as
designed, but whose design may suffer shortcomings.

We (upstream) would like at some point to implement a fairly generic
mechanism to allow renaming files, not just a single file, but
programatically adjust every file name (perhaps via a short sed script,
etc). Doing so would not be difficult, but we have a laundry list of
more pressing things to achieve, so the reality is that it will not be
done soon (of course, if a distro such as Ubuntu chose to adopt an
appropriate patch, we would consider including it upstream as well).

This description in the manual was added because many, many people were
attempting to use -N with -O, and would become puzzled when it didn't
work according to usual expectations. -N / -O has always worked this
way, but it wasn't especially clear to people. For a short period, we
attempted to flat-out disable -N with -O, giving an error. Of course,
this mishandled cases where someone had set timestamping on by default
in their ~/.wgetrc, so we demoted it to a warning. However, we will most
likely not alter the fundamental behavior itself.

Fail2Ban (failtoban)
tags: added: manpage
Revision history for this message
Mitch Towner (kermiac) wrote :

@ Fail2Ban: please do not assign tags without first reading https://wiki.ubuntu.com/Bugs/Tags
Thanks in advance!

tags: removed: manpage
Andreas Olsson (andol)
Changed in wget (Ubuntu):
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.