Repository navigation
Conversation
Ls::print unwrapped file_info.metadata(), so a file removed between the directory read and -ls (or an ENAMETOOLONG/EACCES failure) aborted the whole traversal with a panic, skipping remaining entries and pending -exec batches. Handle the error like GNU find: print one diagnostic, set exit code 1, and continue. Add a regression test using -exec rm before -ls. Fixes uutils#1044
Oniguruma's grep syntax is line-oriented by default, so with -regextype grep, '.' and negated brackets never match a newline in a path. GNU's grep type does. Enable REGEX_OPTION_MULTILINE (dot matches newline) and REGEX_OPTION_NEGATE_SINGLELINE (negated brackets match newline) for the Grep type in both find -regex and locate --regex. Adds an integration test with a filename containing a newline. Fixes uutils#1046
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1053 +/- ##
==========================================
+ Coverage 92.29% 92.31% +0.01%
==========================================
Files 38 38
Lines 8714 8727 +13
Branches 429 432 +3
==========================================
+ Hits 8043 8056 +13
+ Misses 532 531 -1
- Partials 139 140 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Closing this PR — it combines two unrelated changes: (1) the ls.rs stat-failure fix which is already submitted cleanly as #1052, and (2) a grep regex newline change that doesn't have a clean upstream solution (onig grep syntax is line-oriented by design). Splitting into #1052 for the ls.rs fix. Sorry for the noise. |
Merging this PR will not alter performance1 warning
Comparing |
|
the ls.rs part is #1052, please send the grep regex fix alone, with tests for |
| // clear SINGLELINE (so negated brackets also match newline). | ||
| if regex_type == RegexType::Grep { | ||
| options.insert(RegexOptions::REGEX_OPTION_MULTILINE); | ||
| options.insert(RegexOptions::REGEX_OPTION_NEGATE_SINGLELINE); |
There was a problem hiding this comment.
are you sure NEGATE_SINGLELINE makes [^...] match newline?
i think it only changes $, please add a test with [^/]* on the newline file
| // SINGLELINE so negated brackets match newline too. | ||
| if ty == RegexType::Grep { | ||
| options.insert(RegexOptions::REGEX_OPTION_MULTILINE); | ||
| options.insert(RegexOptions::REGEX_OPTION_NEGATE_SINGLELINE); |
There was a problem hiding this comment.
please add a locate test too
almost the same code as in regex.rs, could be shared, no?
Fixes #1046.
Oniguruma's grep syntax is line-oriented by default, so with -regextype grep, '.' and negated brackets never match a newline in a path. GNU's grep type does.
Enables REGEX_OPTION_MULTILINE (dot matches newline) and REGEX_OPTION_NEGATE_SINGLELINE (negated brackets match newline) for the Grep type in both find -regex and locate --regex. Adds an integration test with a newline-containing filename.
Note: cargo is unavailable locally, so build/tests could not be run here.