Revise file rotation to prevent overwriting existing files#57
Open
cliffmccarthy wants to merge 1 commit intokmatheussen:masterfrom
Open
Revise file rotation to prevent overwriting existing files#57cliffmccarthy wants to merge 1 commit intokmatheussen:masterfrom
cliffmccarthy wants to merge 1 commit intokmatheussen:masterfrom
Conversation
cliffmccarthy
commented
Jan 9, 2026
- This fixes File rotation can overwrite existing files #56.
- Moved logic for computing rotated filenames into a dedicated set of functions that handle this for various command-line scenarios. If we were designing this functionality from scratch, we would do this differently, with more simplicity and consistency. This implementation maintains general compatibility with the behaviour as of version 0.9.73.
- No generated filenames will be used that overwrite an existing file. This implementation checks any generated filename before using it, and as per the documentation, the only filename that should ever be overwritten is the exact name provided on the command line, if the 'filename' argument was used.
- The --leading-zeros value is capped at 20, the number of decimal digits required to format a 64-bit integer.
- This partially addresses the double-extension problem described in Fileprefix is not computed correctly on file-rotation #20. It does not address the issue in cases where 'filename' was specified on the command line, because in that case it treats the filename as an opaque string and does not attempt to insert the rotation number inside that string.
- This fixes kmatheussen#56. - Moved logic for computing rotated filenames into a dedicated set of functions that handle this for various command-line scenarios. If we were designing this functionality from scratch, we would do this differently, with more simplicity and consistency. This implementation maintains general compatibility with the behaviour as of version 0.9.73. - No generated filenames will be used that overwrite an existing file. This implementation checks any generated filename before using it, and as per the documentation, the only filename that should ever be overwritten is the exact name provided on the command line, if the 'filename' argument was used. - The --leading-zeros value is capped at 20, the number of decimal digits required to format a 64-bit integer. - This partially addresses the double-extension problem described in kmatheussen#20. It does not address the issue in cases where 'filename' was specified on the command line, because in that case it treats the filename as an opaque string and does not attempt to insert the rotation number inside that string.
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.