Closed MisterDA closed 2 years ago
Thanks @MisterDA :))
I'm not sure if this fixes the log problem I was describing before (the moving log files bit is useful for https://github.com/patricoferris/obuilder/pull/5 however). I mean having log files outside of the build directory should in theory solve the problem, I'm just not sure if there is a reason the logs currently get saved in the build directory.
The problem I was seeing is Db_store.get_build
calls Raw.build
which in this case was Zfs
. If the build fails then it calls
but as far as I can tell at that point the log file is still open so trying to destroy the dataset gets a resource busy
error (only on macOS...)
The first step is to remove the
dup
file in the log tailing to be sure that when/if we want to move the log file, there are no open file descriptors to it. This can be done by switching toReadonly
when the log is finished. The second step is to let the store decide the location of the log file. There's a bit of a chicken-and-egg problem here: the store was responsible for moving the log file, but theDb_store
module creates it a sets its location, and the store doesn't have access to the location. By letting the store set the log file location, it becomes able to set it to a location independent of the results directories, or to the original location and move it if there's no problem with it.cc @patricoferris