Repository navigation
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
| // than `fs::copy`, which would put the source's permission bits | ||
| // on the temporary file and undo the 0600 it was created with. | ||
| let (mut copy_file, copy_path) = tmp_dir.next_file()?; | ||
| if path_copy.is_none() { |
There was a problem hiding this comment.
the stdin and path branches are almost the same code, could be dedup, no?
| } | ||
|
|
||
| #[test] | ||
| fn test_merge_output_is_stdin() { |
There was a problem hiding this comment.
could you please also cover - ledger updates (both copies) as a case? thanks
|
Binary size comparison: |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
sort -m -o ledger - updates < ledgertruncatedledgerwhile the merge was still reading it through standard input, so most of the records were lost. The check for an input that is the output file only compared path operands, and-was looked up as a file named-.replace_output_file_in_input_filesnow also compares the file standard input is open on with the output file. If they are the same, it copies standard input from its current position into a temporary file of its own and merges that copy. It returns a list of copies, because a path operand and-may now both need one.The new test is the issue's case with 10,000 records and fails on
main. I also ran the issue's script by hand:mainkept 4,097 of 10,001 lines here, and the fix keeps all of them. Standard input that was already partly read is copied from where it stands, and- ledger updateskeeps both copies.Closes #16679
AI disclosure: written with help from Claude Code.