excludes: say when a prune entry no longer matches anything - #2313
Conversation
scripts/excludes/<model>_<variant>.list names files by hand, so it goes stale in
one direction with nothing to show for it: a package renames or drops a sensor
blob, the entry that used to prune it now prunes nothing, and the board keeps
paying for whatever replaced it. The step was
xargs -a ${LIST} -I % rm -f ${TARGET_DIR}%
which cannot tell "removed a file" from "removed nothing", and fed the `#`
separator lines these lists use to rm as literal paths besides.
OpenIPC/builder's hi3518ev200_lite list is the case that prompted this: it names
25 sensor .so files where hisilicon-osdrv-hi3516cv200 now ships 17, so eight
entries have been pruning nothing for however long, while six sensor libraries it
does not name -- 188KB uncompressed -- ship on a camera with one sensor. That
device is 4KB over its rootfs cap. Nothing in any build log said so.
Now each entry is checked before removal and the misses are named, with a count
at the end. Report, never fail: an image carrying a few kB it meant to drop is
something to look at, not a reason to break a build. Boards whose lists are
accurate print nothing new.
The loop also fixes two things the xargs form got away with by accident rather
than intent -- comment and blank lines are skipped explicitly, and a final entry
with no trailing newline is still read.
test_excludes_report.sh drives the real script against a synthetic TARGET_DIR:
present entry removed, absent entry reported, dangling symlink still removed,
last line without a newline still read, comments skipped, exit status 0
regardless. Against the pre-change script it fails 4 of 8 checks and passes the
other 4, which is the part worth stating -- the removal behaviour is unchanged,
only the reporting is new.
PR Summary by QodoReport stale rootfs exclusion entries
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Hardware verification is absent
|
One of two PRs adding drift detection between this repo and OpenIPC/builder, after #2308 (comment) turned out to have three separate instances behind it. This is the cheap half and it lives here because it benefits every consumer of
rootfs_script.sh, not just builder. The other half is OpenIPC/builder#129.The problem
scripts/excludes/<model>_<variant>.listnames files by hand, so it goes stale in one direction with nothing to show for it: a package renames or drops a sensor blob, the entry that used to prune it now prunes nothing, and the board keeps paying for whatever replaced it. The step was one line:which cannot tell "removed a file" from "removed nothing" — and fed the
#separator lines these lists use tormas literal paths besides.The case that prompted it
OpenIPC/builder's
hi3518ev200_lite.listnames 25 sensor.sofiles wherehisilicon-osdrv-hi3516cv200now ships 17. Eight entries have been pruning nothing for however long. Meanwhile six sensor libraries it does not name — 188KB uncompressed — ship on a camera with one sensor:That device is 4KB over its rootfs cap. Nothing in any build log said so.
What changes
Each entry is checked before removal, misses are named, and a count is printed at the end:
Report, never fail. An image carrying a few kB it meant to drop is something to look at, not a reason to break a build. Boards whose lists are accurate print nothing new, so this is silent for everyone it does not concern.
The loop also fixes two things the
xargsform got away with by accident rather than intent: comment and blank lines are skipped explicitly, and a final entry with no trailing newline is still read.Deliberately not here: reporting files that ship but are not named. That needs the built image and a notion of which directories a list is responsible for, and it would fire on every board at once. This half is free.
Test
test_excludes_report.shdrives the realrootfs_script.shagainst a syntheticTARGET_DIR— no build:Against the pre-change script it fails 4 of 8 and passes the other 4:
The four that pass are the part worth stating: removal behaviour is unchanged, including the dangling symlink (
-eis false for one, so there is an explicit-Larm) and the unterminated last line. Only the reporting is new.Part 2 of the test is a drift check anchored on the loop rather than the message text, so wording can change freely but a revert to a bare
xargsfails immediately.Test plan
bash .github/scripts/test_excludes_report.sh— 8/8python3 .github/scripts/lint-workflow-shell.py— 49 run blocks parse cleanpython3 .github/scripts/ci-matrix.py --self-test— ok (99 boards, 132 packages, 52 cases)bash .github/scripts/test_sysupgrade.sh— all checks passedbash -n general/scripts/rootfs_script.shssc333_lite_meari-speed-6sproving the pruning is unchanged — see belowProof that pruning is unchanged
rootfs_script.shruns on the build host and can only everrm -flisted paths, so the claim to test is whether the set of removed files moved. Two clean builds ofssc333_lite_meari-speed-6s— a device that actually has an excludes list — from identical trees differing only ingeneral/scripts/rootfs_script.sh:Target file lists are identical: 665 paths, no diff. That is the only thing
rm -fcan influence.Every remaining byte difference between the two trees is accounted for and none of it is this change:
TIME_STAMP=1787691263vs…65usr/lib/os-releasedate +TIME_STAMP=%s, the same line in both versionsNT_GNU_BUILD_ID(20 bytes).kobusybox(1 byte,20:50:15→20:50:17),8188fu.ko(20:53:53→20:53:57)__TIME__9 of the 11 differing binaries are byte-identical once the build-id note is masked; the other two differ only in an embedded clock string. The script never rewrites a file, so none of this is reachable from it.
No board in this repository has an excludes list.
general/scripts/excludes/does not exist here, so[ -f "${LIST}" ]is false for all 99 boards and the changed branch never executes for any of them. The consumers are OpenIPC/builder's retail devices — which is why the verification above uses one.And it earns its keep immediately on that device:
Three stale entries in a shipping device's list that nothing could have surfaced before.