#2724: [BUG] Interrupting an activation phase can lead to file_map.db corruption ---------------------------+------------------------------------------------ Reporter: kevin@… | Owner: pguyot@… Type: defect | Status: closed Priority: Normal | Milestone: Component: base | Version: Resolution: fixed | Keywords: Port: | ---------------------------+------------------------------------------------ Changes (by jmr@…): * milestone: MacPorts Future => Old 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)
New 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) -- -- Ticket URL: <http://trac.macports.org/ticket/2724#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS