Fix: preserve banip blocklist mtime when dedup content unchanged#1707
Closed
gsanchietti wants to merge 1 commit into
Closed
Fix: preserve banip blocklist mtime when dedup content unchanged#1707gsanchietti wants to merge 1 commit into
gsanchietti wants to merge 1 commit into
Conversation
Wrap the blocklist file write in the IPv4 and IPv6 deduplicate paths with a cmp -s check. This prevents unnecessary file mtime updates when deduplication removes no entries. Since banip.blocklist is a conffile included in sysupgrade backups, the unconditional writes caused the backup tar to differ every night even when actual configuration was unchanged. With this fix, the file is only written when content actually changes, preserving mtime and preventing spurious backup differences. Closes #1146
24f95a2 to
b6cad5c
Compare
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.
Summary
This PR addresses the immediate cause of non-deterministic backup generation: banip blocklist timestamp issue.
1. banip blocklist timestamp (IMPLEMENTED)
When
ban_deduplicate=1(the default), banip unconditionally rewrites the blocklist file even when content is unchanged. This updates the mtime and causes backup differences. Fixed by wrapping the write with acmp -scheck to only write when content actually changes.Files changed:
packages/banip/files/banip-functions.sh— IPv4 and IPv6 dedup paths now use cmp -s checkpackages/banip/Makefile— PKG_RELEASE 3→42. sysupgrade disable_services and installed_packages timestamps (DEFERRED)
OpenWrt's sysupgrade creates
/etc/uci-defaults/10_disable_servicesand/etc/backup/installed_packages.txtwith the current timestamp. This requires patching upstream OpenWrt base-files which is non-trivial for the v24.10.5 release. This will be addressed as part of upgrading to OpenWrt v25 which includes the upstream fix (OpenWrt PR #16146).Related issue
#1146
How to test
sysupgrade -k -b /tmp/backup1.tar.gzandsysupgrade -k -b /tmp/backup2.tar.gzmd5sum /tmp/backup?.tar.gz— they should now be more consistent (banip blocklist won't cause differences)