Skip to content

[family] Env-inherited POSIX paths re-rendered to D:/ drive form break scripts that splice $HOME/$DIR into sed s:...:...: (nvm install.sh writes 'export NVM_DIR=""', webi bootstrap dies) #329

Closed

Description

@caomengxuan666

Found by ecosweep3 lane (installer family; carrier release build of 6106961). Consolidates a recurring real-world breaker; individual symptoms seen 3x this lane.

Mechanism

An env var exported in POSIX form (e.g. HOME=/d/..., or a script's own path) is imported/re-rendered by rubash in Windows drive form (D:/...). A drive-letter colon then collides with scripts that interpolate the path into a sed expression using : as the delimiter (a very common idiom because paths contain /):

PROFILE_INSTALL_DIR="$(nvm_install_dir | command sed "s:^$HOME:$HOME:")"   # nvm install.sh:458
echo "${my_abs}" | sed "s:^${my_rel}:~:"                                    # webi bootstrap:138

sed reports unknown option to 's' and the pipeline yields EMPTY, so downstream strings are built from an empty variable.

Reproducers (artifacts under target/issue-suites/results/ecosweep3/inst/)

  1. nvm install.sh (NVM_DIR sandboxed, local mirror clone): GNU writes export NVM_DIR="/mnt/d/…/nvm" into the profile and prints it in the instructions; rubash writes/prints export NVM_DIR="" + one extra stderr line /usr/bin/sed: -e expression #1, char 98: unknown option to 's' (gnu/nvm-install.out vs rub/nvm-install.out lines 11/16).
  2. webi bootstrap (_webi/curl-pipe-bootstrap.tpl.sh): GNU completes the whole bootstrap (34 lines, installs ~/.local/bin/webi, rc=0); rubash stops after the welcome block (rc=1) with sed: char 101: unknown option to 's' at the template's line-138 shape.
  3. (configure lane corollary: autoconf's unquoted $SED=/c/Program Files/Git/usr/bin/sed breaks for the SPACE half of the same class — that one is environment, not rubash.)

GNU behavior

bash keeps inherited POSIX paths verbatim (/mnt/d/...), and its own $HOME/$0 are POSIX-form, so the s:...:...: idiom never sees a colon-carrying path.

Suggested direction (engine decision, not prescribed)

Keep POSIX form for shell-visible values of inherited path-like env vars (rendering to drive form only at exec/CreateProcess boundaries), or at minimum exempt values containing / from the colon form. Related history: #175 (PATH startup form, fixed), #224 ($0 D:/-form vs $PWD /d/), ecosweep2 pitfall note (pwd-in-comsub D:/ form).

Activity

  1. added
    bug
    platform:windows
    on Sep 29, 2026
  2. added a commit that references this issue on Sep 29, 2026
  3. caomengxuan666 commented on Sep 29, 2026

    @caomengxuan666
    MemberAuthor

    Captain decision pending: lane delivered a four-source decomposition (docs/issue329-path-form-policy-analysis.md). Source (a) is parent-layer conversion by the session shell — any Windows child sees D:/ forms regardless of rubash; (b) is our own inconsistent self-produced values. Recommendation A+C: unify OUR OWN produced paths to POSIX form + file the parent-layer export-boundary conversion upstream with the session-shell project; explicitly NOT re-rendering inherited drive-letter values (violates GNU byte-faithful import, needs path heuristics whose false positives are silent data corruption). Deciding.

  4. caomengxuan666 commented on Sep 29, 2026

    @caomengxuan666
    MemberAuthor

    CAPTAIN DECISION: adopt A + C, reject B.

    B (re-rendering inherited drive-letter values) is rejected on principle: it violates GNU byte-faithful import semantics, requires path heuristics whose false positives are silent data corruption, and needs a re-conversion invariant across every exec site. The lane measured that inherited POSIX values already arrive as D:/ forms to ANY Windows child when the parent session shell exports them - that is the parent layer converting, not rubash.

    A (self-produced paths unify to POSIX form) is approved as a follow-up work item: $PWD vs $(pwd) inconsistency, TMPDIR default backslash form, full-path $0 - each site has a clear owner and no GNU divergence. Filed for the next fix batch.

    C (upstream filing) approved: the parent-session-shell export boundary conversion is the actual corruptor for the nvm/webi sed-colon family. Filing now; closing this issue with the decomposition report on record.

  5. added a commit that references this issue on Oct 12, 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

    bugplatform:windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions