Skip to content

Revise file rotation to prevent overwriting existing files#57

Open
cliffmccarthy wants to merge 1 commit intokmatheussen:masterfrom
cliffmccarthy:rotation-no-overwrite
Open

Revise file rotation to prevent overwriting existing files#57
cliffmccarthy wants to merge 1 commit intokmatheussen:masterfrom
cliffmccarthy:rotation-no-overwrite

Conversation

@cliffmccarthy
Copy link

  • 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.
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.

File rotation can overwrite existing files

1 participant