ColumPaget/Hashrat

feature request: Don't update xattrs for unmodified files

eatnumber1 opened this issue · 5 comments

I'd like to use hashrat on a cron job to update a very large directory tree of rarely changing files.

When running

strace hashrat -sha512 -r d -xattr -cache

I see that hashrat updates the xattr even on unmodified files (e.g. the mtime in the xattr is more than 10s newer than the mtime of the file). This means that when scanning large directory trees of unmodified files, hashrat will still modify the xattr of every one of those files.

Hi eatnumber1, I'll make some time to look into this over the Xmas period. I think there was some kindof idea with hashrat that it would use xattr to mark files with a 'last considered time', but I'm not sure as xattr isn't one of the features I commonly use these days. I think hashrat could do with a bit of a wash-and-brushup anyways, it's been a while since I've had cause to go into the code.

Hi eatnumber1. I've finally got around to taking a look at hashrat. With this request, is the aim to save time by not updating unmodified files, or is it just to not touch the filetimes? I'm guessing it's the latter because we'd have to hash the file anyways in order to know for sure that it's not modified?

It's the latter. I don't want my backup software trying to back them up unless they've changed.

Okay, I'll try and get that added for the next release.

New release has the feature. I went with your example command-line, so using '-cache' prevents unchanged files from being updated.

Sorry it took so long. It's been a busy year.