Skip to content

cd with cdable_vars does not update $PWD (and sets $OLDPWD in the Windows path domain) #392

Closed

Description

@caomengxuan666

Found during wt33 triage of #374.

Repro (script file, both shells)

target/issue-suites/results/wt33-373/cases/H04_cdable_vars_pwd.sh:

mkdir -p h04dest
shopt -s cdable_vars
dest="$PWD/h04dest"
cd dest > h04out.txt
echo "PWD-after=[$PWD]"
echo "OLDPWD-after=[$OLDPWD]"
echo "pwd-cmd=[$(pwd)]"

WSL GNU Bash 5.3.0:

PWD-after=[/tmp/wt33/h04dest]
OLDPWD-after=[/tmp/wt33]
pwd-cmd=[/tmp/wt33/h04dest]

rubash:

PWD-after=[/d/.../H04.rubdir]            <- NOT updated (still the pre-cd dir)
OLDPWD-after=[D:/repo/rubash-wt-testmaint] <- wrong value AND Windows domain
pwd-cmd=[/d/.../H04.rubdir/h04dest]        <- the cd itself worked

The cd succeeded (the pwd builtin reports the new dir) but the $PWD/$OLDPWD parameters were not maintained (and $OLDPWD received a raw D:/… form, off-domain).

Notes

  • Raw artifacts: target/issue-suites/results/wt33-373/run/H04_cdable_vars_pwd.{gnu,rub}.*.
  • Test left tracking: tests/executor_command_chaining/part_022.rs test_cdable_vars_uses_variable_as_directory (#[ignore] referencing this issue) — its expectation matches GNU, rubash diverges.

Activity

  1. added
    bug
    on Oct 2, 2026
  2. added a commit that references this issue on Oct 2, 2026
  3. caomengxuan666 commented on Oct 2, 2026

    @caomengxuan666
    MemberAuthor

    Landed as 1619535 (wt37/gapfix2): redirected cd keeps PWD/OLDPWD live and binds both redirect channels (GNU builtins/cd.def's cdable_vars path maintains the variables across the redirection boundary). issue392 regression suite 6/6; two-shell structure+rc probes byte-identical.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions