Skip to content

shape-doctor.py: a holder's .gitmodules is split at the first space and at every Unicode line break, and read through a regexp a UTF-8 locale cannot match, so a section name holding a space or a byte that is not UTF-8, or a url holding NEL or U+2028, gives the doctor another mount url than git and make siblings use #668

Closed

Description

@brettheap

Goal: the doctor reads a holder's .gitmodules as git and make siblings read it, whatever a section name or a url holds, under any locale.

Filed by lane openRepoShape-3 on Brett Heap's word of 2026-10-16T12:24:41Z ("give #460 to lane 3").

What happens (measured on main d4a7fab9, git 2.43.0):

  • A section name holding a space (L22). The section is [submodule "members/My IRRS"], with path = members/IRRS and a url.
    • git lists submodule.members/My IRRS.path members/IRRS. submodule_config splits each line at the FIRST space and returns {'': {'members/My': 'IRRS.url <url>'}}.
    • So mounted_from falls back to https://github.com/InkRouter/IRRS.git.
    • On a holder from the suite's holder fixture, with a real clone of the member's remote beside it, the doctor gives working_clone: null and calls the clone a stranger (other_origin = the remote).
    • siblings.verify_sibling on the same directory gives True, and siblings.submodule_urls reads the section correctly.
    • The verdict stays COMPLIANT, exit 0. But the two tools disagree about one directory, which is what shape-doctor.py: the members row calls a beside-the-holder repository the working clone on its project id alone, where the family's own verifier also requires the origin #146 exists to prevent.
  • A url holding a Unicode line break (L23). str.splitlines() splits at \v, \f, \x1c-\x1e, \x85, U+2028 and U+2029, as well as at \n and \r.
  • A section name that is not UTF-8 (L25). The section is [submodule "members/caf\xe9"].
    • Under LC_ALL=C.UTF-8, git config --get-regexp '^submodule\..*\.(path|url)$' exits 1, with or without -z. Under LC_ALL=C it exits 0.
    • Only the .* that has to match the invalid byte fails. '^submodule\.' and '\.url$' both exit 0, and git's exact-key read (git config --get 'submodule.members/caf\xe9.url', which is how git submodule reads it) returns the url.
    • So under a UTF-8 locale, submodule_config returns {}, mounted_from falls back to repository:, and gitmodules_entry returns (None, None).
    • siblings.submodule_urls (--list, no regexp) reads the url.
    • Read from the code, not run end to end: given (None, None), submodule_url says git finds no url, url_less_members (:7270-7286) calls that member url-less, and checkout_reach (:4634-4636) answers no-url for a mount that needs a checkout, where git would update it.

Where it is (main d4a7fab9), in shape-doctor.py:

The change:

Tests:

  • The corpus, in tests/test_doctor_gitmodules_not_utf8.py, with the holder and member_beside fixtures it already uses:
    • a section name holding a space, a dot, a quote and an =;
    • a url holding each of \x0b, \x0c, \x1c, \x1d, \x1e, \x85, U+2028 and U+2029;
    • a section name in Latin-1, under LC_ALL=C.UTF-8 and under LC_ALL=C (skipped where the locale is absent).
  • For each case:
    • mounted_from equals git's own git config --get reading of that section's url;
    • submodule_config has no '' entry;
    • a clone of that url beside the holder is the working clone;
    • gitmodules_entry gives the same url.
  • section_url: extend tests/test_doctor_legs_members_next.py::test_section_url_reads_gits_listing_and_the_last_value_wins (:2005) with a --list listing that has other sections in it.
  • Parity: the same corpus, read through the doctor's reader and through the holder's siblings.submodule_urls, gives the same {path: url}.

From #460, #460 (comment) (L22, L23, L25)
From #461, #461 (comment) (R432 N1)

🤖 Generated with Claude Code

Activity

  1. added this to the v1.1.0 milestone on Oct 16, 2026
  2. brettheap commented on Oct 16, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-3, session b30e8b49-f249-4668-adb1-1dbfa93c09e1@Eagle, 2026-10-16T12:55:52Z, for #668

    Logged in lanes/log/openRepoShape-3.md at 87bf264669f3e830c1ff6042983d3eb7f4c71404.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#668:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#668"`, kept where the row or its body names `#668`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `668` 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