Repository navigation
compat: fix remaining ls and pwd harness cases - #750
Conversation
42b3e66 to
3b767f8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42b3e66ac5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72a1bf8e4b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if inv != nil && inv.Env != nil { | ||
| if compatPhysical := strings.TrimSpace(inv.Env["GBASH_COMPAT_PHYSICAL_PWD"]); path.IsAbs(compatPhysical) { | ||
| return compatPhysical, nil | ||
| } |
There was a problem hiding this comment.
Use compat physical PWD only as fallback
pwdPhysicalPath now returns GBASH_COMPAT_PHYSICAL_PWD unconditionally whenever that env var is set, before checking the process's actual current directory. In compat runs this variable is exported once at wrapper startup, so if the same gbash process later executes cd and then pwd -P, it will still print the stale startup path instead of the new physical cwd. This breaks -P semantics for directory-changing scripts/commands under compat mode; the compat value should be used only when resolving Realpath(".") fails.
Useful? React with 👍 / 👎.
| if lsColorCodeIsResetOnly(envCode) { | ||
| continue | ||
| } |
There was a problem hiding this comment.
Honor reset-only di color without default fallback
The directory-color fallback loop treats reset-only entries (di=0 / di=:) as continue, which then allows fallback to the built-in default directory color. For the di indicator this means an explicit user reset still produces colored directories, diverging from GNU behavior where di=0 suppresses directory color. This should terminate directory color resolution when the active key is explicitly reset, rather than falling back to defaults.
Useful? React with 👍 / 👎.
Summary
ls/dirharness follow-ups, including block-size parsing, color fallback handling, width-sensitive ANSI wrapping, and the targetedacl.shskippwdcompat by preserving trusted logical cwd state for external commands and supplying compat-mode physical cwd fallbackspwdcompat cases and update the GNU wrapper to export the trusted physical cwdVerification
go test ./internal/runtime -run 'Test(ExternalPwdProjectsCompatRootPaths|ExternalPwdUsesTrustedCompatPhysicalDirUnderSymlinkDeny|PwdHonorsLogicalAndPhysicalModes|InvalidVisiblePWDDoesNotOverrideSandboxWorkDir|ReplaceEnvDoesNotUseSessionBaseEnv)' -count=1\n-go test ./internal/builtins -run 'Test(Pwd|Env)' -count=1\n-go test ./cmd/gbash-gnu\n-make lint\n-GNU_UTILS='ls,vdir' GNU_KEEP_WORKDIR=1 GNU_RESULTS_DIR=.cache/gnu/results/ls-main-lsvdir-final-20260326 make gnu-test\n-GNU_UTILS='ls,vdir,dir' GNU_KEEP_WORKDIR=1 GNU_RESULTS_DIR=.cache/gnu/results/ls-vdir-dir-20260326 make gnu-test\n-GNU_UTILS='pwd' GNU_KEEP_WORKDIR=1 GNU_RESULTS_DIR=.cache/gnu/results/pwd-fix2-20260326 make gnu-test\n\n## Notes\n-tests/ls/acl.shremains intentionally skipped because ACL+indicators are still unsupported.\n-tests/pwd/pwd-long.shremains a harness skip because no usable Perl was found in the compat environment.