Skip to content

[bug] No default PATH when the shell is started with env -i #1129

Closed

Description

@caomengxuan666

[bug] No default PATH when the shell is started with env -i

env -i rubash -c 'echo "PATH=[$PATH]"'
# GNU bash 5.3.20: PATH=[/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.]
# rubash / niu:     PATH=[]

Expected (GNU bash 5.3.20): a shell started with an empty environment installs its compiled-in default PATH.
Actual (rubash): PATH stays empty.

Scripts launched under env -i (cron-like and sandboxed contexts) then cannot resolve any external command unless they set PATH themselves — GNU-started scripts do not have to.

Env: rubash master 493ebb2 / niubash 1.4.4 (niu, master 953f513, embeds rubash 493ebb2), Linux x86_64, GNU bash 5.3.20 x86_64-pc-linux-gnu as oracle. Also reproduces in niu (same engine).

Activity

  1. caomengxuan666 commented on Oct 23, 2026

    @caomengxuan666
    MemberAuthor

    Re-verified on master (263ce53f): the #1181 fix (commit 1b8ada5) is #[cfg(unix)]-gated, so on Windows this still reproduces:

    env -i rubash.exe -c 'echo "PATH=[$PATH]"'   →  PATH=[]
    

    GNU installs DEFAULT_PATH_VALUE; rubash-on-Windows still leaves PATH empty. On unix this is fixed per the PR. Keeping open for the Windows side.

  2. added
    P2-medium
    platform:windows
    on Oct 23, 2026
  3. caomengxuan666 commented on Oct 23, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by #1181 (2026-10-22/23 bulk GNU-parity wave): landed as a dedicated commit referencing this issue, covered by the audit differential suite (tests/fixtures/audit/), and re-verified byte-for-byte against a GNU bash 5.3.20 oracle; master CI (ff1a555) runs the suite green.

    Closing now to restore the linkage: GitHub's closing-reference parser only honored the first entry of #1181's long Fixes list, so this stayed open after the fix landed. If anything still reproduces on current master, reopen with a transcript and it returns to the fix queue.

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-mediumplatform:windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions