Skip to content

Conversation

@mattsu2020
Copy link
Contributor

Refactor the is_unsafe_overwrite function to improve logic when appending to files. Previously, the check for zero-sized files was combined with input/output equality, leading to potential false negatives. Now, separate the checks: return false if inputs differ, or if output file is empty. For appending mode, allow safe overwrites if input position is at or beyond file size. This prevents data loss while permitting valid append operations.

fix cat-self test

Refactor the `is_unsafe_overwrite` function to improve logic when appending to files. Previously, the check for zero-sized files was combined with input/output equality, leading to potential false negatives. Now, separate the checks: return false if inputs differ, or if output file is empty. For appending mode, allow safe overwrites if input position is at or beyond file size. This prevents data loss while permitting valid append operations.
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/cat/cat-self is no longer failing!

@RenjiSann RenjiSann mentioned this pull request Nov 3, 2025
97 tasks
@RenjiSann
Copy link
Collaborator

Really great ! Thanks !

@RenjiSann RenjiSann merged commit e766645 into uutils:main Nov 3, 2025
121 checks passed
@mattsu2020 mattsu2020 deleted the cat_compatibility branch November 3, 2025 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants