-
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
Reduce time stamp precision #12
Comments
Hello. On an NTFS file systems the mtime resolution is 100ns. If I copy a file from ext4 to NTFS file system using NTFS-3G, the last two digits of the file modification timestamp become 0. Subsequent use of For example:
This doesn't seem to happen between other filesystems with different mtime granularity (I tested ext2, ext3 and ext4 and For my own use I wrote some code so that I think it is worth keeping the full width of the time stamp as a default. The simplest solution would be to have a different type of
This only needs one extra 'if' condition in the code. A more complex solution would be command-line flags specifying an acceptable time discrepancy such as
I would be happy to submit pull requests for either if @rfjakob is interested. |
@es80 I was also thinking of adding an option at first. I like your But then I realized: what happens when you do have some bit corruption during your cross-filesystem transfer, and forget to use that Take the opposite case: we modify cshatag to ignore up to 2s time differences. Now what happens when there is bit corruption during cross-filesystem copy? We catch it, yeah! Now what if there is a legitimate file change within 2s of the original cshatagging ? We get a false positive. The user may get a scare, but no harm done. So for me, while the option was a good idea, it needs to be implemented as the default behavior. What do you think @es80 and @rfjakob ? |
Yes, that's a good point. I wrote some code for a My main preference would be to be able to differentiate those cases with different status outputs for example, or have options for how they are processed. But as for the default behaviour, I really don't mind. I suppose the false positives you describe would be very unlikely. (I actually tried to cook up a false positive and found even with nanosecond precision you can do
or occasionally
then on the next check |
I like the idea of reporting it with a distinct event type. This case is now reported as |
The really nice thing about
cshatag
, compared to other tags file solutions likechkbit
, is that the tag follows the file along when the file is moved or copied, as long as the destination filesystem supports extended attributes.But this unfortunately breaks when the time resolution of the target filesystem is less that the original filesystem. This would prevent detecting bit corruption that happened during move or copy operations.
For example, using the Go rewrite, and with:
/tmp
on my root filesystem (APFS)/Volumes/Organizer
from my NAS, mounted through SMB (SMB_3.02)The second
cshatag
call, on the SMB share, considers the tag outdated. If corruption had happened during the move operation,cshatag
would have missed it.Suggestion: if I remember well, FAT was probably the lowest denominator, with 2 seconds resolution timestamps. So to ensure maximum compatibility,
cshatag
should consider the file unchanged if the file timestamp is within +/- 2 seconds of the tag timestamp.So, to sum it bug-report style:
Current behavior
Expected behavior
Do you think this makes sense, and this is possible to add to the Go rewrite?
The text was updated successfully, but these errors were encountered: