Re: "pkg upgrade" failing with "Fail to create temporary file: ... Not a directory"

From: Stefan Esser <se_at_FreeBSD.org>
Date: Thu, 28 Apr 2022 10:31:06 UTC
Am 28.04.22 um 09:11 schrieb Baptiste Daroussin> It is 2 things, it is a port
problem of maintainers who do not check for
> upgradability of their packages, and it can also been seen as something pkg can
> deal with, but a complicated case, so I don't know yet how.
> 
> The main issue is a file in vX which becomes a directory in vX+1 which goes in
> the way pkg does extract files to be as atomic as possible.

This case could be caught and dealt with by removing the file or by moving
it out of the way (to a temporary name to allow it to be recovered if the
subsequent steps fail or to be deleted if they succeed).

Further special conditions may apply - but since there is no way a file
and directory can exist under the same name (on FreeBSD, at least), it is
safe to assume that the file will not be kept when the package is installed.

Regards, STefan