URL:
  <https://savannah.gnu.org/bugs/?67639>

                 Summary: --backup breaks retry
                   Group: GNU Wget
               Submitter: trebus
               Submitted: Mon 27 Oct 2025 10:19:38 PM UTC
                Category: Program Logic
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.20
        Operating System: GNU/Linux
         Reproducibility: None
           Fixed Release: None
         Planned Release: None
              Regression: None
           Work Required: None
          Patch Included: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 27 Oct 2025 10:19:38 PM UTC By: Trebus <trebus>
When enabling --backup, an automatic retry is broken.

Scenario
1. A large file download is attempted with --backup enabled
2. The download is interrupted
3. wget retries and downloads the remaining partial file
The result is now 2 partial files, the first partial file is renamed with the
.1 suffix, the second part retains the original name.

The partial files, when concatenated are a binary match with the full file,
the HTTP headers comply with RFC 9110

The logic ideally should identify that the download to be attempted is a
resume, thus not backup the file, but append to it as is done without
--backup.

The full command line ( with obfuscated URL )

wget --retry-connrefused --waitretry=300 --read-timeout=30 --timeout=25 -t 3
--backups=5 --server-response -a ${HOME}/wget.log --directory=csv
https://the.server.dummy/dir/file.zip


Version details
$ wget --version
GNU Wget 1.21.4 built on linux-gnu.

-cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls 
+ntlm +opie +psl +ssl/openssl 

Wgetrc: 
    /etc/wgetrc (system)
Locale: 
    /usr/share/locale 
Compile: 
    gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc" 
    -DLOCALEDIR="/usr/share/locale" -I. -I../../src -I../lib 
    -I../../lib -Wdate-time -D_FORTIFY_SOURCE=3 -DHAVE_LIBSSL -DNDEBUG 
    -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer 
    -ffile-prefix-map=/build/wget-LWnKWI/wget-1.21.4=. -flto=auto 
    -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection 
    -Wformat -Werror=format-security -fcf-protection 

-fdebug-prefix-map=/build/wget-LWnKWI/wget-1.21.4=/usr/src/wget-1.21.4-1ubuntu4.1

    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall 
Link: 
    gcc -DHAVE_LIBSSL -DNDEBUG -g -O2 -fno-omit-frame-pointer 
    -mno-omit-leaf-frame-pointer 
    -ffile-prefix-map=/build/wget-LWnKWI/wget-1.21.4=. -flto=auto 
    -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection 
    -Wformat -Werror=format-security -fcf-protection 

-fdebug-prefix-map=/build/wget-LWnKWI/wget-1.21.4=/usr/src/wget-1.21.4-1ubuntu4.1

    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -Wl,-Bsymbolic-functions 
    -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -lpcre2-8 
    -luuid -lidn2 -lssl -lcrypto -lz -lpsl ../lib/libgnu.a 

Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Originally written by Hrvoje Niksic <[email protected]>.
Please send bug reports and questions to <[email protected]>.








    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67639>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to