Package: reprepro
Version: 5.3.1-1
Severity: normal

Dear Maintainer,

Here's a minimal example to demonstrate the problem:

 $ cat conf/distributions
 Codename: my-distro
 Architectures: amd64 source
 Components: non-free
 Update: - update-sid
 Log: my-distro.log
 # don't pack indices for this example
 DebIndices: Packages Release .
 DscIndices: Sources Release .

 $ cat conf/updates
 Name: update-sid
 VerifyRelease: blindtrust
 Method: http://deb.debian.org/debian/
 Suite: unstable
 Components: non-free non-free-firmware>non-free
 FilterSrcList: deinstall updates-filter

 $ cat conf/updates-filter
 atmel-firmware install

In the example above, I create 'my-distro', it has only one component
named 'non-free'. my-distro gets its updates from Debian unstable, from
the two components non-free and non-free-firmware, that are merged into
one component using "non-free-firmware>non-free".

For the sake of the example, my-distro has only one package, it's
atmel-firmware, that comes from the non-free-firmware component in
Debian.

This setup seems to work, at least on the surface:

 $ reprepro update
 Calculating packages to get...
 Getting packages...
 Installing (and possibly deleting) packages...
 Exporting indices...

However, looking a bit deeper, there are 2 things that are not correct:

 $ grep -E -rni '(Package-List|non-free-firmware)' dists/
 dists/my-distro/non-free/binary-amd64/Packages:19:Section: 
non-free-firmware/kernel
 dists/my-distro/non-free/source/Sources:24:Package-List: 
 dists/my-distro/non-free/source/Sources:25: atmel-firmware deb 
non-free-firmware/kernel optional arch=all
 dists/my-distro/non-free/source/Sources:28:Section: non-free-firmware/misc

In the snippet above, we can see that the name of the component is not
updated in the Section and in the Package-List fields (it should be
non-free).

If we decide to also create a Contents file, ie. we add the line:

 Contents: percomponent .

to conf/distributions, then the name of the component is also wrong in
the Contents file:

 $ cat dists/my-distro/non-free/Contents-amd64
 etc/pcmcia/atmel.conf      non-free-firmware/kernel/atmel-firmware
 lib/firmware/atmel_at76c502-wpa.bin        
non-free-firmware/kernel/atmel-firmware
 [...]

The issue is for real. I used 'non-free-firmware>non-free' in order to
delay the addition of the new non-free-firmware component in Kali Linux.
However it broke command-not-found, a program that parses the Contents
files and crashes when it encounters an unknown component. Since
command-not-found is run after "apt update" (as a hook or something like
that), in practice it means that "apt update" failed for every Kali
Linux users...

As a quick fix, I could workaround the issue by using this reprepro
trick in conf/updates:

 ListShellHook: sed -e '/^Section: /s/non-free-firmware/non-free/' -e '/^ /s/ 
deb non-free-firmware\// deb non-free\//'

However it's sloppy, I think the issue should be fixed in reprepro.
reprepro should take care of renaming the component in the Sources and
Packages index files, for the fields Section and Package-List. That is
enough to also fix the Contents files.

I can come up with a patch, would you be willing to review it?

Thanks!

Arnaud

Reply via email to