git: 93181e38342f - main - mktemp(1): bring the documentation up to date with best practice

From: Wolfram Schneider <wosch_at_FreeBSD.org>
Date: Sun, 27 Oct 2024 16:37:18 UTC
The branch main has been updated by wosch:

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(-)

diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1
index 68a5a54aa5c5..063f25f216dc 100644
--- a/usr.bin/mktemp/mktemp.1
+++ b/usr.bin/mktemp/mktemp.1
@@ -59,7 +59,7 @@ any file name with some number of
 .Ql X Ns s
 appended
 to it, for example
-.Pa /tmp/temp.XXXX .
+.Pa /tmp/temp.XXXXXXXXXX .
 The trailing
 .Ql X Ns s
 are replaced with the current process number and/or a
@@ -196,7 +196,7 @@ where the script should quit if it cannot get a safe
 temporary file.
 .Bd -literal -offset indent
 tempfoo=`basename $0`
-TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
+TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXXXXXX` || exit 1
 echo "program output" >> $TMPFILE
 .Ed
 .Pp
@@ -210,7 +210,7 @@ echo "program output" >> $TMPFILE
 In this case, we want the script to catch the error itself.
 .Bd -literal -offset indent
 tempfoo=`basename $0`
-TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXX`
+TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXXXXXX`
 if [ $? -ne 0 ]; then
 	echo "$0: Can't create temp file, exiting..."
 	exit 1