Repository navigation
fix(rewrite): pass ls -O / -@ / -e through unchanged (#1627) - #1640
Closed
officialasishkumar wants to merge 1 commit into
Closed
officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
The rtk ls filter compresses listings to a "name size" form and strips extra columns. macOS-only ls flags -O (BSD file flags), -@ (extended attributes), and -e (ACL entries) exist precisely to surface those metadata columns; rewriting them silently dropped the data the user was asking for and broke real diagnostic workflows (the reporter's repro: chasing a com.apple.provenance xattr with ls -lO returned just `name size`). Skip the rewrite whenever any -O / -@ / -e short-flag character appears in argv (including clusters like -lO, -lOe, -l@e). Plain ls / -l / -la are unaffected. Closes rtk-ai#1627
Contributor
|
This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet. |
Contributor
|
Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you! |
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
The rtk `ls` filter compresses listings to a `name size` form and strips extra columns. macOS-only `ls` flags exist precisely to surface those metadata columns:
Rewriting those invocations silently drops the data the user is asking for and breaks real diagnostic workflows. The reporter's example: chasing a `com.apple.provenance` xattr blocking writes — `ls -lO` returned just `name size`, hiding the `@` indicator and BSD-flags column entirely.
This change skips the rewrite whenever any `O`, `@`, or `e` short-flag character appears in argv (including clusters like `-lO`, `-lOe`, `-l@e`, or as separate tokens `-O -@ -e`). Plain `ls` / `ls -l` / `ls -la` are unaffected — those are the cases the listing-compression filter was built for.
Behavior
Before:
```
$ rtk rewrite 'ls -lO some/dir'
rtk ls -lO some/dir # rewritten — filter strips the -O column
```
After:
```
$ rtk rewrite 'ls -lO some/dir'
$ echo $?
1 # no rewrite, hook lets the original ls run
$ rtk rewrite 'ls -la some/dir'
rtk ls -la some/dir # plain listing still compressed (unchanged)
```
Notes
Test plan
Closes #1627