Conflict between updater cleanup and post* script (swap post* and cleanup in transaction)
We encountered situation where file (link) was originally provided by package but to manage it dynamically we decided to not track it by package. It is created by
postinst script. This revealed an error in transaction execution. The transaction currently first runs
pre* scripts, then it merges all files to system, after that it runs all
post* scripts and at last it removes all additional files. This seems to be a nice approach but problem is that at time of postinst execution there are still original files on FS and not only that we are not correctly working with updated system we cannot replace those files because even if we edit them updater will remove them in cleanup phase. This can introduce some additional problems like that some modules can be fore example loaded to some services although they are effectively being removed by this transaction.
The correct approach is to first run
pre* script, later merge all files while removing any redundant files and then running
The core problem is that this is not simply possible to do now. We have to have journal compatibility and currently journal content is driven by transaction functions order. This means that we can't do this change unless we completely drop this approach or if we heavily tweak it. This is because journal from old version could possibly have still have old scripts running while new updater would tried to run cleanup. This is just stupid, that whole design is stupid.