Repository navigation
Conversation
GNU grep's -D/--devices=ACTION (device-file handling, e.g. `-D skip`) takes a value, like -d/--directories. RTK's VALUE_FLAGS_SHORT only listed lowercase `d`, and VALUE_FLAGS_LONG had no --devices entry, so the action word was misparsed as a positional. That shifted the real pattern/path arguments out of place, and grep then errored on a nonexistent path (exit 2) instead of searching. Add `D` to VALUE_FLAGS_SHORT and `--devices` to VALUE_FLAGS_LONG so both the short and space-separated long forms consume their value correctly, matching -d's existing behavior. (--devices=skip, a single token, already worked.) Fixes rtk-ai#3881
Author
|
Closing in favor of #3681 which should fix this. |
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
GNU grep's
-D ACTION/--devices ACTION(read|skip, how to handledevice/FIFO/socket files) takes a value, exactly like
-d/--directories.RTK's
VALUE_FLAGS_SHORTrecognized lowercase-dbut not uppercase-D,and
VALUE_FLAGS_LONGhad no--devicesentry at all. As a result theaction word (
skip) was left as an ordinary positional, which shifted thereal search pattern and path out of position — the shifted "path" usually
doesn't exist, so grep exited 2 with no output instead of searching.
Fix
DtoVALUE_FLAGS_SHORTinsrc/cmds/system/search.rs, alongsideits lowercase
-dtwin.--devicestoVALUE_FLAGS_LONGso the space-separated long form(
--devices skip) also consumes its value correctly. (--devices=skip,a single token, already worked.)
Test plan
search.rscovering-D skip, inline-Dskip,--devices skip, and--devices=skip.tests/grep_faithful_format_test.rs(dash_capital_d_devices_matches_grep_n)that runs the compiled
rtkbinary against realgrep -D/--devicesanddiffs stdout + exit code, with and without
-n— the same harness shapethat would have caught this as a regression.
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspectedFixes #3881