debian-forge/osbuild/util
David Rheinsberg e6b77ac7df util/fscache: avoid RENAME_NOREPLACE in _atomic_file()
The `RENAME_NOREPLACE` option is not available on NFS. Avoid using it
in _atomic_file() to allow NFS backed storage.

If the caller allows replacing the destination entry, we simply use the
original `os.rename()` system call. This will unconditionally replace
the destination on all file-systems.

If the caller requests `no-replace`, we cannot use `os.rename()`.
Instead, we use `os.link()` to create a new hard-link on the
destination. This will always fail if the destination already exists.
We then rely on the cleanup-path to unlink the original temporary
entry.

This will require adjustments in future maintenance tasks on the cache,
since they need to be aware that entries can be hardlinked temporarily.
However, we already consider `uuid-*` entries in the object-store to be
temporary and unaccounted for similar reasons, so this doesn't even
break our cache-maintenance ideas.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-12-20 16:56:32 +01:00
..
__init__.py util: mark as module 2020-04-21 17:00:04 +02:00
checksum.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
ctx.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
fscache.py util/fscache: avoid RENAME_NOREPLACE in _atomic_file() 2022-12-20 16:56:32 +01:00
jsoncomm.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
linux.py linux: add Libc accessor with renameat2(2) 2022-12-06 09:48:38 +01:00
lorax.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
lvm2.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
mnt.py objectstore, move {u,}mount methods to util.mnt 2022-08-13 19:21:52 +01:00
osrelease.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
ostree.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
parsing.py util: add helper to parse size strings 2022-12-09 12:03:40 +01:00
path.py util/path: new clamp mtime function 2022-12-15 13:10:35 +00:00
pe32p.py util: add module to parse PE32+ files 2022-11-14 20:10:59 +01:00
rhsm.py util: fix typo in get_consumer_secrets 2022-12-09 21:46:43 +01:00
rmrf.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
selinux.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
term.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
types.py osbuild: fix optional-types 2022-07-13 17:31:37 +02:00
udev.py osbuild: run isort on all files 2022-09-12 13:32:51 +02:00