Skip to content

Restore posix_spawn_file_actions_addchdir_np for non-Linux#653

Merged
marcprux merged 1 commit intomainfrom
chdir-np
Apr 5, 2026
Merged

Restore posix_spawn_file_actions_addchdir_np for non-Linux#653
marcprux merged 1 commit intomainfrom
chdir-np

Conversation

@marcprux
Copy link
Copy Markdown
Member

@marcprux marcprux commented Apr 5, 2026

In order to support building skip for Homebrew formula distribution (Homebrew/homebrew-core#276091), we need to build against glibc 2.27, which doesn't define posix_spawn_file_actions_addchdir_np (added in glibc 2.29), and so was causing the build to fail for Homebrew/homebrew-core#276075:

  [37/42] Compiling SkipDriveExternal GradleDriver.swift
  /var/tmp/skip-20260404-10020-7quui0/Sources/SkipDriveExternal/ToolSupport.swift:977:13: error: cannot find 'posix_spawn_file_actions_addchdir_np' in scope
   975 | 
   976 |         if let workingDirectory = workingDirectory?.path {
   977 |             posix_spawn_file_actions_addchdir_np(&fileActions, workingDirectory)
       |             `- error: cannot find 'posix_spawn_file_actions_addchdir_np' in scope
   978 |         }
   979 | 

Other solutions to this (like swiftlang/swift-tools-support-core#113) will check for __GLIBC_PREREQ(2, 29), but we'd need to do that in a .c file and we don't especially want an extra C module in this package just to handle this. Similarly we could also just rely on https://github.com/swiftlang/swift-subprocess, but we don't want the plugin to have this extra dependency just to change the directly. Lastly, we might re-implement this with chdir (like in swiftlang/swift-tools-support-core#449), but that's process-wide and so dangerous and racy.

So for the time being, we'll just block out Linux and ignore the workingDirectory parameter, which we are mostly avoiding anyway (e.g., see skiptools/skipstone@2bba807 where we launch zip manually with /bin/sh -c … rather than try to use the workingDirectory param).

@cla-bot cla-bot bot added the cla-signed Automatically-added indication of a signed Contributor License Agreement label Apr 5, 2026
@marcprux marcprux merged commit 2e47f71 into main Apr 5, 2026
4 checks passed
@marcprux marcprux deleted the chdir-np branch April 5, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed Automatically-added indication of a signed Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant