RJVB / afsctool

This is a version of "brkirch"'s afsctool utility that allows end-users to leverage HFS+ compression.
https://brkirch.wordpress.com/afsctool
GNU General Public License v3.0
187 stars 18 forks source link

Freeze workaround #53

Closed dm0123 closed 2 years ago

dm0123 commented 2 years ago

Fixes #48 This is a workaround I have come up with for the freezing issue while working for DiskZIP www.diskzip.com. I see no point in blocking 'open' for this code. I've also fixed one double free corruption crash. It seems the code was copypasted here but there is 'continue' instead of 'return 0' which causes double free corruption.

RJVB commented 2 years ago

Thanks! Indeed, I see no point in doing a blocking open() of an existing file, not if that can lead to indefinite hangs on files that might never be released.

It seems the code was copypasted here but there is 'continue' instead of 'return 0' which causes double free corruption.

It probably was... Good catch! Did you just happen to notice this, or did it actually trigger for you? There are a lot of failsafes in the code that were never actually necessary in all the years I've been using this...

dm0123 commented 2 years ago

As I said it was actually happening for me so I was able to debug it.

RJVB commented 2 years ago

Indeed you did mention a crash. Do you recall what error was returned by getxattr() which got you in the situation, or would you be able to reproduce this? I'm trying to figure out if this is indeed an error situation that warrants printing a message on the terminal.

dm0123 commented 2 years ago

Indeed you did mention a crash. Do you recall what error was returned by getxattr() which got you in the situation, or would you be able to reproduce this? I'm trying to figure out if this is indeed an error situation that warrants printing a message on the terminal.

I think it was EPERM because I was testing afstool system-wide (with '/' as input path). All problems were permission-related and the aim was to make the tool compress as many files as it could without hanging/crashes. So that's why you maybe haven't seen such errors.

RJVB commented 2 years ago

Thanks again!