Repository navigation
Conversation
bin/fm-test-run.sh sorts its lane and inventory lists with LC_ALL=C but ran every comm under the caller's locale, so on a host whose locale is not the C collation the coverage guard rejected correctly ordered input with "comm: input is not in sorted order" and failed on a healthy tree. Prefix each of the nine comm calls with LC_ALL=C, matching the collation the same code sorts under, and document the contract in the runner's header. tests/fm-test-run.test.sh runs the real guard under a non-C UTF-8 locale, resolved from the host or compiled into a private LOCPATH, and asserts plain comm rejects those same lists there so the case cannot pass vacuously.
|
Speaking as Kun's firstmate: thanks @babbarc — this is a clean, narrow restore. What I checked (tip Contract-class: restore. The guard already promised set equality over C-sorted lists; the caller's locale was making a healthy tree look unsorted. Unconfigured product behavior is unchanged. VISION.md, rule by rule
CI: fork runs were waiting on approval. Diff is test-runner + one test file only, so I approved CI Overlap: #7382 also carries an LC_ALL=C Nothing needed from you. Auto-merge candidate once CI + no-mistakes are fully green. |
…host The test-runner bounds change already prefixes every comm call in bin/fm-test-run.sh with LC_ALL=C, matching the collation its lists are sorted under. This carries the rest of the change offered upstream as kunchenguid#7396: the runner header's contract note, and the regression test that runs the real coverage guard under a non-C UTF-8 locale (resolved from the host or compiled into a private LOCPATH) and asserts that plain comm rejects those same lists, so the case cannot pass vacuously.
Intent
The captain approved this as its own fifth upstream offer. bin/fm-test-run.sh sorts with LC_ALL=C but runs every comm under the caller's locale, so on any host that is not on the C collation the coverage guard fails with "comm: input is not in sorted order" - a real pre-existing flaw on upstream's own main, reproducible on clean origin/main 1a6714f by running the coverage guard under LANG=en_US.UTF-8 (it passes under LC_ALL=C). Three separate validation runs across two other offers each independently produced this fix and each had to be told to drop it because those offers were deliberately narrow, so he wants it offered once, properly, on its own. FILE IT as its own fifth offer.
What Changed
bin/fm-test-run.shnow runs everycommcall in the coverage guard and inportable_serial_unhintedunderLC_ALL=C, the same collation used by thesortcalls that build those lists. Before this,commused the caller's locale, so on a host with a non-C collation (for exampleLANG=en_US.UTF-8) the guard failed withcomm: input is not in sorted ordereven though the tree was fine. The header comment now notes this.test_coverage_guard_survives_a_utf8_collation_localeintests/fm-test-run.test.sh. It looks for an installed UTF-8 locale whose collation differs from C. If the host has none, it compilesen_US.UTF-8into a privateLOCPATHwithlocaledef. It then checks that plaincommreally rejects the C-ordered lists in that locale, and that--check-coveragestill passes and printsFM_TEST_COVERAGE ok. If no such locale can be found or built, the test skips.Risk Assessment
✅ Low: The change only adds LC_ALL=C to every comm call in bin/fm-test-run.sh, so the comparisons now use the same collation as the LC_ALL=C sorts that produce their inputs. No comm call in the file is left under the caller's locale. The new test reproduces the failure under a real non-C UTF-8 locale and checks the guard's actual result. It does not match source text, which satisfies the stated intent.
Testing
I reproduced the bug on base: the coverage guard fails with "comm: input is not in sorted order" under LANG=en_US.UTF-8 and passes under LC_ALL=C. On the target, the same command passes in both locales. The new regression test fails against the base script and passes against the fix. The full fm-test-run.test.sh still exits 1 because of one failure, and it is not caused by this change: a nested run of fm-session-lock-ancestry.test.sh expects orphaned processes to be reparented to PID 1, but this host uses a subreaper (PID 753). Evidence is a before/after CLI transcript. There is no UI surface.
Evidence: Coverage guard before/after transcript under a UTF-8 vs C locale
Source: Coverage guard before/after transcript under a UTF-8 vs C locale
BASE 5f2b81b LANG=en_US.UTF-8: comm: input is not in sorted order, exit=1 BASE 5f2b81b LC_ALL=C: FM_TEST_COVERAGE ok total=259 ..., exit=0 TARGET f1f123a LANG=en_US.UTF-8: FM_TEST_COVERAGE ok total=259 ..., exit=0 TARGET f1f123a LC_ALL=C: FM_TEST_COVERAGE ok total=259 ..., exit=0Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-session-lock-ancestry.test.sh:772- This failure is not caused by this change. tests/fm-session-lock-ancestry.test.sh fails here with 'the pty-host was not reparented to init after the daemon ended', and it is run in a nested way from tests/fm-test-run.test.sh (the '--jobs on a proven family' case), so that whole file exits 1. The test expects orphaned processes to be reparented to PID 1, but on this host they are reparented to a subreaper (PID 753). That is a problem with this test environment. It is outside this deliberately narrow offer, so I left it unfixed.env -u LC_ALL LANG=en_US.UTF-8 bash bin/fm-test-run.sh --check-coverageon a base 5f2b81b worktree (reproduced: exit=1, 'comm: input is not in sorted order')LC_ALL=C bash bin/fm-test-run.sh --check-coverageon base 5f2b81b (exit=0, FM_TEST_COVERAGE ok)env -u LC_ALL LANG=en_US.UTF-8 bash bin/fm-test-run.sh --check-coverageon target f1f123a (exit=0, FM_TEST_COVERAGE ok)LC_ALL=en_US.UTF-8 bash bin/fm-test-run.sh --check-coverageandLC_ALL=C ...on target (both exit=0)bash tests/fm-test-run.test.shwith base bin/fm-test-run.sh temporarily swapped in (new test fails with the comm sorted-order error; swap reverted)bash tests/fm-test-run.test.shon target (new test_coverage_guard_survives_a_utf8_collation_locale passes under en_US.utf8; one unrelated nested failure from tests/fm-session-lock-ancestry.test.sh)bash tests/fm-session-lock-ancestry.test.shrun on its own plus an orphan-reparenting probe (orphans go to subreaper PID 753, not PID 1)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.