[pbs-devel] applied: [PATCH pbs-client v5] fix #3699: client: prefer xdg cache directory for tmp files

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jul 17 13:40:21 CEST 2024


Am 17/07/2024 um 12:18 schrieb Maximiliano Sandoval:
> Adds a helper to create temporal files in XDG_CACHE_HOME. If we cannot
> create a file there, we fallback to /tmp as before.
> 
> Note that the temporary files stored by the client might grow
> arbitrarily in size, making XDG_RUNTIME_DIR a less desirable option.
> Citing the Arch wiki [1]:
> 
>> Should not store large files as it may be mounted as a tmpfs.
> 
> [1] https://wiki.archlinux.org/title/XDG_Base_Directory
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
> ---
> 
> Differences from v4:
>  - Use backticks in documentation for `/tmp` and `XDG_CACHE_HOME`
> 
> Differences from v3:
>  - Link create_tmp_file in docs
>  - Improve commit message
> 
> Differences from v2:
>  - Files are created at XDG_CACHE_HOME directly
>  - If opening fails, we try opening at /tmp
>  - We check if the directory exists as part of the error handling of open()
> 
>  pbs-client/src/backup_reader.rs      | 31 ++++++++--------------------
>  pbs-client/src/backup_writer.rs      | 13 ++----------
>  pbs-client/src/tools/mod.rs          | 26 +++++++++++++++++++++++
>  proxmox-backup-client/src/catalog.rs | 19 +++--------------
>  4 files changed, 40 insertions(+), 49 deletions(-)
> 
>

applied, thanks!

Made a small addition to the commit message to explain why we do not need
to bother with clean up when some operation does not finish cleanly (error,
user interrupt, ...), i.e. due to O_TMPFILE being set; IMO that's good to
state as it's both important in general (to avoid leaking data to others)
and also using directories that normally persist a reboot.

btw. Wolfgang mentioned that it might make sense to have a fallback for the
case where O_TMPFILE is not supported.
While your patch did not introduce using O_TMPFILE, it's probably more
likely to make problems now,  e.g. if the home directory is backed by NFS,
which is quite common in some sectors/orgs (e.g. universities).




More information about the pbs-devel mailing list