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 several issues found during Windows QA #793

Merged
merged 11 commits into from
May 9, 2024
Merged

Fix several issues found during Windows QA #793

merged 11 commits into from
May 9, 2024

Conversation

apyrgio
Copy link
Contributor

@apyrgio apyrgio commented Apr 30, 2024

Fix several minor to medium issues that were found while doing QA on Windows for 0.6.1 (see #785 (comment)), as well as an issue reported by @naglis.

Fixes #790
Fixes #791

Copy link
Contributor

@deeplow deeplow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging into this complex termination rabbit hole. I have a few suggestions in their own threads.

Other than that, my last suggestion is to add already changelog lines because this fixed at least two separate things and will be easier to attribute now than when releasing.

dangerzone/isolation_provider/container.py Outdated Show resolved Hide resolved
apyrgio added 7 commits May 9, 2024 15:57
Fix a failing test case on Windows, due to a character that cannot
exist in a filename.
On Windows, if we somehow attempt to archive the same document twice
(e.g, because it got archived once, and then we copy it back), we will
get an error, because Windows does not overwrite the target path, if it
already exists.

Fix this issue by always removing the previously archived version, when
performing the next archival action, and update our tests.
On Windows, if we don't use the `startupinfo=` argument of
subprocess.Popen, then a terminal window will flash while running the
command.

Use `startupinfo=` when killing a container, as we do for every other
command.
The `exit()` [1] function is not necessarily present in every Python
environment, as it's added by the `site` module. Also, this function is
"[...] useful for the interactive interpreter shell and should not be
used in programs"

For this reason, we replace all such occurrences with `sys.exit()` [2],
which is the canonical function to exit Python programs.

[1]: https://docs.python.org/3/library/constants.html#exit
[2]: https://docs.python.org/3/library/sys.html#sys.exit
In d632908 we improved our
`replace_control_chars()` function, by replacing every control or
invalid Unicode character with a placeholder one. This change, however,
made our debug logs harder to read, since newlines were not preserved.

There are indeed various cases in which replacing newlines is wise
(e.g., in filenames), so we should keep this behavior by default.
However, specifically for reading debug logs, we add an option to keep
newlines to improve readability, at no expense to security.
Remove an extra call to `replace_control_chars()`, as well as an
unnecessary method.
We have recently [1] changed the name of the Dangerzone application to
capital-case "Dangerzone", but this breaks our PDF viewer detection
logic. Adjust our check to exclude Dangerzone from the list.

Fixes #790

[1]: See commit 3d426ed
@apyrgio apyrgio force-pushed the 2024-04-qa-fixes branch from 31e5275 to 639dccd Compare May 9, 2024 13:15
@apyrgio
Copy link
Contributor Author

apyrgio commented May 9, 2024

Other than that, my last suggestion is to add already changelog lines because this fixed at least two separate things and will be easier to attribute now than when releasing.

You're right, I've added some changelog entries in 639dccd. I do not refer to #791, since it's an issue that arose due to an incomplete fix to #749. Therefore, I just refer to #749.

apyrgio added 4 commits May 9, 2024 16:46
Gracefully terminate certain conversion processes that may get stuck
when writing lots of data to stdout. Also, handle a race condition when
a conversion process terminates slightly after the associated container.

Fixes #791
Create the build directory first, and then add the PySide6 package in
it.
@apyrgio apyrgio force-pushed the 2024-04-qa-fixes branch from 639dccd to f6a39ec Compare May 9, 2024 14:22
@apyrgio apyrgio merged commit f6a39ec into main May 9, 2024
10 of 19 checks passed
@apyrgio apyrgio deleted the 2024-04-qa-fixes branch May 9, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants