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


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

Submitter:  None
Submitted:  Wed 21 Jun 2017 09:12:56 AM UTC
Category:  Program Logic Severity:  3 - Normal
Priority:  5 - Normal Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Roger Lainson Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  1.17.1
Operating System:  GNU/Linux Reproducibility:  Every Time
Fixed Release:  None Planned Release:  None
Regression:  None Work Required:  None
Patch Included:  No
* Mandatory Fields

Add a New Comment Rich Markup

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 Files:

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
  • -email is unavailable- added by None (Submitted the item)

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-06-21 None Attached File- Added Wget example - filename with leading spaces.txt, #40963
        Attached File- Added ..listing, #40964

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code