Repository navigation
Keep a dangling link at cp -n's destination; count lines under grep -cU - #522
Merged
Merged
Conversation
cp -n asked backend.exists whether the destination was taken. exists follows links, so a dangling symlink at the destination read as absent and cp wrote through it, creating the link's target. A single file and a file inside cp -rn both did it. mv -n and cp -n on a link source already used lstat. Both sites now do too. grep -c printed match_count, the number of match records. Under -U a record can span lines, so a 3-line match printed 1 and `grep -cU '\s'` on 34 lines printed 1. RenderResult now carries matched_lines, the lines the records cover (newlines in the trimmed text, plus one), and -c prints that, for one file, stdin, and several files. match_count still drives --max-count and the exit status, so -m counts records. The -U tests from the previous change had pinned the old count; they now expect the line count. Each fix has tests that failed before it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d match on one line Cases from the kaibo review of the previous commit; each passes. The directory-link test reads back through the link path because MemoryFs does not resolve a link in the middle of a path. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
cp -n asked backend.exists whether the destination was taken. exists follows links, so a dangling symlink at the destination read as absent and cp wrote through it, creating the link's target. A single file and a file inside cp -rn both did it. mv -n and cp -n on a link source already used lstat. Both sites now do too.
grep -c printed match_count, the number of match records. Under -U a record can span lines, so a 3-line match printed 1 and
grep -cU '\s'on 34 lines printed 1. RenderResult now carries matched_lines, the lines the records cover (newlines in the trimmed text, plus one), and -c prints that, for one file, stdin, and several files. match_count still drives --max-count and the exit status, so -m counts records. The -U tests from #517 had pinned the old count; they now expect the line count.Each fix has tests that failed before it. Both come from the fix backlog recorded after the 0.18 reviews; this is the data-safety item and the miscount in a feature #517 just made work on every path. The CHANGELOG hunk will conflict with #521 until that merges.
🤖 Generated with Claude Code