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

[musl] use posix_spawn if a directory change was requested #131851

Merged
merged 1 commit into from
Oct 25, 2024

Commits on Oct 24, 2024

  1. [musl] use posix_spawn if a directory change was requested

    Currently, not all libcs have the `posix_spawn_file_actions_addchdir_np` symbol
    available to them. So we attempt to do a weak symbol lookup for that function.
    But that only works if libc is a dynamic library -- with statically linked musl
    binaries the symbol lookup would never work, so we would never be able to use it
    even if the musl in use supported the symbol.
    
    Now that Rust has a minimum musl version of 1.2.3, all supported musl versions
    now include this symbol, so we can unconditionally expect it to be there. This
    symbol was added to libc in rust-lang/libc#3949 -- use
    it here.
    
    I couldn't find any tests for whether the posix_spawn path is used, but I've
    verified with cargo-nextest that this change works. This is a substantial
    improvement to nextest's performance with musl. On my workstation with a Ryzen
    7950x, against https://github.com/clap-rs/clap at
    61f5ee514f8f60ed8f04c6494bdf36c19e7a8126:
    
    Before:
    
    ```
         Summary [   1.071s] 879 tests run: 879 passed, 0 skipped
    ```
    
    After:
    
    ```
         Summary [   0.392s] 879 tests run: 879 passed, 0 skipped
    ```
    
    Fixes rust-lang#99740.
    sunshowers committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    7f74c89 View commit details
    Browse the repository at this point in the history