Skip to content

[SR-14372] Fatal error: Constant strings cannot be deallocated #56730

@swift-ci

Description

@swift-ci
Previous ID SR-14372
Radar rdar://problem/75627186
Original Reporter Valérian (JIRA User)
Type Bug

Attachment: Download

Environment

swift latest docker image:

root@docker-desktop:/src# swift --version
Swift version 5.3.3 (swift-5.3.3-RELEASE)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: a86a96cdee395a784a4e78a4985a17ef

Issue Description:

When using with the subdirectory parameter:

Bundle.module.url(forResource: "test", withExtension: "json", subdirectory: "Resources")

under Linux, it will crash with the following fatal error:

Fatal error: Constant strings cannot be deallocated: file Foundation/NSCFString.swift, line 119

You can easily reproduce with the attached project.

docker run --rm --privileged --interactive --tty \
    --volume "$(pwd):/src" \
    --workdir "/src" \
    swift:latest
root@docker-desktop:/src# swift test
[13/13] Linking swift-linux-crash-resourcesPackageTests.xctest
Test Suite 'All tests' started at 2021-03-19 13:18:00.903
Test Suite 'debug.xctest' started at 2021-03-19 13:18:00.904
Test Suite 'swift_linux_crash_resourcesTests' started at 2021-03-19 13:18:00.904
Test Case 'swift_linux_crash_resourcesTests.testExample' started at 2021-03-19 13:18:00.905
Fatal error: Constant strings cannot be deallocated: file Foundation/NSCFString.swift, line 119
Exited with signal code 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions