wrap-and-sort fails to parse some debian/control.in files
Affected images versions
- not relevant, this bug affects our ci-package-builder pipeline.
Steps to reproduce
- The build pipeline fails for babel-minify, xapian-bindings and firefox-esr during the
build-source
job with an error fromwrap-and-sort
. This bug is easily reproducible locally on a Bookworm based system with:
dget https://deb.debian.org/debian/pool/main/f/firefox-esr/firefox-esr_102.11.0esr-1.dsc
cd firefox-esr
wrap-and-sort
Expected result
wrap-and-sort should parse correctly the debian/control.in
files and not crash on them.
Actual result
wrap-and-sort
crashes and make the build pipeline failing with similar messages:
Traceback (most recent call last):
File "/usr/bin/wrap-and-sort", line 496, in <module>
main()
File "/usr/bin/wrap-and-sort", line 481, in main
modified_files = wrap_and_sort(args)
^^^^^^^^^^^^^^^^^^^
File "/usr/bin/wrap-and-sort", line 312, in wrap_and_sort
control = WrapAndSortControl(control_file, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/wrap-and-sort", line 99, in __init__
super().__init__(filename, use_rts_parser=args.rts_parser)
File "/usr/lib/python3/dist-packages/devscripts/control.py", line 210, in __init__
self._deb822_file = parse_deb822_file(sequence)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 3095, in parse_deb822_file
deb822_file = Deb822FileElement(LinkedList(tokens))
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debian/_util.py", line 159, in __init__
self.extend(values)
File "/usr/lib/python3/dist-packages/debian/_util.py", line 272, in extend
for v in values:
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 104, in _impl
for token in token_stream:
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 104, in _impl
for token in token_stream:
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 2991, in _build_field_with_value
value_element = next(buffered_stream, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 143, in __next__
return next(self._stream)
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 104, in _impl
for token in token_stream:
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 2939, in _build_value_line
tokens_in_value = list(buffered_stream.takewhile(_non_end_of_line_token))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 149, in takewhile
while buffer or self._fill_buffer(5):
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 198, in _fill_buffer
self._buffer.append(next(self._stream))
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/_util.py", line 104, in _impl
for token in token_stream:
File "/usr/lib/python3/dist-packages/debian/_deb822_repro/parsing.py", line 3031, in _abort_on_error_tokens
raise SyntaxOrParseError(
debian._deb822_repro.types.SyntaxOrParseError: Syntax or Parse error on the line: "@XS_RUBY_VERSIONS@\n"
Reproducibility
How often the issue is hit when repeating the test and changing nothing (same device, same image, etc.)?
Put the
-
✅ always - often, but not always
- rarely
Impact of bug
This bug is blocking the rebase since some packages are not able to be rebased.
Attachments
NA
Root cause
wrap-and-sort
is not able to parse correctly debian/control.in
files and crashes since the rebase on Bookworm. This is due to a rewrite of the parser in python3-debian
(since version 0.1.44). This bug was reported upstream https://bugs.debian.org/1036731
Outcomes
A workaround was proposed a packages level:
To avoid having to modify package another workaround is proposed at the pipeline level:
A proper fix would be to fix python3-debian
.
Management data
This section is for management only, it should be the last one in the description.
/cc @andrunko @em @sagar @sudarshan @wlozano
Phabricator link: https://phabricator.apertis.org/T9735