Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not update corrupted files hash by default #28

Closed
wants to merge 2 commits into from

Conversation

kapitainsky
Copy link
Contributor

Do not update corrupted files hashes unless new --corruptupdate flag is provided

Fixes #26

"I have added one argument/option '-corruptupdate' which when used will update the CRC of any corrupted files (i.e. the current default behaviour). Without this option the code doesn't update the attribute/CRC and subsequent runs of the code will still show the file as corrupt.

I have done it this way as in my view a corrupted file should remain flagged as corrupt until fixed (or some other actions is taken)."

Source:
rfjakob#26 (comment)



    There is one problem with not updating the checksum: You will not notice when the file gets corrupted again (unless you compare the checksum).

Yes, however if the file is already corrupt, any further corruption is irrelevant until it is fixed. The way I see this working, with the patch, is thus:

Case 1 - no action

    I run cshatag
    It detects a corrupt file.
    I do nothing at all
    I run cshatag
    The corrupt file is still flagged.

Case 2 - fixing the corrupt file

    I run cshatag
    It detects a corrupt file.
    I fix the file and then on this file only...
    I run cshatag -corruptupdate - that will update the file and should no longer flag as corrupt.
    File is fixed, no longer shows as corrupt on further cshatag runs. Others will until they are fixed.

That way any corruption will show on every run until such time as I specifically tell it to update the file, i.e. I have fixed it.
@rfjakob
Copy link
Owner

rfjakob commented Aug 23, 2024

Merged as 09534f6 , thanks!

@rfjakob rfjakob closed this Aug 23, 2024
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.

Updating after corrupt file detected
2 participants