Repository navigation
mintUpdate: Make "Ignore the current update" match the source version - #1112
Merged
Merged
Conversation
…ate" "Ignore the current update for this package" stores source=source_version (since 7a79b61), but the update list and mintupdate-cli compared that version with a binary version. Where the two differ (epochs such as bsdutils 1:2.39.3-9ubuntu6.6, -signed packages such as grub2-signed 1.202.5 / grub-efi-amd64-signed 1.202.5+2.12-1ubuntu7.3, binNMUs) the update was not ignored, or only partly ignored: for util-linux only bsdutils stayed in the list. Move the matching rule to one is_blacklisted() helper in aptUpdater.py that accepts the source version as well as the binary version, so versions typed in the preferences keep working, and use it from mintupdate-cli instead of its own copy. mintupdate-cli now checks every package of an update and skips the whole update when one matches. Add tests/test_blacklist.py, run with /usr/bin/python3 -m unittest discover -s tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
A few thoughts on the ignore rules, just ideas for later, nothing this PR depends on :)
Thanks again for all the recent reviews! |
Member
We already group packages by source package, if possible (and individual package names are in the Packages notebook tab). It might be simpler just to mention this in the Blocked packages description text in Preferences.
Same... add something more descriptive to the button label or change it to Export current blacklist...
I think generally updates will refuse anyhow, wanting same-version dependencies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"Ignore the current update for this package" adds the package to the blacklist, but after a refresh the update can still be listed. Automatic upgrades can also install it even when the blacklist was exported to /etc/mintupdate.blacklist. This happens when a binary's version is different from its source package's version. That covers epochs (bsdutils 1:2.39.3-9ubuntu6.6 from util-linux 2.39.3-9ubuntu6.6), -signed packages (grub-efi-amd64-signed 1.202.5+2.12-1ubuntu7.3 from grub2-signed 1.202.5) and binNMUs. When only some of the binaries differ, part of the update stays: for util-linux, bsdutils alone remains in the list.
This looks like the cause of #682 (grub2-signed), #891 and #750. All three were closed by the stale bot without a fix.
Root cause: since 7a79b61 ("Blacklist: Allow right-click blacklisting of multiple source packages grouped as a single update"), the menu entry stores
source=source_version(Update.source_packages, usr/lib/linuxmint/mintUpdate/Classes.py:68 and :125). Both checks still compare the entry with a binary version:AptUpdater.is_blacklisted()is called withpackage.candidate.version(usr/lib/linuxmint/mintUpdate/aptUpdater.py:303 on master).update.new_version(usr/lib/linuxmint/mintUpdate/mintupdate-cli.py:68). That value is the binary version of the last package added to the update.The change moves the rule into a single
is_blacklisted(blacklist, candidate)function in aptUpdater.py, and the update list and mintupdate-cli now both call it. A versioned entry matches when its version equals either the candidate's source version or its binary version. Entries typed in Preferences with the version shown in the update list keep working, and fnmatch patterns on the name work as before. mintupdate-cli now checks every package of an update and skips the whole update if any package matches, so the result no longer depends on which package happens to be first or last in the update.Automatic upgrades run mintupdate-cli as root and only read /etc/mintupdate.blacklist. They see a "current update" entry only if the user exported the blacklist from Preferences after adding it. This PR does not change that.
Tests: there is no test suite on master (tests/ was removed with the kernel window), so I added tests/test_blacklist.py. It uses the standard library's unittest and stub packages, and forces the memory GSettings backend, so it reads nothing from APT or dconf. It still needs the com.linuxmint.updates schema to be installed, as on any Mint system. It runs the real
AptUpdater.add_update()and runs mintupdate-cli.py as a script through runpy, with a stubbed cache and no /etc/mintupdate.blacklist.The other 8 tests pass both before and after. They cover binary-version entries, name patterns, entries for another version, and the case with nothing ignored.
I also reproduced it end to end on Mint 22 (noble), using a copy of the dpkg status file with grub-efi-amd64-signed set back to 1.202+2.12-1ubuntu7 and passed through APT_CONFIG. Nothing was installed and nothing ran as root:
With the same fake status file, plus util-linux set back to 2.39.3-9ubuntu6,
AptUpdater.find_changes()with the memory GSettings backend still listed bsdutils (and grub-efi-amd64-signed) after the "Ignore the current update" entries were added. After the fix it lists neither.Not verified: I did not click through the GUI or run a real
mintupdate-cli upgrade/automatic upgrade. I did not test on LMDE, so #750 (kernel on LMDE) and #891 (LibreOffice) are matched by the pattern of the bug, not reproduced. Flatpak and Cinnamon spice blacklisting is a separate code path and is unchanged.Who is affected: anyone who uses "Ignore the current update" on a package whose binary and source versions differ, and anyone with automatic upgrades who exported such an entry. There is one behavior change in mintupdate-cli: if any package of a grouped update (for example a kernel update) matches an entry, the whole update is skipped. Before, only the first package's source name and the last package's version were checked.
To revert, revert this commit. The blacklist format does not change, so existing entries do not need migration.
Thanks @mtwebster for reviewing and merging my earlier fixes (linuxmint/mintsources#285, linuxmint/mintsources#286, linuxmint/mintinstall#518, linuxmint/mintcommon#78).
🤖 Generated with Claude Code