Bug 10080 - Doesn't CD home before giving path
Doesn't CD home before giving path
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: ncftp (Show other bugs)
6.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-03-09 01:10 EST by whitis
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-03-27 07:00:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description whitis 2000-03-09 01:10:38 EST
#Version:
#   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
ftp://ftp.redhat.com/pub/redhat-6.2beta/SRPMS/SRPMS/shadow-utils-19990827-7.src.rpm
ncftpget -v -d - -z -F -r 10
ftp://ftp.redhat.com/pub/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm
# these two are incorrect but succeed:
ncftpget -v -d - -z -F -r 10
ftp://ftp.redhat.com/redhat-6.2beta/SRPMS/SRPMS/shadow-utils-19990827-7.src.rpm
ncftpget -v -d - -z -F -r 10
ftp://ftp.redhat.com/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm
Comment 1 Mike Gleason 2000-03-09 14:55:59 EST
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"

nor:

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:

ftp://ftp.redhat.com/%2Fpub/redhat-6.2beta/SRPMS/SRPMS/pine-4.21-3.src.rpm

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 16:16:59 EST
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.