Skip to content

carrier consumer inventory: 64 of 110 carrier files unguarded, 29 RISK sites (28 marker-silent), and a second copy of the fast-path carrier class in command_substitution_values.rs #729

Closed

Description

@caomengxuan666

Summary

An external static pass over origin/master (d24ee0f0) mapped the consumer side of the carrier protocol — what the registry's producers feed into.

1. The unguarded surface

  • 110 files reference the carrier family (markers:: or a raw carrier byte)
  • 54 of them contain at least one decode/guard token
  • 64 have none — carrier-referencing files with no decode and no guard

Of the 116 lines that both name a marker and perform a consumer operation, ~115 are guards or decoders. The leaks live in the marker-silent sites — which is exactly why grepping for markers:: finds none of them.

29 verified RISK sites

glob.rs 10 · parameter_decode.rs 4 · conditional/pattern.rs 4 ([[:cntrl:]]/[[:space:]] applied to U+E1xx byte-chars) · printf/escape.rs 3 · execution_misc.rs 2 · one each in command_prepare.rs, read_split.rs, lexer/quotes.rs, command_substitution_pipelines.rs, test/variable.rs.

28 of the 29 name no marker at all (only command_prepare.rs:3995 does), so they are invisible to the registry's own greps. File split: 6 of the RISK files are in the 64-file no-decode set; 4 more (printf/escape.rs, execution_misc.rs, command_prepare.rs, lexer/quotes.rs) contain a decode token but do not apply it on these paths.

2. A second full copy of the §1 class — outside #707 / #695

src/executor/command_substitution_values.rs (the $( … | cmd ) filter arms) carries its own copies of the carrier defect:

  • :122 — its own wc -c byte measure
  • :63 — tr '\n'
  • plus head / tail / uniq / grep / sort split-and-measure sites across :22 :56 :59 :84 :88 :107 :112 :135 :139 :140 :152

This is the same defect family as #707 (tr [:cntrl:]) and rubash#695 / niubash#383 (wc -c measuring the encoding) — in a different file, and named by neither issue. #710 already established that these arms are unreachable for ordinary $( … | … ) bodies, so this is either dead code to delete or a latent cache to wire up deliberately; either way it carries the class, and reviving it without a decode step would ship the same bug twice.

Adjacent partial: tr_class_chars("space") — \f is carried but \t\n\r are not.

3. FP ledger (for whoever extends the detector)

The heuristic detector used for this pass flags 107 raw / 95 unique sites: 6 confirmed, 19 genuinely same-class lines (10 mirror + 9 latent), 5 marker-aware (explicit CTLESC handling), 64 false positives (~60%) — concentrated in glob/pattern matchers (38) and Vec/option/diagnostic bookkeeping (21) plus parser internals.

Suggested direction

The 6 confirmed + 19 same-class sites are a bounded fix if done by the §3.2 boundary rule rather than by one guard per site (the lint-only route cannot catch "forgot to call the helper" — it has no textual signature). The boundary question is filed as #717.

Provenance

Static audit only, no runtime repro; artifacts under target-free scratch, cited by path:line. Worst-risk item to eyeball first: glob.rs (10 sites) and the command_substitution_values.rs copy.

Activity

  1. added
    bug
    P2-medium
    area:carrier
    area:fastpath
    family:M1
    on Oct 17, 2026
  2. added a commit that references this issue on Oct 19, 2026
  3. arookieofc commented on Oct 19, 2026

    @arookieofc
    Member

    The exp.snap CI failure on PR #821 is fixed (commit 8aae39a on fix/729-728, all lanes green).

    Root cause was in the #729 rewrite itself: flatten_pattern_to_byte_chars() dropped the PATTERN_LITERAL_BACKSLASH (0x18) arm, so the marker fell into the generic C0 arm and normalized to byte 0x18, which matches nothing. Any pattern carrying a literal backslash trips the byte-char gate, so ${red//\\[\\e/} from exp.tests exp5.sub silently stopped matching and both faces printed the input unchanged.

    Verified against the oracle first: WSL GNU bash 5.3.0 prints [0;31m\] then ], which matches the committed exp.snap bytes - the CI re-record was the regression artifact, so no snapshot update was needed. The matcher owns the invariant (case_pattern_atom_matches matches the marker against a literal backslash); the fix restores the marker to backslash-byte mapping before the generic C0 arm, plus a unit test (flattened_literal_backslash_marker_matches_backslash). Local upstream_suite_slice_snapshots passes 13/13.

    One local-only note: carrier_byte_class_regressions has one failure on machines without od on PATH (user_pua_data_roundtrips_verbatim pipes through od); it fails identically on the pristine main binary, so it is environmental, not from this branch. CI Rust tests are green.

  4. added 4 commits that reference this issue on Oct 21, 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

    P2-mediumarea:carrierarea:fastpathbugfamily:M1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions