Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-10839] Unicode (Combining?) Characters break Module Names #4858

Open
swift-ci opened this issue Jun 6, 2019 · 3 comments
Open

[SR-10839] Unicode (Combining?) Characters break Module Names #4858

swift-ci opened this issue Jun 6, 2019 · 3 comments
Labels

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Jun 6, 2019

Previous ID SR-10839
Radar rdar://problem/52162733
Original Reporter SDGGiesbrecht (JIRA User)
Type Bug
Environment

macOS 10.14.5

Swift 5.0.1

Additional Detail from JIRA
Votes 0
Component/s Compiler, Package Manager
Labels Bug
Assignee None
Priority Medium

md5: d668aab4b2e6d8d65bc46c1379051558

Issue Description:

(I am observing this with the package manager, but I imagine the issue is more widespread.)

Module names seem to support Unicode. But it is not consistent. Some names work just fine:

mkdir Εφ
cd Εφ
swift package init
swift test

But others break:

mkdir Εφαρμογή
cd Εφαρμογή
swift package init
swift test

The tests pass, but the module can only be imported with Εφαρμογη_, which does not match the manifest. In this case it seems to be triggered by a combining scalar.

On macOS everything is in NFD at this point, due to the original directory name. What if we try to work around it by changing the manifest entries to NFC so the tonos is not a separate scalar? ("Εφαρμογ\u{3AE}")

No dice; regardless of whether the import statement itself is in NFD or NFC, this happens:

$ swift test
[...]/Εφαρμογή/Tests/ΕφαρμογήTests/Εφαρμογη_Tests.swift:2:18: error: cannot load module 'Εφαρμογή' as 'Εφαρμογή'
@testable import Εφαρμογή

And looking inside the .build directory, I see internally inconsistent entries like this:

[...]/Εφαρμογή.build/Εφαρμογη_.swift.o

@belkadan
Copy link

belkadan commented Jun 6, 2019

SwiftPM folks, is SwiftPM doing some kind of normalization here? The compiler just complains when it sees non-identifier names, but SwiftPM seems to be substituting out characters…but incorrectly, since it's substituting an accent without the base.

@ankitspd
Copy link
Member

Yeah, I think we do some mangling 🙁

@ankitspd
Copy link
Member

@radar create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants