Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --sortr path gives error "thread 'main' panicked"/"not yet implemented" #2664

Closed
1 task done
kjhaber opened this issue Nov 28, 2023 · 2 comments
Closed
1 task done
Labels
bug A bug.

Comments

@kjhaber
Copy link

kjhaber commented Nov 28, 2023

Please tick this box to confirm you have reviewed the above.

  • I have a different issue.

What version of ripgrep are you using?

ripgrep 14.0.2 (rev 6c7947b)

features:-simd-accel,+pcre2
simd(compile):+SSE2,+SSSE3,-AVX2
simd(runtime):+SSE2,+SSSE3,-AVX2

PCRE2 10.42 is available (JIT is available)

How did you install ripgrep?

Homebrew (Mac, Apple Silicon) and asdf

What operating system are you using ripgrep on?

macOS Sonoma 14.1.1

Describe your bug.

When I use the --sortr path option, rg fails with:

thread 'main' panicked at crates/core/flags/hiargs.rs:774:35:
not yet implemented
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The error doesn't happen for the non-reversed --sort path. It also doesn't happen for other options to --sort or --sortr (accessed, created, modified, none).

I'm able to reproduce the error with ripgrep 14.0.0, 14.0.1, and 14.0.2. I can't reproduce the error in ripgrep 13.0.0.

What are the steps to reproduce the behavior?

Run rg --sortr path bar.

What is the actual behavior?

When I use the --sortr path option, rg fails with:

% rg --sortr path bar
thread 'main' panicked at crates/core/flags/hiargs.rs:774:35:
not yet implemented
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Looks like it's pointing to the todo! on https://github.com/BurntSushi/ripgrep/blob/ca5e294ad6b64b03c1d2fb4d9ed8c32b73e656ae/crates/core/flags/hiargs.rs#L774C1-L774C43

The error doesn't happen for the non-reversed --sort path. It also doesn't happen for other options to --sort or --sortr (accessed, created, modified, none).

I'm able to reproduce the error with ripgrep 14.0.0, 14.0.1, and 14.0.2. I can't reproduce the error in ripgrep 13.0.0.

With --debug flag:

% rg --sortr path --debug bar
DEBUG|rg::flags::parse|crates/core/flags/parse.rs:97: no extra arguments found from configuration file
DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1093: using heuristics to determine whether to read from stdin or search ./ (is_readable_stdin=false, stdin_consumed=false, mode=Search(Standard))
DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1103: heuristic chose to search ./
DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1254: found hostname for hyperlink configuration: lacerta.local
DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:1264: hyperlink format: ""
DEBUG|rg::flags::hiargs|crates/core/flags/hiargs.rs:174: using 1 thread(s)
DEBUG|globset|crates/globset/src/lib.rs:448: glob converted to regex: Glob { glob: "**/._*", re: "(?-u)^(?:/?|.*/)\\._[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('.'), Literal('_'), ZeroOrMore]) }
DEBUG|globset|crates/globset/src/lib.rs:448: glob converted to regex: Glob { glob: "**/.DS_Store?", re: "(?-u)^(?:/?|.*/)\\.DS_Store[^/]$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('.'), Literal('D'), Literal('S'), Literal('_'), Literal('S'), Literal('t'), Literal('o'), Literal('r'), Literal('e'), Any]) }
DEBUG|globset|crates/globset/src/lib.rs:448: glob converted to regex: Glob { glob: "**/Icon?", re: "(?-u)^(?:/?|.*/)Icon[^/]$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('I'), Literal('c'), Literal('o'), Literal('n'), Any]) }
DEBUG|globset|crates/globset/src/lib.rs:448: glob converted to regex: Glob { glob: "**/.sw*", re: "(?-u)^(?:/?|.*/)\\.sw[^/]*$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true, empty_alternates: false }, tokens: Tokens([RecursivePrefix, Literal('.'), Literal('s'), Literal('w'), ZeroOrMore]) }
DEBUG|globset|crates/globset/src/lib.rs:453: built glob set; 2 literals, 20 basenames, 15 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 4 regexes
thread 'main' panicked at crates/core/flags/hiargs.rs:774:35:
not yet implemented
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

What is the expected behavior?

Ripgrep should return the matching results reverse-sorted by path.

@kjhaber
Copy link
Author

kjhaber commented Nov 29, 2023

Confirming that the fix in 14.0.3 is working for me. Thanks so much for ripgrep and the fast fix!

@BurntSushi BurntSushi added the bug A bug. label Nov 29, 2023
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 29, 2023
14.0.3 (2023-11-28)
===================
This is a patch release with a bug fix for the `--sortr` flag.

Bug fixes:

* [BUG #2664](BurntSushi/ripgrep#2664):
  Fix `--sortr=path`. I left a `todo!()` in the source. Oof.
@redblobgames
Copy link

Thank you! Confirming that the fix is working for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug.
Projects
None yet
Development

No branches or pull requests

3 participants