bugGNU Wget - Bugs: bug #45037, wget -O foo...

 
 

bug #45037: wget -O foo ftp://ftp.funet.fi/pub/Linux/mirrors/debian/README deletes README symlink

Submitted by:  Noël Köthe <nok>
Submitted on:  Wed 06 May 2015 01:36:34 PM UTC  
 
Category:  Program Logic Severity:  3 - Normal
Priority:  5 - Normal Status:  Confirmed
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  1.16.3 Operating System:  GNU/Linux
Reproducibility:  Every Time Fixed Release:  None
Planned Release:  None Regression:  None
Work Required:  None Patch Included:  No

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 06 May 2015 10:34:13 PM UTC, comment #3:

It's clearly a bug. If we are downloading README to local file foo, there's no reason to remove the local symlink README.

When we want to save into a name where there's currently a symlink, consistency with shell > would dictate just to follow the link on writing, but as that may lead to security issues, replacing with a file may also be acceptable.

Ángel <angel_>
Wed 06 May 2015 07:10:15 PM UTC, comment #2:

Use -d to get
Unlinking README (symlink).

In ftp.c you will find those lines:
/* Remove it if it's a link. */
remove_link (con->target);

This is done by purpose (I just can guess why: not to overwrite the content the link points to).

The question is: is it a bug or a feature ? Should we just document this behaviour (maybe it already is).

Tim Ruehsen <rockdaboot>
Project Administrator
Wed 06 May 2015 04:30:34 PM UTC, comment #1:

slightly related bug..

$ ln -s /etc/passwd README

$ wget -O README http://foo.bar
README: Permission denied

Giuseppe Scrivano <gscrivano>
Project Administrator
Wed 06 May 2015 01:36:34 PM UTC, original submission:

Hello,

a forwarded bug report which is reproducible:

https://bugs.debian.org/784348

--8<--
joey@darkstar:~/tmp/y>ln -s /etc/passwd README
joey@darkstar:~/tmp/y>ls
README@
joey@darkstar:~/tmp/y>wget -O foo ftp://ftp.funet.fi/pub/Linux/mirrors/debian/README
--2015-05-05 13:17:22-- ftp://ftp.funet.fi/pub/Linux/mirrors/debian/README
=> ‘foo’
Resolving ftp.funet.fi (ftp.funet.fi)... 193.166.3.2, 2001:708:10:9::20:2
Connecting to ftp.funet.fi (ftp.funet.fi)|193.166.3.2|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/Linux/mirrors/debian ... done.
==> SIZE README ... 1495
==> PASV ... done. ==> RETR README ... done.
Length: 1495 (1.5K) (unauthoritative)

README 100%[=====================>] 1.46K 5.45KB/s in 0.3s

2015-05-05 13:17:28 (5.45 KB/s) - ‘foo’ saved [1495]

joey@darkstar:~/tmp/y>ls
foo

Doesn't happen if README is a file rather than a symlink, doesn't happen when using http. The ftp downloader apparently has a bug..
--8<--

Noël Köthe <nok>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by angel_ (Posted a comment)
  • -email is unavailable- added by rockdaboot (Posted a comment)
  • -email is unavailable- added by gscrivano (Posted a comment)
  • -email is unavailable- added by darnir (Updated the item)
  • -email is unavailable- added by nok (Submitted the item)
  • -email is unavailable- added by nok
  •  

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-06 darnir StatusNone => Confirmed
    2015-05-06 nok Carbon-Copy- => Added -email is unavailable-

    Back to the top


    Powered by Savane 3.3