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

Fix conversion issues regarding OpenJDK and pdfinfo #328

Merged
merged 8 commits into from
Feb 7, 2023
Merged

Conversation

apyrgio
Copy link
Contributor

@apyrgio apyrgio commented Jan 30, 2023

Fix the following conversion issues:

More importantly, we introduce async support in the Dangerzone script, which changes the way we run commands in the container.

Fixes #325
Fixes #315

@deeplow
Copy link
Contributor

deeplow commented Jan 31, 2023

This seems like the perfect solution. I tested in a series of scenarios of some commands failing. Other than the minor lint issues, feel free to merge.

@deeplow deeplow added this to the 0.4.1 milestone Jan 31, 2023
Remove a Poetry version pin to 1.2.2, which causes installation issues
on systems with Python 3.11.

The pin was originally introduced because Poetry 1.3 was deemed
unstable, due to the following bugs:

* #292 (comment)
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029156

The first problem still stands, but we can circumvent it with the
`--no-ansi` flag, at no functionality cost. The second problem has been
resolved, but it never affected Ubuntu Focal in the first place.

Refs #292
Add libqt5gui5 as a test dependency in the 'convert-test-docs' step.
This package brings several other Qt and graphics libraries, which are
the ones that we actually require to run the tests *with PySide6*. Else,
we encounter this error:

```
Traceback (most recent call last):
  File "/home/circleci/project/dangerzone/gui/__init__.py", line 19, in <module>
    from PySide6 import QtCore, QtGui, QtWidgets
ImportError: libEGL.so.1: cannot open shared object file: No such file or directory
```

Note that the same package is not required when importing PySide2.QtGui,
which is why we hadn't encountered this issue before. Also, in the rest
of our environments, we explicitly install libqt5gui5, in order to run
the Dangerzone GUI.
@apyrgio apyrgio force-pushed the 325-async branch 2 times, most recently from fbd9d05 to 1a77c25 Compare February 7, 2023 16:06
apyrgio and others added 6 commits February 7, 2023 18:52
Fix an issue in our PyTest wrapper, that caused this recursion error:

```
  File "shibokensupport/signature/loader.py", line 61, in feature_importedgc
  File "shibokensupport/feature.py", line 137, in feature_importedgc
  File "shibokensupport/feature.py", line 148, in _mod_uses_pysidegc
  File "/usr/lib/python3.10/inspect.py", line 1147, in getsourcegc
    lines, lnum = getsourcelines(object)gc
  File "/usr/lib/python3.10/inspect.py", line 1129, in getsourcelinesgc
    lines, lnum = findsource(object)gc
  File "/usr/lib/python3.10/inspect.py", line 954, in findsourcegc
    lines = linecache.getlines(file, module.__dict__)gc
  File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 177, in __dict__gc
    self.__makeattr(name)gc
  File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 157, in __makeattrgc
    result = importobj(modpath, attrname)gc
  File "/home/user/.cache/pypoetry/virtualenvs/dangerzone-hQU0mwlP-py3.10/lib/python3.10/site-packages/py/_vendored_packages/apipkg/__init__.py", line 75, in importobjgc
    module = __import__(modpath, None, None, ["__doc__"])gc
  File "shibokensupport/signature/loader.py", line 54, in feature_importgc
RecursionError: maximum recursion depth exceededgc
```

This error seems to be related to
pytest-dev/pytest#1794. By not importing
`pytest` in our test wrapper, and instead executing directly, we can
avoid it.

Note that this seems to be triggered only by Shiboken6, which is why we
hadn't previously encountered it.
Instead of reinstalling shadow-utils, use the actual fix that the Fedora
devs have suggested (rpm --restore shadow-utils). The previous method
does not seem to work on Fedora 37, and it threw the following error
when building the development environment:

    Installed package shadow-utils-2:4.12.3-3.fc37.x86_64 (from koji-override-0) not available.
    Error: No packages marked for reinstall.
    Error: building at STEP "RUN dnf reinstall -y shadow-utils && dnf clean all": while running runtime: exit status 1
Drop PySide2 from our dependencies (previously used only on Linux
environments) and use PySide6 in all dev environments. The reason is
that PySide2 (from PyPI) does not support Python 3.11, and the variants
that do (Fedora/Debian packages) need to backport fixes from PySide6.

Our original attempt was to build PySide2 wheels for Python 3.11 but
it was not simple, nor maintainable. So, we were left with two options:

1. Install Python 3.10 in dev environments that have Python 3.11 by
   default.
2. Use PySide6 in all of our environments.

In both cases, we break package parity with the user's system, since we
are not testing Dangerzone under the same conditions. However, since
option (2) is forwards-compatible with where we want to move the
project (use Qt6 and PySide6), we chose that one.

Fixes #330
Run CI tests for Fedora 37 environments, now that we no longer require
PySide2 as a dev dependency.

Fixes #294
Commit d7be28e assumed that OpenJDK was
required for the PDFtk package, which is no longer installed in the
Dangerzone image, and thus was removed.

Turns out that while LibreOffice does not depend on OpenJDK, it may
produce corrupted PDFs if installed without it, and will not abort the
operation.

Reinstate OpenJDK to fix the issue of corrupted PDFs.

Fixes #315
Convert the Dangerzone script that in the container to run commands
asynchronously, via the asyncio module.

The main advantage of this approach is that it's fast, easy, and safe to
consume the command's streams, while the command is running in the
background.

Previously, we had implemented an approach that used non-blocking
sockets, but those are easy to get wrong. For instance, timeouts were
not exact, capturing output was brittle.

Fixes #325
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Container: Fails to calculate number of pages Add OpenJDK as a dependency again
2 participants