Skip to content

Conversation

@3405691582
Copy link
Member

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.

(As a heads up: this should be picked onto release branches.)

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 November 23, 2025 00:25
@3405691582
Copy link
Member Author

@swift-ci please test.

Copy link
Contributor

@parkera parkera left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me

@parkera
Copy link
Contributor

parkera commented Nov 24, 2025

We will need to wait until the branch is reopened to merge

@3405691582
Copy link
Member Author

@swift-ci please test.

@3405691582
Copy link
Member Author

@swift-ci please test Windows platform.

@3405691582 3405691582 merged commit 5bef267 into swiftlang:main Dec 2, 2025
2 checks passed
3405691582 added a commit to 3405691582/swift-corelibs-foundation that referenced this pull request Dec 2, 2025
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.
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