Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to parse erroenous build output and freezes indefinitely #4515

Closed
ricotz opened this issue Jan 10, 2024 · 4 comments
Closed

Fails to parse erroenous build output and freezes indefinitely #4515

ricotz opened this issue Jan 10, 2024 · 4 comments
Labels
bug Actual bad behavior that don't fall into maintenance or documentation

Comments

@ricotz
Copy link

ricotz commented Jan 10, 2024

Bug Description

There are libreoffice snap builds for amd64 [1] and arm64 which are stuck.

Afaict snapcraft crashed while parsing the build output.

[1] https://launchpad.net/~libreoffice/df-libreoffice/+snap/libreoffice-fresh/+build/2350372

Originally reported at https://bugs.launchpad.net/snapcraft/+bug/2046156

To Reproduce

Seems running a build which outputs e.g. an erroneous utf8 encoded string. In case of libreoffice it is an error message where it seems a byte gets cut off.

Environment

Runs on Launchpad

snapcraft.yaml

https://git.launchpad.net/~libreoffice/+git/libreoffice-snap/tree/snapcraft.yaml?h=24.2

Relevant log output

:: [build HPX] el/helpcontent2/source/text/simpress/guide
:: Entity: line 1: parser error : Opening and ending tag mismatch: switchinline line 1 and root
Exception in thread Thread-45:
Traceback (most recent call last):
  File "/snap/snapcraft/10279/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/snap/snapcraft/10279/lib/python3.10/site-packages/craft_cli/messages.py", line 285, in run
    self._run_posix()
  File "/snap/snapcraft/10279/lib/python3.10/site-packages/craft_cli/messages.py", line 257, in _run_posix
    self._write(data)
  File "/snap/snapcraft/10279/lib/python3.10/site-packages/craft_cli/messages.py", line 242, in _write
    unicode_line = useful_line.decode("utf8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 0: invalid start byte

Additional context

The deb build output looks like this which I would expect the snap build to behave as well:

[build HPX] el/helpcontent2/source/text/sbasic/python
HELPFILES=/tmp/gbuild.SMwYPO && S=/<> && I=$S/instdir && W=$S/workdir && POFILES=/tmp/gbuild.i4kgRa && LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"$I/program:$I/program" $W/LinkTarget/Executable/helpex -l el -mi ${HELPFILES} -m ${POFILES} -o $W/HelpTranslatePartTarget/el/helpcontent2/source/text/sbasic/python &amp;&amp; rm -f ${POFILES} && touch /<>/workdir/HelpTranslatePartTarget/el/helpcontent2/source/text/sbasic/python/done && rm -f ${HELPFILES}
[build HPX] el/helpcontent2/source/text/sbasic/shared
Entity: line 1: parser error : Opening and ending tag mismatch: switchinline line 1 and root
�αζί και επιστρέφοντας το άθροισμά τους.
^
Entity: line 1: parser error : Premature end of data in tag root line 1
�αζί και επιστρέφοντας το άθροισμά τους.
^
HELPFILES=/tmp/gbuild.HZ8Z3B && S=/<> && I=$S/instdir && W=$S/workdir && POFILES=/tmp/gbuild.MFTIRb && LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"$I/program:$I/program" $W/LinkTarget/Executable/helpex -l el -mi ${HELPFILES} -m ${POFILES} -o $W/HelpTranslatePartTarget/el/helpcontent2/source/text/sbasic/shared &amp;&amp; rm -f ${POFILES} && touch /<>/workdir/HelpTranslatePartTarget/el/helpcontent2/source/text/sbasic/shared/done && rm -f ${HELPFILES}
[build HPX] el/helpcontent2/source/text/sbasic/shared/01

@ricotz ricotz added the bug Actual bad behavior that don't fall into maintenance or documentation label Jan 10, 2024
@tigarmo
Copy link
Contributor

tigarmo commented Jan 12, 2024

Hi, thanks for the report. That naked decode() call was a ticking time-bomb for sure. Can you tell me which version of Snapcraft this is?

@ricotz
Copy link
Author

ricotz commented Jan 12, 2024

Sorry no, but I guess the version hides behind the snapcraft build 10279

@tigarmo
Copy link
Contributor

tigarmo commented Jan 12, 2024

Oh that'll do, that's Snapcraft 8.0.1

tigarmo added a commit that referenced this issue Jan 18, 2024
This new version fixes decoding issues when parsing malformed output
from other processes (typically during the build step)

Fixes #4515
@tigarmo
Copy link
Contributor

tigarmo commented Jan 23, 2024

Just a note here on the "completeness" of this issue: I was able to reproduce & fix the decoding issue, but I could not reproduce the freezing behavior. Since the freezing seems to happen because of the error, and the error was fixed, this issue can be seen as resolved. @ricotz please report back if you still experience the freezing.

syu-w pushed a commit that referenced this issue Jan 29, 2024
This new version fixes decoding issues when parsing malformed output
from other processes (typically during the build step)

Fixes #4515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Actual bad behavior that don't fall into maintenance or documentation
Projects
None yet
Development

No branches or pull requests

2 participants