#1058934 apt install ./foo.deb re-downloads the package

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Stuart Prescott
Date:
2023-12-18 14:51:03 UTC
Severity:
normal
#1058934#5
Date:
2023-12-18 14:38:20 UTC
From:
To:
Dear Maintainer,

It was observed in #debian pointed out today that "apt install ./foo.deb" was
downloading the .deb again from the mirror:

$ apt download hello
$ sudo apt install ./hello_2.10-3_amd64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'hello' instead of './hello_2.10-3_amd64.deb'
The following NEW packages will be installed:
hello
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 53.1 kB of archives.
After this operation, 284 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian sid/main amd64 hello amd64 2.10-3 [53.1 kB]
Fetched 53.1 kB in 0s (1,899 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package hello.
(Reading database ... 184783 files and directories currently installed.)
Preparing to unpack .../hello_2.10-3_amd64.deb ...
Unpacking hello (2.10-3) ...
Setting up hello (2.10-3) ...
Processing triggers for man-db (2.12.0-1) ...

On the test machine, apt is using a proxy server whose logs confirmed
that apt redownloaded the file even though it was supposed to use the
local file.

This is a regression since bookworm.

I don't know how apt decides that the remote file is the better one to
use (presumably the usual hash of certain fields?). When manually repacking
the .deb for testing (and getting a different sized .deb as a result), apt
no longer attempted to download and instead used the local version:

Get:1 /tmp/pkgs/hello/hello_2.10-3_amd64.deb hello amd64 2.10-3 [53.0 kB]

(I've repacked hello with a modified file and reused the version string
just for the perversity of the test.)

regards
Stuart

#1058934#10
Date:
2023-12-18 14:49:53 UTC
From:
To:

note that i am experiencing this on a bookworm system.

while i don't use backports (so 'apt' should be indeed the one that
comes with bookworm), i do have some third-party repository enabled
(gitlab).

i did notice the problem when using 'apt-get' (rather than 'apt') to
install a local .deb file (which happens to be >1GB, so the re-download
is quite noticeable):

```sh
apt-get install /dev/shm/gitlab-ce_16.6.2-ce.0_amd64.deb
```

(that's just for completeness sake; i'm full aware that i'm on my own
when enabling 3rd party repositories; but given that stuart was able to
reproduce this on a (presumably) pristine system, it might help that
others experience this before trixie)

gmasdr
IOhannes