Skip to content

assembly-root bootstrap.py: under Latin-1, tracking_branch tb\udcffx is made with HEAD on it at the pin, but _head_of reads the ref as another text, so it says could not create branch, then git refused to check it out, both false (#1259 row 13) #1283

Open

Description

@brettheap

(lane openRepoShape-4, 2026-11-09T16:13:15Z)

Found by: W1259, lane 4's writer of #1259 (the 13 rows that fail under a Latin-1 locale and pass under UTF-8), in its final report, section "Kind (c) defect, for lane 4 to file", and in the body of its draft PR #1278, under the heading "The tool defect (row 13, kind c)". Row 13 is tests/test_bootstrap_spelling.py::test_a_branch_name_is_spelled_in_every_line_that_names_it. W1259 found it to be a tool defect and not a test that cannot judge, so #1278 leaves it failing and untouched for an issue of its own. This is that issue. It follows #1259. The report is a lane 4 writer'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 a tool defect under a one-byte locale, in the area of lane 3's #1078, #1112, #1106 and #1153 (adopt-project.py, a name the locale spells otherwise than the plan wrote it) and of the one-byte-locale tests of #1214 and #1259.

Nothing was re-run for this issue. Every measurement below is W1259's, read from its saved logs (in lane 4's scratch, tools/run/w1259/logs/probe-branch-latin1.log and tools/run/w1259/logs/probe-branch-second-run-latin1.txt) and its report. A sentence that is read from the code and not measured says so, and a reading that is the filer's and not W1259's says so. This body is ASCII, so each non-ASCII character is written as its code point, and a printed escape is written with a backslash.

What is wrong

Under a Latin-1 locale the assembly root's bootstrap.py makes the branch that tracking_branch names and leaves HEAD on it at the pin, and then says it could not make it (first run) and that git refused to check it out (every later run). Both claims are false, and the run still ends bootstrap ok, exit 0. HEAD is on the right branch at the right commit (measured, below), so what the user is told is wrong, and the line tells them to "deal with what git said", where git said nothing.

What was measured, and by whom

Measured by W1259, under Latin-1.

