fix(ls): fall back to raw output when ls binary is eza/exa/lsd (#1321)#1454
Open
pszymkowiak wants to merge 10 commits intodevelopfrom
Open
fix(ls): fall back to raw output when ls binary is eza/exa/lsd (#1321)#1454pszymkowiak wants to merge 10 commits intodevelopfrom
pszymkowiak wants to merge 10 commits intodevelopfrom
Conversation
Next Release
…--components--rtk chore(master): release 0.37.0
fix(docs): user facing docs
…--components--rtk chore(master): release 0.37.1
Next Release
…--components--rtk chore(master): release 0.37.2
|
|
When the `ls` binary on PATH is a modern replacement (eza, exa, lsd), its day-first date format (22 Apr 14:30) doesn't match the POSIX regex anchor, causing every line to fail silently and returning "(empty)" for non-empty directories. Track `any_content_line` and `parse_hit` in `compact_ls`. When output lines were present but none parsed successfully, return a sentinel (both fields empty) so the caller falls back to raw output with a warning instead of "(empty)". Truly empty directories and noise-filtered results are unaffected.
f28c448 to
04e0db6
Compare
|
I can reproduce this as well. In my shell, Examples that fail for me:
Examples that work:
This looks consistent with the bug fixed in this PR. |
|
Additional data point from my side: Even after removing which ls
# /bin/ls
rtk ls -1A
# (empty)
rtk /bin/ls -1A
# <lists files correctly> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rtk lsreturned(empty)for non-empty directories when thelsbinary on PATH was eza, exa, or lsd22 Apr 14:30) vs POSIX month-first (Apr 22 14:30) — the regex anchor never matched, every line was silently droppedany_content_line+parse_hitincompact_ls; return a sentinel when output was present but nothing parsed, triggering a raw passthrough with a warningBehaviour change
lson PATH(empty)❌/bin/ls(empty)✅No token savings on eza output (passthrough). A follow-up PR could add an eza-aware parser.
Test plan
cargo +nightly test cmds::system::ls)test_compact_eza_format_returns_sentineladdedPATH=/tmp/eza-test-path:$PATH rtk ls src/(eza symlinked asls)(empty)cargo +nightly fmtandcargo +nightly clippycleanFixes #1321
🤖 Generated with Claude Code