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

Bug#192403: Fails to parse empty Packages file (E: Encountered a section with no Package: header)

On Mon, Jun 23, 2003 at 03:36:14PM -0500, Adam Heath wrote:

> On Mon, 23 Jun 2003, Matt Zimmerman wrote:
> > So, should a Packages file with only whitespace be as valid as an empty one?
> > If not, this is an apt-build bug.
> >
> > At any rate, this fixes the problem for me:
> I'd say it's an apt-build bug.  Does dpkg handle this case correctly?

dpkg doesn't choke on it.

there:[/var/lib/dpkg] ls -l available
-rw-r--r--    1 root     root            1 2003-06-26 11:04 available
there:[/var/lib/dpkg] sudo dpkg --remove hello
dpkg - warning: ignoring request to remove hello which isn't installed.
there:[/var/lib/dpkg] ls -l available
-rw-r--r--    1 root     root            0 2003-06-26 11:04 available

But it turns out that the problem is a completely trivial bug in apt-build's
postinst, and not anything apt-build does itself (it uses apt-ftparchive):

        if [ ! -e "$repository_dir/Packages.gz" ]; then
            echo | gzip -9 > "$repository_dir/Packages.gz"

Which is arguably wrong anyway, and easily corrected:

        # Remove weird/broken Packages file created by old postinst
        if [ $(zcat $repository_dir/Packages.gz | wc -c) -eq 1 ]; then
          rm -f $repository_dir/Packages.gz

        if [ ! -e "$repository_dir/Packages.gz" ]; then
            gzip -9 < /dev/null > "$repository_dir/Packages.gz"

 - mdz

Reply to: