FrodeSolheim / fs-uae

Cross-platform Amiga emulator with a slight focus on gaming, but also with solid support for productivity apps including just-in-time (JIT) compilation.
https://fs-uae.net/
GNU General Public License v2.0
469 stars 94 forks source link

Error about write protected file on reading #158

Open amigalemming opened 7 years ago

amigalemming commented 7 years ago

I observed this strange behaviour in the Amiga shell:

8.Boot:> list Work:Editors/CATALOGS/DEUTSCH/CED.CATALOG
Directory "Work:Editors/CATALOGS/DEUTSCH" on Montag 19-Jun-17 
CED.CATALOG                18672 ----rwed 29-Sep-04  22:43:24
1 file - 38 blocks used
8.Boot:> type Work:Editors/CATALOGS/DEUTSCH/CED.CATALOG
TYPE can't open CED.CATALOG
File is write protected

The file protections on the Linux side are

-r-xrw----

and there is no corresponding .uaem file.

So, yes the file is write protected, but it is not shown by list in the Amiga shell and it should not prevent me from reading the file with type.

acf commented 2 years ago

Hello @amigalemming and @FrodeSolheim,

I recently had cause to stumble upon this issue myself and do a bit of digging.

http://eab.abime.net/showthread.php?t=111688

I had an idea for a fix but I'm not sure how best to proceed in terms of contributing so I came to look at any tickets/PRs and found this ticket, so glad I'm not crazy.

The offending code (I think) is https://github.com/FrodeSolheim/fs-uae/blob/ef6166351b79812b84ec2b7bb2af5832c5f5d887/src/od-fs/fsdb_host.cpp#L555-L557 and I can see stat is used a few lines further down to get the time. My hunch is some rearranging of this code to allow the correct permissions to be read by stat would be a fix? If my hunch is right, is there a guide for contributing?

Thanks!