bugGNU Wget - Bugs: bug #51284, Wget incorrectly parses FTP...


bug #51284: Wget incorrectly parses FTP listing if filenames have leading spaces

Submitted by:  None
Submitted on:  Wed 21 Jun 2017 09:12:56 AM UTC  
Category: Program LogicSeverity: 3 - Normal
Priority: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Originator Name: Roger LainsonOriginator Email: -unavailable-
Open/Closed: OpenRelease: 1.17.1
Operating System: GNU/LinuxReproducibility: Every Time
Fixed Release: NonePlanned Release: None
Regression: NoneWork 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 21 Jun 2017 09:12:56 AM UTC, original submission:

Wget incorrectly parses the FTP listing if filenames have leading spaces.

Given a remote file with a name like ' X' (admittedly unusual but legal in Linux), Wget incorrectly determines the filename as 'X' from the LIST command, and hence a RETR for the file fails with '550 Failed to open file' or similar.

See attached output from Wget, and corresponding .listing file.

Worth noting that WinSCP has the same problem, as may other FTP clients. In fact filenames like ' X' are not easy to create (without shell access to the FTP server), so this is probably not a high priority problem.

A suggestion: rather than assume there are no leading spaces in the filename (the current parsing method), maybe we could look for the directory '..' in the listing, and use that to note the character position which is the start of the filename.



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

Attach File(s):

Attached Files
file #40963:  Wget example - filename with leading spaces.txt added by None (4KiB - text/plain - (.listing has been renamed to ..listing to satisfy Windows))
file #40964:  ..listing added by None (186B - application/octet-stream - (.listing has been renamed to ..listing to satisfy Windows))


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by None (Submitted the item)

    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 21 Jun 2017 09:12:56 AM UTCNoneAttached File-=>Added Wget example - filename with leading spaces.txt, #40963
      Attached File-=>Added ..listing, #40964

    Back to the top

    Powered by Savane 3.1-cleanup1