diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 09:44:37 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 09:44:37 +0000 |
| commit | 5809493be2f6e47e3bbfc8a645ea0d82d5aedd82 (patch) | |
| tree | 7e532b1904c7327ca565885a5b7b91e1453d4922 /src/watch/staleness.rs | |
| parent | bc543e4182d51917fe6bfa608af2c09c8b578671 (diff) | |
| download | aur-build-5809493be2f6e47e3bbfc8a645ea0d82d5aedd82.tar.gz aur-build-5809493be2f6e47e3bbfc8a645ea0d82d5aedd82.zip | |
vercmp: three real bugs, found by comparing against pacman's own binary
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.
Diffstat (limited to 'src/watch/staleness.rs')
0 files changed, 0 insertions, 0 deletions
