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

unattended-upgrade-shutdown: fix wait-for-signal #296

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kucharskim
Copy link

@kucharskim kucharskim commented May 3, 2021

I've noticed that unattended upgrade on shutdown doesn't work.

This addresses #295

I've noticed that unattended upgrade on shutdown doesn't work.
After analyzing the code and some test runs, following cought
my attention, from `pydoc3 apt_pkg.get_lock`:

> apt_pkg.get_lock = get_lock(...)
>     get_lock(file: str, errors: bool) -> int
>
>     Create an empty file of the given name and lock it. If the locking
>     succeeds, return the file descriptor of the lock file. Afterwards,
>     locking the file from another process will fail and thus cause
>     get_lock() to return -1 or raise an Error (if 'errors' is True).
>
>     From Python 2.6 on, it is recommended to use the context manager
>     provided by apt_pkg.FileLock instead using the with-statement.

Based on above, I think condition on line 342 should be reversed.
Running `unattended-upgrade-shutdown --wait-for-signal` with my
diff fixes the issue for me.

This addresses mvo5#295
@kucharskim kucharskim marked this pull request as draft May 3, 2021 19:36
@kucharskim
Copy link
Author

Still something is not exactly right. This needs more investigation.

@kucharskim kucharskim marked this pull request as ready for review May 3, 2021 20:58
@kucharskim
Copy link
Author

I think this is ready for review. I did two runs, one after another, and wanted until the very end. This code makes it work, but someone who knows and understand the code base better should carefully review.

@kucharskim
Copy link
Author

Based on my comments in #295 about one from many working u-u in InstallOnShutdown mode, I suspect this diff is not correct. I guess approval from piyaphart90 looks like a mistake, and not a real approval.

@kucharskim kucharskim marked this pull request as draft May 10, 2021 07:16
@rbalint
Copy link
Collaborator

rbalint commented Jun 10, 2021

I have no idea who piyaphart90 is and I've reported the user as potentially being a bot.

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.

2 participants