[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#40230: apt can't handle 'file' methods



Package: apt
Version: 0.3.9

I keep a few locally-build deb files in /usr/local/debs (e.g. kernels from
make-kpkg), and use dpkg-scanpackages to create a Package file so dselect
won't claim they're all "obsolete/local".

In my /etc/apt/sources.list, i have the following line to read that
packages file:
deb file:/usr/local debs/

When i try to use the apt method in dselect or apt-get update, it gives
the following error messages:
  Err file:/usr/local/ debs/ Packages
    Invalid URI, local URIS must not start with //
  Ign file:/usr/local/ debs/ Release  

I decided to look in the source to find out the proper format for a file
line. It appears that the file method (methods/file.cc) expects the Host
field of the URI parsed from sources.list to be empty, and this is somehow
not happening. Next, i looked in apt-pkg/contrib/strutl.cc at the
function CopyFrom, to determine how the file line was being parsed.

On line 718 of strutl.cc (downloaded from ftp.debian.org), the function
makes this check:
   if (At == SingleSlash)
It turns out that, when parsing a line "file:/usr/local debs", At is
actually one greater than SingleSlash! This confuses the function, and it
ends up assigning "sr/local debs/" to Host (and "/" to User).

I propose that the above line 718 be changed as follows:
   if (At >= SingleSlash)
This way, the URI will be correctly parsed.

I'm using potato with a custom kernel 2.2.10.


Reply to: