Skip to content

tests: under a Latin-1 locale 4 rows of test_bootstrap_non_utf8_branch.py and test_bootstrap_branch_bytes.py fail on main, expecting the byte 0xFF spelled a\udcffb as UTF-8 reads it where bootstrap.py rightly prints U+00FF, and no issue names them #1301

Open

Description

@brettheap

(lane openRepoShape-1, 2026-11-10T09:18:31Z)

Found by: w1283a, lane 1's writer of PR #1300 (for #1283), in its final report: it ran tests/test_bootstrap_spelling.py, tests/test_bootstrap_non_utf8_branch.py and tests/test_bootstrap_branch_bytes.py under a Latin-1 pytest, on main and on #1300's head, and found 4 rows beyond #1259's 13 that fail on both at the same kind of assert. Measured again, row by row and by hand, by i1300a, lane 1's investigator of those findings; every measurement below is i1300a's. The report is a lane 1 agent's message and is not posted on GitHub.

Lane 3 places this issue, and it has no milestone here: v1.2.1 is frozen. It is in the area of #1214 (settled by #1258), #1259 (#1278) and #1283: rows that fail under a one-byte locale, and whether each is a test that cannot judge there or a tool defect.

This body is ASCII. In the tool's output below, <ff> stands for the one byte 0xFF that the tool wrote, which a Latin-1 terminal shows as U+00FF, and <c3 bf> for the two bytes of U+00FF in UTF-8. A backslash escape, such as \udcff or \u2014, is text the tool printed.

What is wrong

Under a Latin-1 locale four rows fail on main, and each passes under UTF-8 and under ASCII. Each hands git or the tool the branch a<ff>b and asserts a line that spells it a\udcffb, the way a UTF-8 or ASCII process reads the byte 0xFF (a lone surrogate, U+DCFF, which spelled escapes). A Latin-1 process reads the same byte as the character U+00FF. So under Latin-1 the assembly root's scripts/bootstrap.py prints the name as that character, and the row's line is not in what it prints.

The tool is right there (measured below): every run exits 0 and ends bootstrap ok, makes or moves the same branches, leaves HEAD on the same ref by its bytes as under UTF-8, and the merge --ff-only line it prints, pasted into a Latin-1 shell, brings the branch forward. Only the spelling of the name differs. These are #1214's kind a (#1258's "a2": "the tool runs and answers rightly for the bytes Latin-1 gives, and the row expects UTF-8's reading or spelling"), and none of them is a tool defect.

No issue names them. #1214 did not list them, #1259's 13 rows and #1285's 16 rows are in other files, and #1283 is another row (details below). CI and the bench run UTF-8, so no gate sees them.

The four, with each one's failing assert (line numbers at main 0354a7e70):

# Test id Assert Expected line (from the row) Line printed under Latin-1
1 tests/test_bootstrap_non_utf8_branch.py::test_a_branch_past_the_pin_is_moved_back_whatever_its_upstream_is_named[the-byte-0xff] :232, assert (f" [spec] spec: branch {spelled(raw)} moved back ...") in result.stdout.split("\n") [spec] spec: branch a\udcffb moved back aaa9f6a4f6cd -> 551f7d6c32bc, the pin; nothing is lost, origin/a\udcffb still holds those commits, and `git -C spec merge --ff-only "$(printf -- 'origin/a\377b')"` brings the branch forward [spec] spec: branch a<ff>b moved back aaa9f6a4f6cd -> 551f7d6c32bc, the pin; nothing is lost, origin/a<ff>b still holds those commits, and `git -C spec merge --ff-only 'origin/a<ff>b'` brings the branch forward
2 tests/test_bootstrap_non_utf8_branch.py::test_a_leg_on_a_branch_whose_name_is_not_utf8_is_placed_on_every_run[make-bootstrap] :297, assert (placed + left in result.stdout) is (not given and run == 1) the leg was on a\udcffb, which keeps its commits; it is on main now the leg was on a<ff>b, which keeps its commits; it is on main now
3 tests/test_bootstrap_non_utf8_branch.py::test_a_leg_on_a_branch_whose_name_is_not_utf8_is_placed_on_every_run[--branch-a<ff>b] :296, assert placed in result.stdout [spec] spec: on a\udcffb at 551f7d6c32bc (branch tip == pin) [spec] spec: on a<ff>b at 551f7d6c32bc (branch tip == pin)
4 tests/test_bootstrap_branch_bytes.py::test_a_name_that_is_not_utf8_is_still_carried_and_the_branch_made :381, assert (f" [{leg}] {leg}: branch a\\udcffb created at " ...) in out.split("\n") [spec] spec: branch a\udcffb created at 0242d8c77092 U+2014 at the pin [spec] spec: branch a<c3 bf>b created at 0242d8c77092 U+2014 at the pin (the row sets PYTHONIOENCODING=utf-8:strict, so U+00FF is written as UTF-8)

