Bug 10080 - Doesn't CD home before giving path
Summary: Doesn't CD home before giving path
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: ncftp
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-03-09 06:10 UTC by whitis
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2000-03-27 12:00:01 UTC

Attachments (Terms of Use)

Description whitis 2000-03-09 06:10:38 UTC
#   ncftp-3.0beta21-3.i386.rpm
#   NcFTPGet 3.0.0
#   LibNcFTP 3.0b3
# ncftpget has a serious bug.  It doesn't do a "CWD /" or equivalent
# before it starts spitting out path components.  Redhat defaults to /pub
# If I recall correctly, the FTP protocol actually has a specific command
# to CD to the top level.
# These two commands are correct but fail:

ncftpget -v -d - -z -F -r 10
ncftpget -v -d - -z -F -r 10
# these two are incorrect but succeed:
ncftpget -v -d - -z -F -r 10
ncftpget -v -d - -z -F -r 10

Comment 1 Mike Gleason 2000-03-09 19:55:59 UTC
This is not a bug.  RFC 1738 states that URLs use relative paths from the start
directory.  Furthermore, the "/" characters in the URL are to be interpreted
solely as node delimiters and not as characters in a pathname.  Therefore your
URL ftp://ftp.redhat.com/pub/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm
translates into:

Connect and login to ftp.redhat.com.
cd "pub"
cd "redhat-6.2beta"
cd "SRPMS"
cd "SRPMS"
get "pine-4.21-3.src.rpm"

Note that it does NOT translate into:

cd "/pub"
cd "redhat-6.2beta"
cd "SRPMS"
cd "SRPMS"
get "pine-4.21-3.src.rpm"


Connect and login to ftp.redhat.com.
cd "/pub/redhat-6.2beta/SRPMS/SRPMS"
get "pine-4.21-3.src.rpm"

That is why URLs involving a user login, i.e.
ftp://joeuser@ftp.example.com/public_html/index.html, work since they work
relative from the start directory (and in this case user logins start from the
user's home directory).  Otherwise, URLs would have to use the absolute path to
the home directory, which is undesirable.

Therefore, if you need to start from the root directory, you need to have your
URL explicitly quote the root directory, such as:


The "%2F" is the "/" character, so that changes the first node in the URL to
be "/pub" rather than "pub".  Of course, it's really best to not use this and
instead use URLs relative to the start directory.

Mike Gleason

Comment 2 Nalin Dahyabhai 2000-03-09 21:16:59 UTC
Mike is correct here; the situation is identical with other tools like wget.

Note You need to log in before you can comment on or make changes to this bug.