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

Shorten brew tests temporary paths. #18391

Merged
merged 1 commit into from
Sep 24, 2024
Merged

Conversation

MikeMcQuaid
Copy link
Member

@MikeMcQuaid MikeMcQuaid commented Sep 24, 2024

If you have HOMEBREW_TEMP set to a longer path (e.g. the user's private temporary directory rather than /private/tmp), Sequoia will error out on some tests when forking because the path is too long (> 104 bytes).

To improve this situation let's:

  • use a shorter path for HOMEBREW_TEMP by appending /brew-tests to the existing HOMEBREW_TEMP used outside of tests rather than creating nested temporary directories
  • use the minimal amount of randomness to avoid collisions while allowing parallel tests
  • use squeeze to remove any double slashes in the temporary path

If you have `HOMEBREW_TEMP` set to a longer path (e.g. the user's
private temporary directory rather than `/private/tmp`), Sequoia will
error out on some tests when forking because the path is too long
(> 104 bytes).

To improve this situation let's:
- use a shorter path for `HOMEBREW_TEMP` by appending `/brew-tests` to
  the existing `HOMEBREW_TEMP` used outside of tests rather than
  creating nested temporary directories
- use the minimal amount of randomness to avoid collisions while
  allowing parallel tests
- use `squeeze` to remove any double slashes in the temporary path
Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sequoia will error out on some tests when forking because the path is too long (> 104 bytes).

Note that macOS has an extension to BSD sockets that does support up to 253 characters, but that extension is not properly exposed in Ruby so requires a wrapper:

class UNIXServerExt < Socket
  attr_reader :path

  def initialize(path)
    super(:UNIX, :STREAM)
    bind("\x01\x00" + path)
    listen(Socket::SOMAXCONN)
    @path = path
  end
end

If you'd like to go that route instead: let me know and I can open a PR to do that today.

@MikeMcQuaid
Copy link
Member Author

If you'd like to go that route instead: let me know and I can open a PR to do that today.

@Bo98 Yes, please. Merging this to unblock brew tests on Sequoia in these configurations but please feel free to revert any/all of this PR if it's no longer needed.

@MikeMcQuaid MikeMcQuaid merged commit 410fe21 into master Sep 24, 2024
27 checks passed
@MikeMcQuaid MikeMcQuaid deleted the shorten_brew_tests_temp_path branch September 24, 2024 14:37
@MikeMcQuaid
Copy link
Member Author

(@Bo98 it may also be that this stuff is worth attempting to upstream once it's working for us)

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