[Ohrrpgce] [ohrrpgce/ohrrpgce] Hero editor and other RELOAD lumps failing to save changes (#36)

Ralph Versteegen notifications at github.com
Sat Aug 24 20:14:43 PDT 2019


While inspecting [c_debug_archive.txt](https://github.com/ohrrpgce/ohrrpgce/files/3537794/c_debug_archive_nezbid_dataloss.txt) which nezbid sent me while investigating bug #35, I discovered a lot of errors like 

```
! 0 open files:
! ERROR: rename(C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld.tmp, C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld) failed: Permission denied
! showerror: user continued
! SerializeBin: could not rename C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld.tmp to C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld
```

Apparently `rename` on Windows fails with a `Permission denied` error if any program has the file open (the old file, being replaced, or the new one? I'm not sure which is the problem here). Doing some research, I found [this stackoverflow discussion](https://stackoverflow.com/questions/3764072/c-win32-how-to-wait-for-a-pending-delete-to-complete/) about **virus scanners and search indexers** opening files after you write to them, which will delay attempts to delete it, randomly break programs that delete and recreate files, and, I believe, also break `rename`, though I didn't find anyone complaining about that.

Possible solutions to `rename` failing are:
* wait a little while and try again
* fallback to a copy followed by a delete. Only the delete ought to fail if there's still a problem

Marking this a blocker because it's serious and fixable.

This doesn't provide any explanation for why bug #35 happens, so I filed it as a separate bug. I'm clueless about that one.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/ohrrpgce/ohrrpgce/issues/36
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20190824/38a425f4/attachment-0001.html>


More information about the Ohrrpgce mailing list