Subject: lib/31383: Documentative omission in mktemp.3
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 09/24/2005 00:04:00
>Number:         31383
>Category:       lib
>Synopsis:       Documentative omission in mktemp.3
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 24 00:04:00 +0000 2005
>Originator:     Tonnerre Lombard
>Release:        3.99.9
(doesn't matter)
There is an implementation detail about mktemp() and gcc which causes a segmentation fault if one uses mktemp() in the seemingly most obvious way. The problem is created by the two facts that

1. mktemp() takes a string as an argument, but it actually writes to that string
2. gcc puts static strings into the readonly section

It's not properly documented yet that mktemp("/tmp/blubb-XXXXXX"); is going to cause a segfault for attempting to write to readonly memory. While this may be obvious to us, there have been some people who considered this a bug.

The solution, I think, is to document this behavior properly.
    int fd = mkstemp("/tmp/blubb-XXXXXX");
>Fix: , maybe with properly changed wording or something