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

                 Summary: --unlink doesn't
                 Project: GNU Wget
            Submitted by: None
            Submitted on: Mon 03 Jan 2022 03:26:41 AM UTC
                Category: Program Logic
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: /df
        Originator Email: [email protected]
             Open/Closed: Open
                 Release: trunk
         Discussion Lock: Any
        Operating System: GNU/Linux
         Reproducibility: None
           Fixed Release: None
         Planned Release: None
              Regression: None
           Work Required: None
          Patch Included: None

    _______________________________________________________

Details:

The '--unlink' option is described like this:


       --unlink
           Force Wget to unlink file instead of clobbering existing file.
This
           option is useful for downloading to the directory with hardlinks.


So with existing 'file', 'wget --unlink ... o file' should work like 'unlink
file; 'wget ... o file', surely. It doesn't in the example below, which could
be disastrous if relying on the documented behaviour.


$ wget --version
GNU Wget 1.21 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=2 -DHAVE_LIBSSL -DNDEBUG 
    -g -O2 -fdebug-prefix-map=/build/wget-GywCSU/wget-1.21=. 
    -fstack-protector-strong -Wformat -Werror=format-security 
    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall 
Link: 
    gcc -DHAVE_LIBSSL -DNDEBUG -g -O2 
    -fdebug-prefix-map=/build/wget-GywCSU/wget-1.21=. 
    -fstack-protector-strong -Wformat -Werror=format-security 
    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -Wl,-Bsymbolic-functions 
    -Wl,-z,relro -Wl,-z,now -lpcre2-8 -luuid -lidn2 -lssl -lcrypto -lz 
    -lpsl ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a 

Copyright (C) 2015 Free Software Foundation, Inc.
Licence 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]>.
$ echo > foo
$ ln foo foobar
$ ls -l foo*
-rw-rw-r-- 2 df df 1 Jan  3 03:10 foo
-rw-rw-r-- 2 df df 1 Jan  3 03:10 foobar
$ wget --unlink -O foobar "$url"
...
Length: 11372 (11K) [image/png]
...
2022-01-03 03:11:47 (473 B/s) - ‘foobar’ saved [11372/11372]

$ ls -l foo*
-rw-rw-r-- 2 df df 11372 Oct  1  2012 foo
-rw-rw-r-- 2 df df 11372 Oct  1  2012 foobar
$


Expected result:

$ ls -l foo*
-rw-rw-r-- 2 df df 1 Jan  3 03:10 foo
-rw-rw-r-- 2 df df 11372 Oct  1  2012 foobar
$





    _______________________________________________________

Reply to this item at:

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

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


Reply via email to