apple / apple/swift-system

strerror is not (guaranteed) to be thread safe

Open
#156 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
1.4k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

This package's `Errno` type is using `strerror` to produce error strings. For unknown error numbers `strerror` writes a string into a static buffer and returns it, but whether this static buffer is thread local is unspecified. Using `strerror_r` would guarantee thread safety even for unknown error codes.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Swift `Errno` implementation and its use of `strerror`. Read the platform-specific POSIX error-string APIs, especially `strerror_r`, and check how unknown error numbers are handled. Done means error-string generation no longer relies on a potentially shared static buffer and the existing relevant tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.