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 LogicSeverity: 3 - Normal
Priority: 5 - NormalStatus: Confirmed
Privacy: PublicAssigned to: None
Originator Name: Open/Closed: Open
Release: 1.16.3Operating System: GNU/Linux
Reproducibility: Every TimeFixed Release: None
Planned Release: NoneRegression: None
Work Required: NonePatch 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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 06 May 2015 02:14:46 PM UTCdarnirStatusNone=>Confirmed
    Wed 06 May 2015 01:36:34 PM UTCnokCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1