apple / apple/swift-system

Assertion failure in FilePath.lexicallyNormalized()

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

Description

```console
% swift --version
Apple Swift version 6.2 (swift-6.2-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions
```

Using swift-system 1.6.3, attached file contains minimal reproducer.

Test code:

```swift
import SystemPackage
import Testing

@Test func pathNormalize() throws {
let path = FilePath("dir/../../../etc/pwned")
#expect(path.lexicallyNormalized() == "../../etc/pwned")
}
```

```console
% swift test
[1/1] Planning build
Building for debugging...
[1/1] Write swift-version--2028C2505FF3CBA9.txt
Build complete! (0.13s)
Test Suite 'All tests' started at 2026-01-11 13:48:30.341.
Test Suite 'All tests' passed at 2026-01-11 13:48:30.342.
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
􀟈 Test run started.
􀄵 Testing Library Version: 6.2 (3fdabe5392108d8)
􀄵 Target Platform: arm64-apple-macosx
􀟈 Test pathNormalize() started.
SystemPackage/FilePathParsing.swift:231: Assertion failed
error: Exited with unexpected signal code 5
```

[20260111-lexicalnormalize-bug.tgz](https://github.com/user-attachments/files/24555154/20260111-lexicalnormalize-bug.tgz)

Contributor guide

Open the contributing guide

Research direction

Start with FilePathParsing.swift at the assertion reported on line 231, then run the pathNormalize reproducer from the issue with Swift 6.2 and swift-system 1.6.3. Trace lexicallyNormalized() for "dir/../../../etc/pwned" and add or update the relevant test so it produces "../../etc/pwned" without an assertion failure.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.