Skip to content

Conversation

@3405691582
Copy link
Member

  • Explanation:

Fix a PATH processing bug when the toolchain is installed on the BSDs.

  • Scope:

Changes are scoped only to the BSDs, and the bug is only triggered when the program name, i.e., argv[0], is not an absolute or relative path.

  • Issues:

No issues, but is of relevance to the OpenBSD port in swiftlang/swift#78437

  • Original PRs:

#5289

  • Risk:

Low, this is a bugfix and it is scoped only for the BSDs.

  • Testing:

Original commit passed CI and original commit tested locally.

  • Reviewers:

@parkera

strsep modifies its first argument, which means that if we don't make a
copy, any PATH processing that may occur after _CFProcessPath executes
breaks because strsep will effectively change PATH to be only the first
list item. For example, swiftpm's tool finding fails because it searches
PATH, and if the tool in question doesn't reside in the first PATH item,
things break.

This only occurs on BSD and only when the program name, i.e., argv[0], is
not an absolute path.
@3405691582 3405691582 requested a review from parkera December 2, 2025 21:36
@3405691582 3405691582 changed the title Ensure strsep operates on a copy of PATH. (#5289) [6.3][cherrypick] Ensure strsep operates on a copy of PATH. (#5289) Dec 2, 2025
@3405691582
Copy link
Member Author

@swift-ci please test.

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.

2 participants