Bug#1141352: python3-debian: merge_fields can raise ValueError with folded Binary fields

Colin Watson cjwatson at debian.org
Fri Jul 3 10:01:13 BST 2026


Package: python3-debian
Version: 1.1.1
Severity: normal

In Debusine, we ran into a case [1] where Deb822.merge_fields could 
raise ValueError if asked to merge two Binary fields of which one has 
been folded onto multiple lines and the other has not.  The attached 
test case reproduces this.

In general I think the merge_fields logic needs to be reworked to be 
properly aware of the possible field types [2].  It would seem better to 
me if it were explicitly told whether a field is simple, folded, or 
multiline, and then behaved accordingly.  Binary is defined to be folded 
[3], but for example [4] is not defined to be either folded or multiline 
and therefore is simple.

Relatedly, dpkg-source and dpkg-genchanges fold Binary across multiple 
lines if it is too long (see [5] and [6], and [7] for the original 
reason).  I think Deb822 should do the same when dumping this field.

[1] https://salsa.debian.org/freexian-team/debusine/-/work_items/1518
[2] https://www.debian.org/doc/debian-policy/ch-controlfields.html#syntax-of-control-files
[3] https://www.debian.org/doc/debian-policy/ch-controlfields.html#binary
[4] https://www.debian.org/doc/debian-policy/ch-controlfields.html#architecture
[5] https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/scripts/dpkg-source.pl?h=1.23.7#n463
[6] https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/scripts/dpkg-genchanges.pl?h=1.23.7#n491
[7] https://bugs.debian.org/494714

Thanks,

-- 
Colin Watson (he/him)                              [cjwatson at debian.org]

-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: arm64

Kernel: Linux 7.0.12+deb14.1-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-debian depends on:
ii  python3  3.13.9-3+b1

python3-debian recommends no packages.

Versions of packages python3-debian suggests:
ii  gpgv                        2.4.9-5
ii  python3-apt                 3.1.0
ii  python3-charset-normalizer  3.4.7-1
ii  zstd                        1.5.7+dfsg-3+b2

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deb822-merge-fields-test.patch
Type: text/x-diff
Size: 887 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-python-debian-maint/attachments/20260703/d134b9ea/attachment.patch>


More information about the pkg-python-debian-maint mailing list