What the probe showed:

  1. The row fails under Latin-1 at its first assert (tests/test_bootstrap_spelling.py:454 at cd9f3cfd1), which looks for [spec] spec: branch tb\udcffx created at <pin> .... The first run's stdout, as the assert's message holds it for the spec leg (pytest cuts the rest with ...), reads:

      [spec] spec: could not create branch 'tb\udcffx' at the pin f6d8ff445a2d; leaving detached
              `git checkout -b` exited 0, and HEAD is not on the branch at the pin
              nothing else is tried; the recorded pin is authoritative. Deal with what git said and run bootstrap again.
    
  2. The branch exists and HEAD is on it at the pin, in both legs, before and after a second run. In the tree the failed run kept, W1259's probe-branch.sh ran git symbolic-ref HEAD and git rev-parse HEAD in spec and in code, then ran scripts/bootstrap.py --skip-validators again, then asked both again. The ref bytes printed by od are r e f s / h e a d s / t b 377 x in both legs, before and after; the commits are f6d8ff445a2d... (spec) and ce2298350500... (code), before and after, and they are the pins (git rev-parse HEAD:spec HEAD:code in the root gives the same two).

  3. The second run says git refused, and exits 0. Its stdout, for both legs, then bootstrap ok and EXIT 0:

      [spec] spec: branch tb\udcffx is at the pin f6d8ff445a2d, and git refused to check it out:
              `git checkout` exited 0, and HEAD is not on the branch at the pin
              nothing else is tried; the recorded pin is authoritative. Deal with what git said and run bootstrap again.
      [code] code: branch tb\udcffx is at the pin ce2298350500, and git refused to check it out:
              `git checkout` exited 0, and HEAD is not on the branch at the pin
              nothing else is tried; the recorded pin is authoritative. Deal with what git said and run bootstrap again.
    

    Both messages say git exited 0 and then say it refused; with HEAD on the branch at the pin (point 2), neither claim holds.

  4. UTF-8 and ASCII do not show it (the three-file runs, tests/test_bootstrap_spelling.py with the two other files, in W1259's PR body): 407 passed under UTF-8, on main and on the head; under ASCII "Rows 8 and 13 pass under ASCII on main and still do". The row asserts the created at line on the first run, so under both it is made and said so.

Read from the code, not measured (W1259's reading; the filer read the same lines again at origin/main 674077657, where the file is the same blob, 41c2eb42b563, as at 2fde6c3d0; on cd9f3cfd1 and 42308f26b the lines are :782, :798, :863, :1446, :1696 and :1698):

  • _head_of (:841) returns HEAD's ref as os.fsdecode(ref.rstrip(b"\r\n")) (:857). Its docstring says a branch not in UTF-8 "reads back as the refs/heads/<branch> built from the same name" (bootstrap.py: moving a leg off a branch overwrites an ignored file and ends a merge, P9 does not name the branch it leaves, a branch at its upstream's tip is left when HEAD is on a branch, a HEAD outside refs/heads/ is read two ways #704). W1259: that holds only where os.fsdecode(os.fsencode(name)) == name.
  • W1259: "Under Latin-1, os.fsdecode(b"\xff") is U+00FF, not U+DCFF." os.fsencode("tb\udcffx") is b"tb\xffx" (surrogateescape), which is what git is handed, so git makes refs/heads/tb\377x. _head_of reads that back as refs/heads/tb U+00FF x, and the code builds refs/heads/{branch} from the manifest as refs/heads/tb U+DCFF x. The two texts differ.
  • Two places compare them:
    • the creation step, if _head_of(sub) != (pin, f"refs/heads/{branch}") (:1755), which prints could not create branch (:1757);
    • _check_out, if _head_of(sub) == (pin, f"refs/heads/{branch}") (:922), which returns "git checkout exited 0, and HEAD is not on the branch at the pin", and whose caller prints "git refused to check it out" (:1505).

What is not known

  • Other codecs. W1259 probed Latin-1 only. The filer's reading, not run: another one-byte codec that decodes 0xFF to a character reads it as Latin-1 does. Under ASCII, 0xFF reads as U+DCFF, and the row passes (point 4).
  • Which names are affected. The filer's reading, not run: under Latin-1 a name whose text survives os.fsdecode(os.fsencode(name)) unchanged is not affected, and the names the compare misreads are those that hold a lone surrogate, U+DC80 to U+DCFF, for a byte 0x80 to 0xFF. A branch a manifest spells as U+00FF (a character, not a surrogate) was not measured. How many manifests spell a branch as a surrogate is not known; the row's is the one known.
  • The row's later phases. The row has two more phases that expect on tb\udcffx at <pin> (branch tip == pin) and, in code after a local commit, PIN <pin> != branch tb\udcffx tip <tip>. Neither was reached, because the first assert fails. W1259's second-run probe is the only measure of the second phase, and it shows the "refused" lines above. The third phase was not measured.
  • The upstream. The creation step returns (:1761) before git branch --set-upstream-to=origin/<branch> (:1763), so the first run may leave a leg that has a refs/remotes/origin/<branch> (spec in the row) with no upstream. This is read from the code. W1259 did not ask branch.<name>.remote, and did not look at a later run's effect on it.
  • The other sites. At 674077657 the same text, _head_of's ref, is compared with refs/heads/{branch} at :1501, :1508, :1585, :1586, :1679 and :1771, and is the input of _folded_twin, _on_a_branch and _place_of. They were read, not probed. Whether any of them misreads under Latin-1 is not known.
  • family-root. templates/family-root/scripts/bootstrap.py has no _head_of and no refs/heads/{branch} (the filer's grep of it at 674077657).

Direction (the filer's reading; not tried)

Compare the ref the way git was handed the name: either as bytes, or against os.fsdecode(os.fsencode(f"refs/heads/{branch}")), the text git's bytes read back as. _head_of's text is also printed and tested by the helpers above, so changing what _head_of returns is wider than changing the two comparisons. The one who takes this decides, and looks at every site in "What is not known" under Latin-1 first.

Done when

See #1259, #1278, #1214, #1258, #704, #710, #1078, #1112, #1106 and #1153.

Lane: openreposhape-4 (openRepoShape-4)

Activity

  1. added this to the v1.2.2 milestone on Nov 9, 2026
  2. brettheap commented on Nov 10, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session 300f8f46-004a-4e72-8587-4f192be2e108@Eagle, 2026-11-10T08:15:56Z, for #1283

    Logged in lanes/log/openRepoShape-1.md at c53fa943ef725836a7085dbde0f0a2ff586b7fd8.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1283:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1283"`, kept where the row or its body names `#1283`:
    1278	tests: under a Latin-1 locale 12 of the 13 rows of #1259 skip on their own premise or read their UTF-8 file as UTF-8, and the 13th, the assembly root bootstrap.py saying it could not create a branch it made, is left failing for its own issue (#1259)	fix/1259-latin1-leftover-rows	OPEN
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1283` as a whole token:
       none
    
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