Bug 261437 - outdated mktemp(1) examples
Summary: outdated mktemp(1) examples
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-24 18:38 UTC by Wolfram Schneider
Modified: 2024-10-27 16:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfram Schneider freebsd_committer freebsd_triage 2022-01-24 18:38:40 UTC
The manual page for mktemp(1)  

  https://man.freebsd.org/mktemp/1

has examples for temporary filenames as

/tmp/temp.XXXX
TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1

Using 4 or 6 X was probably ok 20 years ago, but not anymore. Best practice is to use 10 X. Given that our users often copy & paste examples from our manual pages we should update the documentation.

PS: same for mkstemp(3)
https://man.freebsd.org/mkstemp/3
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-10-27 16:38:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=93181e38342fc48eb95f83842156be478a4a6f01

commit 93181e38342fc48eb95f83842156be478a4a6f01
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2024-10-27 16:33:39 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2024-10-27 16:36:31 +0000

    mktemp(1): bring the documentation up to date with best practice

    Using short temp filenames as /tmp/temp.XXXX (4 or 6 X) was probably ok
    20 years ago, but not anymore. Best practice is to use 10 X. Given that our
    users often copy & paste examples from our manual pages we need to
    update the documentation.

    PR: 261437

 usr.bin/mktemp/mktemp.1 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-10-27 16:44:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=95b17d3b1c5187d2630556eaa0f2107378ca3b4f

commit 95b17d3b1c5187d2630556eaa0f2107378ca3b4f
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2024-10-27 16:41:01 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2024-10-27 16:41:01 +0000

    mktemp(3): bring the documentation up to date with best practice

    Using short temp filenames as /tmp/temp.XXXX (4 or 6 X) was probably ok
    20 years ago, but not anymore. Best practice is to use 10 X. Given that our
    users often copy & paste examples from our manual pages we need to
    update the documentation.

    PR: 261437

 lib/libc/stdio/mktemp.3 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)