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

Partial update when aborting update due to unread news #38

Open
keybreak opened this issue Aug 29, 2021 · 5 comments
Open

Partial update when aborting update due to unread news #38

keybreak opened this issue Aug 29, 2021 · 5 comments

Comments

@keybreak
Copy link

Consider the situation:

  1. User runs update.
  2. Pacman sync the local package database.
  3. Informant hook is run, and it detects unread news, aborting the update.
  4. User reads the news.
  5. User installs a new package on an outdated system, causing a partial update scenario, potentially breaking the system.

Aborting updates is the same as running pacman -Sy, it should never be done, unless the system is updated immediately afterwards. There is no guarantee for that with this hook.

@bradford-smith94
Copy link
Owner

True, I hadn't really considered it in that way before.

Informant's intent is that after the user reads the news they will re-run pacman -Syu to complete the upgrade, but you are correct that there is no way (currently?) for informant to guarantee this happens. The original goal for informant was for the hook to be interactive (essentially pausing updates to read the news and then giving the user the choice to abort or continue) but I quickly found that wouldn't be possible because pacman closes stdin for running hooks and so I settled for always aborting.

As I typed this I had the idea that perhaps informant could install a hook to block further installations (pacman -S without -u) and unblock them after re-running an upgrade (pacman -Syu). I'll need to double check and test if hooks can trigger separately on installs vs full upgrades but this could be a good way to deal with the concern.

I'm inclined to say that this is simply the user's responsibility to complete the upgrade after reading the news, but I do think this "blocking hook" idea is worth exploring.

@jaskij
Copy link

jaskij commented Apr 27, 2022

Maybe after the user reads all the news simply prompt them to re-run pacman -Syu? A simple Y/n prompt which just launcher pacman?

Because of #2 people are running informant with elevated privileges anyway.

@rieje
Copy link

rieje commented May 7, 2024

Why does it have to be a hook and not just simply check for unread news then optionally prompt to mark them as read and update? Simpler and foolproof.

@bradford-smith94
Copy link
Owner

I did want this interactive behavior, that was my original goal for informant, but when pacman runs hooks it closes stdin, so there is no way (that I'm aware of) for informant to read the response of a user prompt. So I settled for the current behavior.

@rieje
Copy link

rieje commented May 7, 2024

I mean the prompt/news should happen before pacman is even run--this is how archnews does it. archnews_wrap takes pacman arguments, check for -Syu or similar, and if found shows news and only after is pacman run with those arguments.

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

No branches or pull requests

4 participants