#1003177 mmdebstrap: --dry-run fails with error: cannot read /var/cache/apt/archives/

#1003177#5
Date:
2022-01-05 17:02:13 UTC
From:
To:
Hi,

mmdebstrap from Debian stable fails to run with --dry-run. Example:

```
$ mmdebstrap -v --dry-run --variant=minbase unstable root.tar
[...]
Inst sysvinit-utils (3.01-1 Debian:unstable [amd64])
Conf sysvinit-utils (3.01-1 Debian:unstable [amd64])
I: skip extracting packages because of --dry-run
I: no essential packages -- skipping...
E: cannot read /var/cache/apt/archives/
W: listening on child socket failed:
I: removing tempdir /tmp/mmdebstrap.e7VYvXTJ31...
```

Running the same command on Debian unstable with mmdebstrap 0.8.2-1
works, but backporting mmdebstrap >= 0.8 to Debian bullseye fails,
because mmdebstrap >= 0.8 requires a APT version that is newer than the
one shipped in bullseye.

#1003177#8
Date:
2022-01-05 19:50:49 UTC
From:
To:
Hi,

Quoting Benjamin Drung (2022-01-05 18:02:13)

yes, backporting is not an option. Luckily, the fix is trivial:
--- /usr/bin/mmdebstrap 2022-01-05 19:47:50.477129738 +0000 +++ /usr/bin/mmdebstrap.fixed 2022-01-05 19:47:43.277074092 +0000 @@ -2779,7 +2779,7 @@ # /var/cache/apt/archives/ might not be empty either because # the user used hooks to populate it or because skip options # like essential/unlink or check/empty were used. - { + if (-e "$options->{root}/var/cache/apt/archives/") { my $apt_archives = "/var/cache/apt/archives/"; opendir my $dh, "$options->{root}/$apt_archives" or error "cannot read $apt_archives"; I'll ask the release team to also accept that fix in addition to what I already proposed in #1003188. Thanks! cheers, josch