Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkgdiff-mg: use /var/tmp instead of /tmp as default TMPDIR #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Flowdalic
Copy link

pkgdiff can cause large files in the used temprorary directory that are not cleaned up on exit. Using /tmp for those, which is often a tmpfs, which means that the files consume main memory at first. Later the system may move the unused files on the tmpfs into swap.

In any case, using /var/tmp instead of /tmp as default TMPDIR for pkgdiff-mg is sensible. As a genral rule of thumb, /tmp should be used for smaller, size bounded files only; /var/tmp for everything else.

@thesamesam
Copy link
Collaborator

Heh, I've been bitten by this a few times, actually (e.g. Chromium and such stack up).

Maybe we should even install a tmpfiles.d snippet in the ebuild for the new location ;)

@mgorny
Copy link
Member

mgorny commented May 27, 2023

The problem is, /tmp will get cleaned up on next boot while /var/tmp will clutter on until someone cleans it up.

@Flowdalic
Copy link
Author

The problem is, /tmp will get cleaned up on next boot while /var/tmp will clutter on until someone cleans it up.

systemd systems will typically automatically clean up /var/tmp. How about we add some logic to detect if systemd is installed and running, and then use /var/tmp and otherwise keep the current behavior?

@Flowdalic Flowdalic force-pushed the pkgdiff-mg-tmpdir branch from d892fc6 to 815b442 Compare May 29, 2023 19:58
@Flowdalic
Copy link
Author

Pushed version that considers if the script run on a systemd system.

@Flowdalic
Copy link
Author

@mgorny friendly ping

@Flowdalic
Copy link
Author

@mgorny another friendly ping

@Flowdalic
Copy link
Author

@mgorny and another friendly ping.

I've updated to systemd check to be even more lightweight, by checking for the /run/systemd/system directory (inspired by systemd.eclass).

pkgdiff can cause large files in the used temprorary directory that
are not cleaned up on exit. Using /tmp for those, which is often a
tmpfs, which means that the files consume main memory at first. Later
the system may move the unused files on the tmpfs into swap.

Under systemd, using /var/tmp for files that are not deleted by the
creator, which is pkgdiff-mg in our case, is safe, since systemd will
automatically delete old unused files from /var/tmp.

Signed-off-by: Florian Schmaus <[email protected]>
@Flowdalic Flowdalic force-pushed the pkgdiff-mg-tmpdir branch from 7599437 to 9681cd4 Compare June 13, 2024 06:49
@Flowdalic
Copy link
Author

@mgorny ping, please consider this (or close this PR).

I've been using this for a while now on all my (systemd) dev machines and like to avoid having it to put it in /etc/portage/patches but rather have it upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants