Skip to content

[Serialized diagnostics] Avoid generating filenames that break the reader #70139

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

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

DougGregor
Copy link
Member

The serialized diagnostics reader has one very specific limitation it places on filenames: they must not end in /, because that makes them look like a directory. This is not documented, and the diagnostics reader will unceremoniously crash when trying to read such a file.

While the reader should be fixed to at least fail gracefully in such cases, Swift also shouldn't generate such filenames. Right now, they can be generated when referencing an entity named / that is synthesized or comes from a module. When we encounter such file names, append _operator to avoid the problem.

Fixes rdar://118217560.

…ader

The serialized diagnostics reader has one very specific limitation it
places on filenames: they must not end in `/`, because that makes them
look like a directory. This is not documented, and the diagnostics
reader will unceremoniously crash when trying to read such a file.

While the reader should be fixed to at least fail gracefully in such
cases, Swift also shouldn't generate such filenames. Right now, they
can be generated when referencing an entity named `/` that is
synthesized or comes from a module. When we encounter such file names,
append `_operator` to avoid the problem.

Fixes rdar://118217560.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge November 30, 2023 22:54
@DougGregor DougGregor disabled auto-merge December 1, 2023 02:59
@DougGregor DougGregor merged commit c91b297 into swiftlang:main Dec 1, 2023
@DougGregor DougGregor deleted the operator-slash-filename-bad branch December 1, 2023 04:01
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