Skip to content

compat: fix remaining ls and pwd harness cases - #750

Merged
ewhauser merged 3 commits into
mainfrom
ewhauser/ls-gnu-harness-followups
Mar 27, 2026
Merged

ewhauser merged 3 commits into
mainfrom
ewhauser/ls-gnu-harness-followups

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

  • finish the remaining GNU ls/dir harness follow-ups, including block-size parsing, color fallback handling, width-sensitive ANSI wrapping, and the targeted acl.sh skip
  • fix GNU pwd compat by preserving trusted logical cwd state for external commands and supplying compat-mode physical cwd fallbacks
  • add regressions for the external pwd compat cases and update the GNU wrapper to export the trusted physical cwd

Verification

  • 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.sh remains intentionally skipped because ACL + indicators are still unsupported.\n- tests/pwd/pwd-long.sh remains a harness skip because no usable Perl was found in the compat environment.

@ewhauser
ewhauser force-pushed the ewhauser/ls-gnu-harness-followups branch from 42b3e66 to 3b767f8 Compare March 27, 2026 02:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/builtins/ls.go Resolved
@ewhauser
ewhauser merged commit 2d0ed30 into main Mar 27, 2026
15 checks passed
@ewhauser
ewhauser deleted the ewhauser/ls-gnu-harness-followups branch March 27, 2026 03:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/builtins/pwd.go
Comment on lines +91 to +94
if inv != nil && inv.Env != nil {
if compatPhysical := strings.TrimSpace(inv.Env["GBASH_COMPAT_PHYSICAL_PWD"]); path.IsAbs(compatPhysical) {
return compatPhysical, nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread internal/builtins/ls.go
Comment on lines +1892 to +1894
if lsColorCodeIsResetOnly(envCode) {
continue
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant