Repository navigation
fix(find): honor -print0, support negated -type, and fail on dangling -not - #1953
Merged
chaliy merged 1 commit intoJun 5, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens find builtin semantics in crates/bashkit/src/builtins/ls/find.rs to avoid “parsed-but-ignored” behavior by honoring -print0, supporting negation for -type via -not/!, and failing closed on a dangling -not. It also adds integration coverage to prevent regressions.
Changes:
- Added
print0andnegate_typetoFindOptions, updated argument parsing, and added an error for trailing-not. - Updated recursive traversal/output to emit NUL delimiters when
-print0is set and to applynegate_typeduring-typeevaluation. - Added integration tests for
-print0, negated-type, and dangling-not.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/bashkit/src/builtins/ls/find.rs | Implements -print0, -not/! handling for -type, and fail-closed parsing for dangling -not. |
| crates/bashkit/tests/integration/find_multi_path_tests.rs | Adds regression tests for NUL-delimited output, negated -type, and dangling -not error behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+115
to
+121
| "f" | "d" | "l" => { | ||
| opts.type_filter = Some(t.chars().next().unwrap()); | ||
| if negate_next { | ||
| opts.negate_type = true; | ||
| negate_next = false; | ||
| } | ||
| } |
Comment on lines
+166
to
+168
| "-print0" => { | ||
| opts.print0 = true; | ||
| } |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 3300625 | Commit Preview URL | Jun 05 2026, 08:18 PM |
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.
Motivation
-print0,-not/!and negated-typewere parsed but ignored, causing scripts relying on exactfindsemantics to get incorrect results.findbehavior is predictable for callers that depend on NUL-delimited output, negation, and error-on-missing-predicate semantics.Description
print0andnegate_typetoFindOptionsand updatedparse_find_argsto set these when-print0,-not/!and-typewith preceding negation are used, and to return an error on a dangling-notpredicate (missing operand).find_recursiveto honoropts.print0when emitting paths and to applyopts.negate_typewhen evaluating-typepredicates.collect_find_plan_dataconstructs a temporaryFindOptionspreserving negation flags and defaultprint0=falsefor planning.crates/bashkit/tests/integration/find_multi_path_tests.rsfor-print0, negated-type, and a dangling-notcase.Testing
cargo fmt --checkand it passed.cargo test -p bashkit --test integration find_ -- --nocaptureand the targeted integration tests passed (15 passed, 0 failed).cargo clippy -p bashkit --test integration -- -D warningsand it completed without warnings.Codex Task