Open chrysn opened 5 years ago
Thanks for the bug report. I will fix it next time I give this some time.
I have tried to reproduce this bug with no success. If I try to open read only regionfiles a PermissionError exception is raised. Could you please provide some information about your configuration/system? I have tried this in windows, tomorrow I can test this in linux.
Ok, new information.
Regionfixer always open region files in "r+b" mode, that means read and write binary mode. When a file can't be opened in this way it just add the "Unreadable" status to it and it's considered a bad regionfile. This is how the NBT library works right now.
In the branch new2to3 I have added a new status for region files that differentiates between any IOError (for example file system problems) and PermissionError (file cannot be opened in write mode). Also, after this is finished it will be added some description in the wiki.
It's true that that it would be better to open region files in write mode only when needed, but that will be for the future.
I'm going to leave this open, maybe I'm able to code that in some time.
When run on MCR files of corrupted chunks that are read-only (as typical of backup files), the scanner silently reports "no problems". It should either report a write error if it is actually necessary to open them write-only, or only open them for writing when necessary.
The current situation causes very hard-to-debug situations when scanning through backups none of which appear to be corrupt, even though any restored data set is shown as corrupt.