Skip to content

warning: the use of mktemp' is dangerous, better use mkstemp' or `mkdtemp' #5158

Open
@toffaletti

Description

@toffaletti

Using swift:latest docker image I see this warning still. However, it seems like it should have been addressed back in Dec of 2020: #2927

I'm using the docker image created by this Dockerfile: https://github.com/swiftlang/swift-docker/blob/01bc0e265e8dca6381d801b76762ada6836afb69/6.0/ubuntu/24.04/Dockerfile

root@56a5c7b80758:/code# swift --version
Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu
root@56a5c7b80758:/code# strings /usr/lib/swift_static/linux/libFoundationEssentials.a | grep mktemp
mktemp
root@56a5c7b80758:/code# strings /usr/lib/swift_static/linux/libFoundationEssentials.a | grep mkstemp
root@56a5c7b80758:/code#
root@56a5c7b80758:/code# strings /usr/lib/swift/linux/libFoundationEssentials.so | grep mktemp
mktemp
mktemp
root@56a5c7b80758:/code# strings /usr/lib/swift/linux/libFoundationEssentials.so | grep mkstemp
root@56a5c7b80758:/code#
swift build --static-swift-stdlib
Building for debugging...
/usr/lib/swift_static/linux/libFoundationEssentials.a(Data+Writing.swift.o):_ThreadLocal.swift.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n:(.text+0x2122): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(Data+Writing.swift.o):_ThreadLocal.swift.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n:(.text+0x21b8): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(Data+Writing.swift.o):_ThreadLocal.swift.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n:(.text+0x21f5): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(Data+Writing.swift.o):_ThreadLocal.swift.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n:(.text+0x2286): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/swift_static/linux/libFoundationEssentials.a(Data+Writing.swift.o):_ThreadLocal.swift.o:function $s20FoundationEssentials19createTemporaryFile33_FC9EC52B075D2ACCFF86F1C9F84293BELL2at6inPath6prefix7optionss5Int32V_SStSS_AA0Q5OrURLOSSAA4DataV14WritingOptionsVtKFTf4nnnd_n:(.text+0x22f1): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions