Article View: linux.debian.bugs.dist
Article #3977Bug#1141352: python3-debian: merge_fields can raise ValueError
From: Mathis Faivre
Date: Tue, 10 Nov 2026 10:10
Date: Tue, 10 Nov 2026 10:10
36 lines
4294 bytes
4294 bytes
Thanks, that shape works for me. I am dropping the small fix (1): it unfolded both values as soon as one side was on a single line, so a short value merged with a Description-style one turned into a sorted bag of words with no error. Without a type that case cannot be told apart from a folded field. (2) comes as separate MRs. The first one is ready: - A FieldType enum (SIMPLE, FOLDED, MULTILINE) and a small FieldMeta dataclass holding it, with field_type = None meaning "unknown, keep today's behaviour". - Deb822.field_meta: a case-insensitive mapping, built on first use per instance from a class default that is empty on Deb822. Looking up a field that is not declared creates an empty entry, so your example works for custom fields, and iter_paragraphs over a Packages file does not pay for it. - merge_fields follows the type: FOLDED values are unfolded and merged as a list, MULTILINE merges lines and refuses a single-line value, SIMPLE refuses a multi-line value. A field with no type behaves as today, including the ValueError. - Changes, Dsc (hence Sources) and BuildInfo declare Binary as FOLDED. Deb822 itself declares nothing. As a result Colin's test on a plain Deb822 only passes once the field is typed, which I did in the test. Next MR: folding on dump in Deb822._dump_format, driven by field_meta. Only FOLDED fields, only over 980 characters, at the last blank like dpkg-genchanges. Already folded short values are written back as they are. _multivalued_fields and _relationship_fields stay out for now; FieldMeta leaves room to absorb them later. One place where I plan to differ from what you wrote: you said Deb822ParagraphElement needs similar support for its dump. Its dump concatenates the tokens and gives the file back byte for byte, and folding there would rewrite fields the caller never touched. I plan to fold when the value is set (__setitem__, set_field_to_simple_value, and a folding formatter for the list views) and leave dump exact. Tell me if you would rather have it in dump.
Technical Details
Message-ID:
<NXQXE-aZJC-7@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomodReferences:
<NcI4h-2t6J-13@gated-at.bofh.it> <NXQXE-aZJC-9@gated-at.bofh.it> <NcI4h-2t6J-13@gated-at.bofh.it> <NXQXE-aZJC-9@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod From: Mathis Faivre <debian@croque.top> Newsgroups: linux.debian.bugs.dist Subject: Bug#1141352: python3-debian: merge_fields can raise ValueError Date: Tue, 10 Nov 2026 11:10:02 +0100 Message-ID: <NXQXE-aZJC-7@gated-at.bofh.it> References: <NcI4h-2t6J-13@gated-at.bofh.it> <NXQXE-aZJC-9@gated-at.bofh.it> <NcI4h-2t6J-13@gated-at.bofh.it> <NXQXE-aZJC-9@gated-at.bofh.it> X-Original-To: 1141352@bugs.debian.org X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Tue Nov 10 10:01:07 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -0.94 Reply-To: Mathis Faivre <debian@croque.top>, 1141352@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: pkg-python-debian-maint@lists.alioth.debian.org X-Debian-Pr-Message: followup 1141352 X-Debian-Pr-Package: python3-debian X-Debian-Pr-Source: python-debian Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Report-Abuse: Please forward a copy of this message, including all headers, to <abuse-report@smtp2go.com> Feedback-ID: 1302718m:1302718aqLq9fr:1302718se7CCJpOoE X-Smtpcorp-Track: jTLCHteHDhsr.-iCT6buXAFIn.rLsgPghWu_u X-Greylist: delayed 904 seconds by postgrey-1.37 at buxtehude; Tue, 10 Nov 2026 09:59:04 UTC X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001783 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 36 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: niels@thykier.net X-Original-Date: Tue, 10 Nov 2026 10:43:49 +0100 X-Original-Message-ID: <179430382953.1912925.3504302522069400848@croque.top> X-Original-References: <akd6WabKfKsvl3va@camorr.rosewood.vpn.ucam.org> <e7f21b1a-458a-4a21-bfc0-d69c52b5699f@thykier.net> <akd6WabKfKsvl3va@camorr.rosewood.vpn.ucam.org> <e7f21b1a-458a-4a21-bfc0-d69c52b5699f@thykier.net>