Skip to content

Deprecate non-thread-safe tmpnam #5211

Description

@tgross35

Now that we get linker warnings, the following shows up:

warning: linker stderr: /usr/lib/gcc-cross/s390x-linux-gnu/14/../../../../s390x-linux-gnu/bin/ld: /checkout/target/s390x-unknown-linux-gnu/debug/deps/ctest-2b4e214b33ebd228.6vgf36pq173k6xsd10a2clvaj.0hetexw.rcgu.o: in function `ctest::generated_tests::ctest_foreign_fn_tmpnam':
         /checkout/target/s390x-unknown-linux-gnu/debug/build/libc-test-cd93a2bf0f73e50d/out/ctest_output.rs:216053:(.text._RNvNtCsdHcC3tdE9G5_5ctest15generated_tests23ctest_foreign_fn_tmpnam+0x18): the use of `tmpnam' is dangerous, better use `mkstemp'
  |
  = note: `#[warn(linker_messages)]` on by default
  = note: the `linker_messages` lint ignores `-D warnings`
warning: linker stdout: /usr/lib/gcc-cross/s390x-linux-gnu/14/../../../../s390x-linux-gnu/bin/ld: /checkout/target/s390x-unknown-linux-gnu/debug/deps/ctest-2b4e214b33ebd228.6vgf36pq173k6xsd10a2clvaj.0hetexw.rcgu.o: note: the message above does not take linker garbage collection into account

These are deprecated in glibc at least https://man7.org/linux/man-pages/man3/tmpnam.3.html. We should deprecate all instances of tmpnam, tempnam, and L_tmpnam since they have more secure alternatives, for removal in 1.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions