From 5809493be2f6e47e3bbfc8a645ea0d82d5aedd82 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 09:44:37 +0000 Subject: vercmp: three real bugs, found by comparing against pacman's own binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/versions.rs started as a hand-typed table of ALPM ordering vectors and turned into something better: a differential test that runs the hand-written comparator against pacman's `vercmp` over a 34-fragment cross-product (1156 pairs) of shapes that appear in real recipes. It found three bugs, all of which would have shipped. 1. **Numeric vs alphabetic chunks were inverted.** The code had 'a numeric chunk is always older than an alphabetic one'. It is the opposite: 1.0.1 > 1.0.a. The unit test asserted the wrong direction with the comment 'alpha sorts after numeric', so the suite was protecting the bug. 2. **Separators were ignored entirely.** They are not merely skipped. ALPM distinguishes an alphabetic chunk glued to the previous chunk from one after a separator, and the separated one is newer regardless of the letters: 1.0 > 1.0a, but 1.0 < 1.0.a, and 1.0z < 1.0.a. Two versions differing only in where the dot sits were being called equal. 3. **The end-of-string rule looked at the wrong thing.** When one side runs out, the decision comes from the other side's *next raw character* before any separator skipping: a letter there makes the exhausted string newer (the 1.0rc1 < 1.0 rule), anything else makes it older. The rewrite is character-wise rather than a chunk pre-pass, because the glued-or-separated distinction cannot be made after the separators have been thrown away. Rule 3 is the kind of thing nobody can be confident about from the spec alone, which is exactly what the oracle is for; it is skipped with a note when pacman is not installed, and the curated table — every pair of which was also checked against the binary — always runs. Also: the recipe parser's epoch is now exercised end to end (an epoch added to a PKGBUILD must land on the candidate, and 1:0.9-1 must beat 1.0-1 rather than read as a downgrade), and the downgrade path asserts the index keeps serving the higher version, since a downgrade is a human decision and not an automatic rebuild. 161 tests pass, clippy clean. --- .pi/goals/goal_events.jsonl | 2 ++ 1 file changed, 2 insertions(+) (limited to '.pi/goals/goal_events.jsonl') diff --git a/.pi/goals/goal_events.jsonl b/.pi/goals/goal_events.jsonl index 1dedff7..42f2b5a 100644 --- a/.pi/goals/goal_events.jsonl +++ b/.pi/goals/goal_events.jsonl @@ -39,3 +39,5 @@ {"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"} {"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","evidence":"src/pkginfo.rs is now the production home for tar+text parsing (no libalpm); shims delegate to it and steps.rs uses it. tests/world.rs (5 tests) builds real .pkg.tar.zst archives and asserts: pkginfo ","at":"2026-11-18T09:12:33.748Z"} {"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-stale","at":"2026-11-18T09:14:30.194Z"} +{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-stale","evidence":"tests/staleness.rs (6 tests): staleness_is_derived_on_read_and_nothing_stores_it (a sqlite_master/pragma_table_info scan asserts NO column anywhere stores staleness, and withdrawing a dependency flips","at":"2026-11-18T09:27:24.780Z"} +{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-deps","at":"2026-11-18T09:29:34.423Z"} -- cgit v1.2.3