Each assert's message is the run's stdout, whose first line is bootstrap: Atlas (<the row's root>).

Where the name comes from: rows 1, 3 and 4 pass --branch a\udcffb, which the Latin-1 pytest process writes as the byte 0xFF and the Latin-1 child reads as U+00FF. Row 2 passes no --branch: the test makes the branch with git branch a\udcffb, and the tool reads it back from git through _head_of, which decodes with os.fsdecode, so under Latin-1 it is U+00FF there too.

What was measured, and by whom

Measured by i1300a, on main 0354a7e7012a1810338d0d93900573e38b9220e7, in a detached worktree of it; Python 3.12.3, pytest 9.1.1, git 2.43.0.

1. The two files, with pytest itself in each locale:

python3 -m pytest -p no:cacheprovider -o tmp_path_retention_policy=failed \
  --basetemp=<scratch> -rf tests/test_bootstrap_non_utf8_branch.py tests/test_bootstrap_branch_bytes.py
Locale Summary line
Latin-1 4 failed, 83 passed, 5 skipped in 19.10s
UTF-8 92 passed in 20.69s
ASCII 86 passed, 6 skipped in 18.02s

The Latin-1 run's short summary names exactly the four rows above:

FAILED tests/test_bootstrap_non_utf8_branch.py::test_a_branch_past_the_pin_is_moved_back_whatever_its_upstream_is_named[the-byte-0xff]
FAILED tests/test_bootstrap_non_utf8_branch.py::test_a_leg_on_a_branch_whose_name_is_not_utf8_is_placed_on_every_run[make-bootstrap]
FAILED tests/test_bootstrap_non_utf8_branch.py::test_a_leg_on_a_branch_whose_name_is_not_utf8_is_placed_on_every_run[--branch-a<ff>b]
FAILED tests/test_bootstrap_branch_bytes.py::test_a_name_that_is_not_utf8_is_still_carried_and_the_branch_made

The four ids alone, with -v: 4 passed under UTF-8 and 4 passed under ASCII (each row PASSED, none skipped).

2. What a child reads from the argument a<ff>b (python3 -c 'import sys; print(ascii(sys.argv[1]))'): 'a\xffb' (U+00FF) under Latin-1; 'a\udcffb' under UTF-8 and under ASCII.

3. Each row's scenario run by hand, in a copy of the tree the failed Latin-1 run kept, put back to the row's starting state first, then scripts/bootstrap.py with the row's arguments and no PYTHONIOENCODING (row 4: with and without its utf-8:strict), once under each locale. HEAD is read with git symbolic-ref -q HEAD as bytes.

  • Row 1 (--skip-validators --branch a<ff>b; spec detached at the pin 551f7d6c32bc, a<ff>b at aaa9f6a4f6cd, one commit past it, tracking refs/remotes/origin/a<ff>b; code on main):
    • Latin-1: exit 0, bootstrap ok, no traceback; the line in the table above; then [code] code: branch a<ff>b created at 82e19230652a \u2014 at the pin. After: spec HEAD refs/heads/a<ff>b at 551f7d6c32bc, code HEAD refs/heads/a<ff>b at 82e19230652a.
    • UTF-8 and ASCII: exit 0, the row's expected line (a\udcffb, and the "$(printf -- 'origin/a\377b')" command), the same HEADs by their bytes.
    • The printed command, pasted into bash -c in the same locale, from the root: exit 0 under all three, and refs/heads/a<ff>b is then aaa9f6a4f6cd, the commit past the pin. Under Latin-1 the command is git -C spec merge --ff-only 'origin/a<ff>b'; bash's only output was its own warning: setlocale: LC_ALL: cannot change locale (en_US.ISO-8859-1).
  • Row 2 (no arguments, validators run; spec on a<ff>b at the pin), twice:
    • Latin-1: run 1 exit 0, [spec] spec: on main at 551f7d6c32bc (branch tip == pin) then the leg was on a<ff>b, which keeps its commits; it is on main now; run 2 exit 0, the on main line alone. After: HEAD refs/heads/main in both legs.
    • UTF-8 and ASCII: the same, with the leg was on a\udcffb, ....
  • Row 3 (--branch a<ff>b; spec on a<ff>b at the pin, code on main), twice:
    • Latin-1: run 1 exit 0, [spec] spec: on a<ff>b at 551f7d6c32bc (branch tip == pin) and [code] code: branch a<ff>b created at 82e19230652a \u2014 at the pin; run 2 exit 0, on a<ff>b at ... in both legs. After: HEAD refs/heads/a<ff>b in both legs.
    • UTF-8 and ASCII: the same, spelled a\udcffb.
  • Row 4 (--skip-validators --branch a<ff>b; both legs detached at their pins 0242d8c77092 and ea1b6d4df6f4):
    • Latin-1 with the row's PYTHONIOENCODING=utf-8:strict: exit 0, [spec] spec: branch a<c3 bf>b created at 0242d8c77092 U+2014 (as e2 80 94) at the pin, the same for code; without it: branch a<ff>b created at 0242d8c77092 \u2014 at the pin. After either: HEAD refs/heads/a<ff>b in both legs, at the pins. No could not create branch.
    • UTF-8 and ASCII, either way: branch a\udcffb created at ..., the same HEADs.

So in every row, under Latin-1 the exit code, the branches, HEAD's bytes and the pins are what the row's later asserts expect (rev(leg, f"refs/heads/{raw}") == pin, head_bytes(leg) == b"refs/heads/a\xffb\n" or b"refs/heads/main\n", "could not create branch" not in out). Those asserts are not reached under Latin-1, because each row fails first on the spelled line.

4. The guard #1258 gives this kind, asked in a child in each locale: skip_where_the_locale_does_not_spell_it_as_utf_8("a\udcffb", A_BYTE_READ_AS_A_SURROGATE) skips under Latin-1 only, with this locale's encoding (iso8859-1) reads b'a\xffb' as 'a\xffb', not as 'a\udcffb': the row needs a byte that is not UTF-8, which Python reads in as a surrogate (U+DC80 to U+DCFF) where the locale is UTF-8 or ASCII; here it is a character, and the tool takes it as one. Under UTF-8 and ASCII it does not skip.

The logs are in lane 1's scratch, /workspace/projects/openRepoShape-worktrees/_lane1-scratch/i1300a/logs/ (b-latin1.log, b-utf8.log, b-ascii.log, ids4-utf8.log, ids4-ascii.log, probe-b.log).

Read from the code, not run

What is not known

Done when

See #1214, #1258, #1259, #1278, #1283, #1285, #1209, #1224, #1196, #1153, #1300, #710, #932, #715, #663 and #455.

Lane: openreposhape-1 (openRepoShape-1)

Activity

  1. brettheap commented on Nov 10, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session 300f8f46-004a-4e72-8587-4f192be2e108@Eagle, 2026-11-10T09:18:47Z, for #1301

    Logged in lanes/log/openRepoShape-1.md at 83e3fd5f4e99caaee183a72f63aa99ee18256388.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1301:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1301"`, kept where the row or its body names `#1301`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1301` as a whole token:
       none
    
  2. added this to the v1.2.2 milestone on Nov 10, 2026
  3. added a commit that references this issue on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions