Skip to content

openreposhape package: openRepoShape --version prints a repository holding U+202E or U+200B as typed and exits 0, and a ref holding either is refused with the value as typed, where the launcher refuses both before it prints (#866) #939

Closed

Description

@brettheap

Goal: the package's openRepoShape checks $OPENREPOSHAPE_REPO, $OPENREPOSHAPE_REF and --shape-ref for a character a terminal draws as another before --version answers and before any line, git call or clone names them, with the launcher's rule and words (#837, #866). Then no line the package prints holds either value with U+202E, U+200B or any other character of #837's list, and no git command line carries one.

Filed by lane openRepoShape-2 on Brett Heap's word ("file all", 2026-10-18T14:45:31Z).

path:line is at the v1.1.1 release commit 50178305, which holds #866 (c5d0bde3, PR #872) and #874 (33c5128b, PR #875).

  • How it was measured: bash 5.2.21, Python 3.12.3 and git 2.43.0, each run with an explicit minimal environment, a stub gh and curl first on PATH, GH_TOKEN=bogus, an empty GH_CONFIG_DIR, GIT_SSH_COMMAND=false and GIT_CONFIG_GLOBAL=/dev/null.
  • No request left the machine: a repository was a local path, or a stub git that logs its arguments and exits 128 stood first on PATH.
  • "The package" is a copy of src/openreposhape/ laid out as the wheel lays it, with no checkout beside it, as installed_copy in tests/test_openreposhape_package.py makes one.

Lines

  • --version prints the repository as typed and exits 0, for U+202E and U+200B.
    • The lines are cli.py:385, say(f"openRepoShape {stamp.version} ({repo} @ {wanted.ref})"), and, for a build with no stamp, cli.py:395, which names {repo} again.
    • print_version (cli.py:366) calls standard.clone_url(repo) (:382) and standard.target(stamp) (:383) first. clone_url's check is CONTROL_RE (standard.py:72, [\x00-\x1f\x7f-\x9f]), which holds nothing above U+009F.
    • Measured under LC_ALL=C and under LC_ALL=C.UTF-8, with OPENREPOSHAPE_REPO set to acme/r, U+202E, x:
      • the first line is openRepoShape 0.0.0 (acme/r, the bytes E2 80 AE, x @ main), and the exit is 0;
      • with U+200B the bytes are E2 80 8B and the rest is the same;
      • an unstamped build prints the value a second time, in its commit line; a stamped copy prints it once.
    • ESC, U+009B and DEL in the same place are refused with exit 2, in both locales, with no byte of the value: OPENREPOSHAPE_REPO is not a value this tool will put on a `git clone` command line: it starts with '-' or carries a control character. Set it to a URL or a path. Those are the launcher's words.
    • In a terminal, U+202E reverses how the text after it is drawn. This was not run in a terminal emulator here.
  • A ref holding U+202E or U+200B is refused with exit 2, and the refusal prints it as typed.
    • ref_fault (standard.py:198) asks the length (:207), then CONTROL_RE (:211), then the shape (:215), whose sentence (:216) quotes '{ref}'. A value with U+202E passes the control check and fails the shape, so the sentence quotes it. The docstring's "only then the SHAPE, which is safe to echo back because it has passed both" does not hold for it.
    • Measured with OPENREPOSHAPE_REF set to v1, U+202E, x: --version, --doctor ., a scaffold run and shape-doctor each exit 2 and print REFUSED: $OPENREPOSHAPE_REF is 'v1, the bytes E2 80 AE, x', which is not a branch, tag or commit ....
    • A scaffold run's --shape-ref does the same (--shape-ref is 'v1, E2 80 AE, x'). U+200B is the same with E2 80 8B.
    • ESC, U+009B and DEL are refused without the value ($OPENREPOSHAPE_REF carries a control character, ...), as the launcher's are.
  • Every package run that reaches the clone names the repository as typed, and hands git the URL with it.
    • After clone_url passes the value, prepare (standard.py:621) goes on. These lines each name repo: remote_commit's refusal (:426), the note before the clone (:505), the clone's refusal (:511, the repository and the URL), the checkout's refusals (:524, :532), verify's (:617) and Standard.describe (:375, :376), which cli.py:413, :415, :433, :469 and :562 print.
    • Measured with a stub git that logs its arguments and exits 128, and OPENREPOSHAPE_REPO set to acme/r, U+202E, x:
      • an unstamped copy's --doctor . and a scaffold run each called git once: ls-remote -- https://github.com/acme/r, E2 80 AE, x.git HEAD HEAD^{};
      • a stamped copy's --doctor . and a scaffold run each called git clone --quiet --no-checkout -- https://github.com/acme/r, E2 80 AE, x.git <cache>.
    • Measured with a local path that does not exist and U+202E in it: --doctor . on a stamped copy printed the path 4 times on stderr (the note, the refusal's repository, its URL and git's own fatal: line), and on an unstamped copy once; --doctor, a scaffold run and shape-doctor all exit 2. The other three tool commands share run_tool (cli.py:554).

What is checked today

  • clone_url (standard.py:174) refuses a clone URL that starts with - or holds a character of CONTROL_RE (:190), in the launcher's words. It runs from --version (cli.py:382) and from prepare (standard.py:637), so from --doctor, a scaffold run and the four tool commands.

  • target (standard.py:249) runs checked_ref, so ref_fault, on --shape-ref and then $OPENREPOSHAPE_REF. It runs from --version (cli.py:383) and from prepare (:635).

  • None of the 41 code points of the launcher's MISDRAWN_CHARACTERS (openRepoShape:501: U+00AD, U+061C, U+200B, U+200E to U+200F, U+2028 to U+202E, U+2060 to U+206F, U+FEFF, U+FFF9 to U+FFFB, U+1D173 to U+1D17A, U+E0001) is in CONTROL_RE. Measured: clone_url refuses 0 of 41.

  • No run reads the values beside a checkout (prepare returns first, standard.py:631 to :633; print_version returns at cli.py:373 to :380), under --preflight (cli.py:460, before prepare), --install or --help. Measured: --version beside a checkout, with each of the five characters in either variable, exits 0 and prints neither value.

  • The checks read characters, not bytes, so one value gets one answer under C and C.UTF-8: the five characters, in each variable, were run under both, and no answer differed. A lone 0x9B byte is not UTF-8: Python reads it as a surrogate, the check passes, and --version prints ? for it with exit 0, where the launcher refuses it. A ? cannot be misdrawn.

  • A trailing newline (rv872's SHOULD-1 on the launcher) cannot pass here: a path, a URL, an scp address and an owner/name each ending in a line feed are refused with exit 2 (Python keeps the newline that $(...) drops).

  • The launcher, for the same values (50178305, --version, under both locales): every one exits 2 with nothing on stdout.

    value in the variable package, repository package, ref launcher
    U+202E exit 0, printed exit 2, quoted exit 2, names U+202E
    U+200B exit 0, printed exit 2, quoted exit 2, names U+200B
    ESC exit 2 exit 2 exit 2
    U+009B exit 2 exit 2 exit 2
    DEL exit 2 exit 2 exit 2
    • The launcher's words for U+202E in the repository: OPENREPOSHAPE_REPO holds a character a terminal draws as something other than itself (U+202E): one that is invisible, is drawn as another character, ends a line or reorders the text around it. This tool will not put it on a `git clone` command line. Set it to a URL or a path.
    • And in the ref: $OPENREPOSHAPE_REF holds a character a terminal draws as something other than itself (U+202E): one that is invisible, is drawn as another character, ends a line or reorders the text around it. No branch, tag or commit this tool will pass to `git checkout` holds one.
  • Tests: tests/test_openreposhape_package.py imports 13 of the launcher's cases (LAUNCHER_CASES, :78) and none of openRepoShape: --version and two fetch refusals print $OPENREPOSHAPE_REPO and $OPENREPOSHAPE_REF with no check, so an escape or a bidi override in either reaches the terminal as typed, and a scaffold run sends its fetch with them #866's, and states neither behaviour above. It passes at 50178305: 58 passed.

Direction

  • Port the launcher's rule and words.
    • The launcher's rule is checked_repo (openRepoShape:805): misdrawn_characters over the value as typed, then the leading - and control check. Then ref_character_fault (:908): misdrawn_characters, then the control check. refuse_bad_values (:996) calls them once, the repository first, before --version (:1151) and every other run (:1261). The list is MISDRAWN_CHARACTERS (:501), and misdrawn_characters (:512) names the characters as U+XXXX, comma-separated, in code point order.
    • The package's equivalents are clone_url's guard (standard.py:190), which is checked_repo's second half, and ref_fault's control check (:211), which is ref_character_fault's second half. It has no list, no function that names the characters, and no one place: its guards stand inside clone_url and target, which already come before every line that prints a value.
    • Add the 41 code points as a table in standard.py, and a function that names them. Call it at the start of clone_url, on the repository as typed, and in ref_fault between the length check and CONTROL_RE: the launcher's order is empty, length, drawn as another, control, shape. Use the launcher's words, which are the two sentences quoted above.
    • Measured with a prototype of exactly these two edits (scratch only): every run in the matrix above exits 2 with no byte of the value on either stream, and git is called 0 times; the 58 existing package tests still pass; the prototype's table equals the launcher's list (41 and 41), and its names agree with the launcher's own misdrawn_characters on 1,280 of the code points in SHARING_ITS_BYTES.
    • Decide, and say why, whether the runs that never read the values, beside a checkout and --preflight, refuse them too. The launcher's one check refuses in every run but --help, and cli.py:4 says the package re-states the launcher: that argues for one check in main_openreposhape, after --help. Nothing is printed or sent in those runs (measured), which argues for leaving them. This direction is the narrower one, because the guards already stand before every line that names a value.
  • Refuse with exit 2, as the launcher does since openRepoShape: --version and two fetch refusals print $OPENREPOSHAPE_REPO and $OPENREPOSHAPE_REF with no check, so an escape or a bidi override in either reaches the terminal as typed, and a scaffold run sends its fetch with them #866. Refusal is exit 2 by default (standard.py:111), and --version already exits 2 for ESC. No reason found to print ascii(value) instead, as setup-project.py's refuse_value does: a refused value is never echoed.
  • The table is a copy, held equal to the launcher's by a test.
    • The package ships alone. It may not read the launcher, or scripts/repo_shape.py, at run time.
    • The launcher's own tests already do this for install.sh's copy (test_install_sh_carries_the_launchers_misdrawn_check_as_it_is, tests/test_openreposhape_command.py:884), and write the code points out again as MISDRAWN (:620).
    • The package's test reads MISDRAWN_CHARACTERS out of openRepoShape and compares it with the table. It also names each code point of SHARING_ITS_BYTES (:902) both ways.
  • Fix the words that say what ref_fault is: its docstring (standard.py:199) and the comment at :70, so that they state the character check, the order and the launcher's words.

Verify

  • tests/test_openreposhape_package.py and tests/test_openreposhape_command.py pass on Linux.
  • New cases, beside the 13 imported ones:
    • The launcher's UNPRINTABLE_VALUES (test_openreposhape_command.py:2245, 12 rows) run through cmd.detached("--version", ...) under C and C.UTF-8, as data, with assert_refused_saying (:695): exit 2, that one refusal, no part of the value in either stream. Measured with a scratch module: 24 cases. At 50178305, 8 fail (U+202E and U+200B, repository and ref, two locales) and 16 pass (the control rows). With the prototype all 24 pass.
    • test_help_answers_past_a_repository_and_ref_no_line_can_print (:2314) imported unchanged: 1 case, passes at both.
    • A run that reaches the clone (--doctor ., a stub git first on PATH) with U+202E in the repository: refused before any git call, no byte of the value on either stream. Measured by hand: 1 git call at 50178305 and 0 with the prototype.
    • One value that holds an escape and U+202E, for the repository and for the ref: the words for the drawn character come first, which pins the order.
    • A clean pair still prints openRepoShape 0.0.0 (opensoft/openRepoShape @ main) (pinned by test_version_says_an_unstamped_build_follows_main, :423), and the launcher's NOT_CONTROLS (:755) are not refused. Measured on four of them, an e-acute, U+200C, U+200D and a no-break space, under both locales: the prototype exits 0 and prints the same first line as the base.
  • Mutants, each killed (measured on the prototype, with the cases above, 68 in all):
    • clone_url without the drawn-as-another check: 5 fail, the repository's U+202E and U+200B rows under two locales and the escape-and-U+202E case.
    • ref_fault without it: 5 fail, the same for the ref.
    • ref_fault asks the control check first: 1 fails, the escape-and-U+202E case. The 24 table cases alone do not kill it.
    • clone_url asks the control check first: 1 fails, the same case, alone.
    • The table without U+200B: 4 fail.
    • The table's U+2028 to U+202E range cut at U+202D: 6 fail.

Overlaps

Parent: #459. It holds the launcher's own items, and this is the launcher's check as the package re-states it. #866, its launcher half, is on #461.

Milestone: v1.2.0. v1.1.1 is released. Each line needs a value that the person set in their own environment, and the package already refuses the control characters in the same runs. It is not a regression.

🤖 Generated with Claude Code

Activity

  1. added this to the v1.2.0 milestone on Oct 18, 2026
  2. brettheap commented on Oct 18, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-3, session b30e8b49-f249-4668-adb1-1dbfa93c09e1@Eagle, 2026-10-18T16:12:13Z, for #939

    Logged in lanes/log/openRepoShape-3.md at 559793a3705776031eff3b5ea3c05c24254c182b.

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

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