Opened 20 years ago
Last modified 15 years ago
#2724 closed defect
[BUG] Interrupting an activation phase can lead to file_map.db corruption — at Initial Version
Reported by: | kballard (Lily Ballard) | Owned by: | darwinports-bugs@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | |
Keywords: | Cc: | ||
Port: |
Description
I interrupted DarwinPorts during an activation phase and it left me with a severely-truncated file_map.db file. I'm guessing that DarwinPorts doesn't bother trapping that signal (I simply hit C) and I hit it during the filemap save method. DarwinPorts should either trap the signal to clean up nicely, or saving the file_map.db file should do an atomic save (i.e. save it in the temporary directory, then use an OS-provided atomic swap of the temp file and the original file_map.db file - if no atomic swap method exists for the given OS (I know Cocoa and Carbon provide atomic swap methods, but I don't know about darwin), go ahead and swap the two non-atomically - it's still dangerous, but far less than saving over file_map.db)