selfhost: align wwstage dirfilekeep .combined.ww predicate with cstage (#26)
Wwstage dirfilekeep checked only the first 5 chars of ".combined.ww"
(.comb), leaving a latent over-filter for hypothetical filenames of
shape .combXXXX.ww. Cstage enumerate_dir_ww in cmd/ww/main.c uses
strcmp on the full 12-char tail; mirror that here per rule-10
symmetric-stages. Extends the nested-if cascade to also gate on
'i','n','e','d' at offsets nlen-7..nlen-4; the trailing .ww is
already enforced by the function's leading early-out, so re-checking
those three positions would be dead and is called out in the comment.
No corpus trigger today; bootstrap ww2==ww3==ww4 byte-id holds.
Predecessor: #22 dir-enum (9e0816e) introduced the predicate.
115/115 ok. ww2 == ww3 == ww4 byte-id.
This commit is contained in:
@@ -1205,13 +1205,23 @@ fn dirfilekeep(name: *u8, nlen: u64) bool = {
|
||||
};
|
||||
};
|
||||
if (nlen >= 12u64) {
|
||||
// ".combined.ww"
|
||||
// ".combined.ww" — full 12-char match mirrors cstage
|
||||
// cmd/ww/main.c enumerate_dir_ww strcmp (rule 10); the
|
||||
// trailing .ww is pre-guaranteed by the early-out above.
|
||||
if (name[nlen - 12u64] == 46u8) { // '.'
|
||||
if (name[nlen - 11u64] == 99u8) { // 'c'
|
||||
if (name[nlen - 10u64] == 111u8) { // 'o'
|
||||
if (name[nlen - 9u64] == 109u8) { // 'm'
|
||||
if (name[nlen - 8u64] == 98u8) { // 'b'
|
||||
return false;
|
||||
if (name[nlen - 7u64] == 105u8) { // 'i'
|
||||
if (name[nlen - 6u64] == 110u8) { // 'n'
|
||||
if (name[nlen - 5u64] == 101u8) { // 'e'
|
||||
if (name[nlen - 4u64] == 100u8) { // 'd'
|
||||
return false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -345,13 +345,23 @@ fn dirfilekeep(name: *u8, nlen: u64) bool = {
|
||||
};
|
||||
};
|
||||
if (nlen >= 12u64) {
|
||||
// ".combined.ww"
|
||||
// ".combined.ww" — full 12-char match mirrors cstage
|
||||
// cmd/ww/main.c enumerate_dir_ww strcmp (rule 10); the
|
||||
// trailing .ww is pre-guaranteed by the early-out above.
|
||||
if (name[nlen - 12u64] == 46u8) { // '.'
|
||||
if (name[nlen - 11u64] == 99u8) { // 'c'
|
||||
if (name[nlen - 10u64] == 111u8) { // 'o'
|
||||
if (name[nlen - 9u64] == 109u8) { // 'm'
|
||||
if (name[nlen - 8u64] == 98u8) { // 'b'
|
||||
return false;
|
||||
if (name[nlen - 7u64] == 105u8) { // 'i'
|
||||
if (name[nlen - 6u64] == 110u8) { // 'n'
|
||||
if (name[nlen - 5u64] == 101u8) { // 'e'
|
||||
if (name[nlen - 4u64] == 100u8) { // 'd'
|
||||
return false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user