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

Change default temp on Linux to /var/tmp. #19038

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

averms
Copy link

@averms averms commented Jan 5, 2025

Previously, the default temporary directory was /tmp on Linux and /private/tmp on macOS. On many Linux distros, including at least Fedora, /tmp is stored in RAM. This diverges from the behavior on macOS and has led to bugs, most notably the inability to install large bottles on memory-limited machines.

This fixes #19037.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Please let me know if there's anything else I need to change.

averms added 2 commits January 4, 2025 21:31
Previously, the default temporary directory was /tmp on Linux and
/private/tmp on macOS. On many Linux distros, including at least Fedora,
/tmp is stored in RAM. This diverges from the behavior on macOS and has
led to bugs, most notably the inability to install large bottles on
memory-limited machines.

This fixes Homebrew#19037.
@MikeMcQuaid
Copy link
Member

To me it makes more sense to scope this to either just Fedora or just when /tmp is tmpfs. I'm open to input from @Homebrew/maintainers, though.

@SMillerDev
Copy link
Member

Can we detect where to put this somehow?

@fxcoudert
Copy link
Member

I don't think we want to detect it every time we run the brew script. And Debian is moving to having in-RAM /tmp, like most distros already do: https://linuxiac.com/debian-13-moves-to-tmpfs-for-tmp-directory/

However, I would note that moving the temporary directory to /var/tmp means that things will be slower for most users. That's a significant downside.

@averms
Copy link
Author

averms commented Jan 5, 2025

just when /tmp is tmpfs.

Can we detect where to put this somehow?

This can be done with findmnt --target /tmp --output fstype --noheadings. It uses findmnt(8), which is in util-linux.

However, I agree with @fxcoudert. This is already the default behavior in just about every RPM-based distro and in Arch Linux and it will be soon in Debian

However, I would note that moving the temporary directory to /var/tmp means that things will be slower for most users. That's a significant downside.

Could you explain why for those of us not familiar with Homebrew internals?

@fxcoudert
Copy link
Member

moving the temporary directory to /var/tmp means that things will be slower for most users

The reason why /tmp is faster than /var/tmp is that it is RAM-based, rather than disk-based.

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.

Can't pour large bottles on Fedora Linux
4 participants