review: teach the gates what a broken cli line looks like - #2367
Conversation
PR Summary by QodoAdd review gates for safe CLI paths and Majestic reloads
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
Two mistakes around `cli` are silent on the camera, and neither the compliance gates nor best_practices.md had anything to say about either. The path. `cli -s` cannot fail: yaml-cli stores whatever dotted path it is handed, creating the intermediate mappings as it goes, and exits 0; majestic then ignores a key it does not recognise. So a typo applies nothing and reports nothing for the life of the device. OpenIPC/builder shipped six of them on t40_lite_movols-mo-805p behind a trailing colon -- bitrate, rate-control mode, profile, GOP size, GOP mode and OSD size, none of which ever applied. The signal. majestic reloads on SIGHUP and on nothing else. infinity6e's zoom.sh sends `killall -10` in nine places; signal 10 is SIGUSR1, which the bundled thread pool catches to park a thread and never resumes (#2365), so those crops were never applied either. And a signal is only safe once majestic can catch it: S95majestic starts it with start-stop-daemon -b, so it is visible to pidof with SigCgt still 0000000000000000, and SIGHUP's default action is to terminate. The compliance rule takes the binary half -- a literal path carrying a stray character or an empty component, and a signal that is not SIGHUP -- and explicitly exempts a path built at runtime, which is legitimate and undecidable from a diff. §7.2 of best_practices.md takes the judgement half and the reasoning. OpenIPC/builder#146 lints the path half of this mechanically, over the tree where the 709 shipped `cli -s` lines actually live.
Four things wrong with the first cut, all found in review. The success criteria forbade an empty path component without saying that the conventional leading dot is not one, so `.video0.size` could be read as having an empty first component and a correct line failed the gate. Spelled out. The scope glob `general/package/*/files/` describes packages exactly one level below general/package, so it missed nested layouts -- and general/package/legacy/datalink/files/tweaksys is one of them, with eight `cli -s` writes. Widened to anywhere under general/package/. The failure criteria rejected every non-SIGHUP signal rather than every non-SIGHUP *reload*. sysupgrade deliberately sends SIGQUIT to make majestic release the SDK while staying alive, and SIGTERM to stop it is ordinary; both would have failed the gate. Scoped to reload intent, with the lifecycle cases named so they are not raised. And §7.2 closed by saying neither check is a compliance gate, in the same commit that added one. It now says which half is the gate and which half stays judgement -- whether a well-formed key is one the target build declares, and whether a runtime-assembled path is right, are the parts a diff cannot settle.
ae15826 to
8157477
Compare
Problem
Two mistakes around
cliare completely silent on a camera, and neither the compliancegates nor
best_practices.mdhad anything to say about either. Both have shipped.The path.
cli -scannot fail. yaml-cli stores whatever dotted path it is handed,creating the intermediate mappings as it goes, and exits 0; majestic then ignores a key it
does not recognise. So a typo applies nothing and reports nothing, for the life of the
device.
OpenIPC/builder'st40_lite_movols-mo-805phas been shipping six of them behinda trailing colon:
Bitrate, rate-control mode, profile, GOP size, GOP mode and OSD size have never applied on
that camera.
The signal. majestic reloads on
SIGHUPand on nothing else.general/package/sigmastar-osdrv-infinity6e/files/script/zoom.shsendskillall -10innine places. Signal 10 is
SIGUSR1, which majestic's bundled thread pool catches to park athread and never resumes (#2365) — so those crops were written to the file and never
applied.
And a signal is only safe once majestic can catch it.
S95majesticstarts it withstart-stop-daemon -b, which returns at the fork, so it is visible topidoflong beforemain()installs a handler — and until thenSIGHUP's default action is to terminate.Measured on a lab hi3516ev200:
What this adds
pr_compliance_checklist.yaml— one rule taking the binary half: a literal pathcarrying a stray character or an empty component, and a signal that is not SIGHUP. It
explicitly exempts a path built at runtime (
cli -g ".$1"in builder'suvc-gadget-setupis correct and undecidable from a diff), anything under.github/orcontrib/, andcliused against another file through an explicit-i.best_practices.md§7.2 — the judgement half and the reasoning, next to §7.1'sexisting note on shell portability.
Why a rule rather than only a linter
Both.
OpenIPC/builder#146lints the path half mechanically, over the tree where the 709shipped
cli -slines actually live — that is the deterministic, free check, and it foundthe six bad lines immediately. What a linter cannot judge is whether a well-formed key is
one a given majestic build declares (it varies by vendor and flavour), or whether adding a
killallto a boot-time script is safe. That is what the review rule is for.Evidence
This is review configuration: it reaches no image, and the selector agrees.
Hardware tested on
Not applicable, and the template says so: this is review configuration and cannot alter
what the firmware does on a camera. The
SigCgtmeasurement quoted above comes from thework in #2366, on a lab hi3516ev200; nothing in this diff runs anywhere but Qodo.
Scope
general/package/all-patches/linux/general/overlay/or in a sharedload_<vendor>script hardcodes a value specific to my boardLD_PRELOAD, and no binaries that cannot be rebuilt from source