-
Notifications
You must be signed in to change notification settings - Fork 22
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
Updating after corrupt file detected #26
Comments
I had the same question of how cshatag would behave after running into the same corrupt file. It's current logic would say that the file is okay, because the corrupt file didn't have any change, but of course it goes against the intuition that that file is still corrupt. Unfortunately, I don't think this is a straight forward problem to solve. In the mean time, I think we need to keep logs of files that cshatag report as corrupted. Right now ... when cshatag says "test ok", it just means it didn't detect any new change that could corrupt for file since the last time cshatag runs a check, but it DOES NOT mean the file is actually okay and not corrupted. Therefore, without keeping detailed logs of past corruption reports, the message "test ok" doesn't mean much. |
Right now ... when cshatag says "test ok", it just means it didn't detect
any new change that could corrupt for file since the last time cshatag runs
a check, but it DOES NOT mean the file is actually okay and not corrupted.
Therefore, without keeping detailed logs of past corruption reports, the
message "test ok" doesn't mean much.
Maybe a command line modifier could be a good approach to fix this issue?
Like separate update from crc check?
… |
I've set up a script to save cshatag outputs to log files that I can reference, and check for occurrences of corruption in the past. |
Hi, I have a possible solution for this. Patch file attached. 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). |
Dr. Nick Young highlighted a valid concern, which I also encountered. As a result, I developed a bash script for managing file hashing and verification that doesn't rely on extended file attributes. It's available in the "lunacopy" repository. I trust it may be of value to those still seeking such a solution. |
how can be applied your patch? |
Yes, the patch Dr. Nick Young posted is in the standard format produced by the Here's a step-by-step guide on how you can apply this patch to a local copy of the repository:
Please note:
The format of the patch is quite standard. Lines that are prepended with a The patch file can also be opened as a text file by Notepad or any text editor and you can see what the changes are. |
@artem-r-d thank You for the help :) |
There is one problem with not updating the checksum: You will not notice when the file gets corrupted again (unless you compare the checksum). But making the behavoir configurable would be a good thing. Related: #9 |
@rfjakob Thanks for the reply.
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
Case 2 - fixing the corrupt file
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. |
"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)
"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.
Is there a PR for the @kapitainsky commit kapitainsky@61204c6? It seems to fully resolve this issue. Thanks! |
Here you are |
"I have added one argument/option '-fix' 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: #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.
Merged. I called the new flag |
Thank you @rfjakob @drnickyoung @kapitainsky @franalta et al! |
Hi,
Firstly excellent tool. I have used a few of these/similar tools, the last one saving to a file per directory but I wanted something that moved with the files. Anyway I know this is me not understanding, so what I have done:
I get the result as I would expect:
And as expected get the output:
And as expected it is detected.
I know this is the expected result according to the 'run_tests.sh' script you have. However I am failing to see why. If a file is corrupt then surely the attribute should not get updated, wouldn't you want it to keep showing as corrupt?
The text was updated successfully, but these errors were encountered: