Hashrat icon indicating copy to clipboard operation
Hashrat copied to clipboard

feature request: Don't update xattrs for unmodified files

Open eatnumber1 opened this issue 2 years ago • 6 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.

eatnumber1 avatar Aug 07 '23 03:08 eatnumber1

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.

ColumPaget avatar Dec 20 '23 11:12 ColumPaget

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?

ColumPaget avatar Jun 20 '24 09:06 ColumPaget

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

eatnumber1 avatar Jun 21 '24 06:06 eatnumber1

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

ColumPaget avatar Jun 25 '24 08:06 ColumPaget

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.

ColumPaget avatar Jul 18 '24 12:07 ColumPaget