On 09/26/2013 05:36 AM, Jim Meyering wrote:
>> I'll push this soon, unless there are objections
>> to the above "undeprecation" of -p.
> 
> Go for it. That seems best.  Thank you.

That -p = --tmpdir aspect is OK.

But on consideration, erroring on -p,-t is too harsh.
Really -t is just a mode to operate in,
i.e. enforce no '/' in template, and give precedence
to TMPDIR over --tmpdir
Hopefully the attached documentation only patch
suffices to clear things up.

BTW I noticed this variation which could be
used to generate passwords or something:

 $ mktemp -u -t -p '' XXXXXXXX
 L5awccB1

However without -t, '/tmp/' is inserted.
I'm inclined to change to not output '/tmp/' here?

 $ mktemp -u -p '' XXXXXXXX
 /tmp/L5awccB1

thanks,
Pádraig.
>From bc10a871cd36a3089e28c4fdde6822ee5ecbda96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Sat, 21 Sep 2013 03:33:12 +0100
Subject: [PATCH] doc: clarify the mktemp option descriptions

* doc/coreutils.texi (mktemp invocation): Clarify that _all_ error
messages are suppressed with the -q option.
* src/mktemp.c (usage): Synchronize the -p option description with
the logic and info docs.  I.E. that -p is just an alias of --tmpdir.
Fixes http://bugs.gnu.org/154245
---
 doc/coreutils.texi |    5 +++--
 src/mktemp.c       |   15 +++------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 5b2f624..17cdbc3 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -13421,8 +13421,9 @@ umask is more restrictive.
 @itemx --quiet
 @opindex -q
 @opindex --quiet
-Suppress diagnostics about failure to create a file or directory.  The
-exit status will still reflect whether a file was created.
+Suppress all error messages, including command option syntax errors,
+and failure to create a file or directory.
+The exit status will still reflect whether a file was created.
 
 @item -u
 @itemx --dry-run
diff --git a/src/mktemp.c b/src/mktemp.c
index 44845c3..e169605 100644
--- a/src/mktemp.c
+++ b/src/mktemp.c
@@ -43,7 +43,6 @@ static const char *default_template = "tmp.XXXXXXXXXX";
 enum
 {
   SUFFIX_OPTION = CHAR_MAX + 1,
-  TMPDIR_OPTION
 };
 
 static struct option const longopts[] =
@@ -52,7 +51,7 @@ static struct option const longopts[] =
   {"quiet", no_argument, NULL, 'q'},
   {"dry-run", no_argument, NULL, 'u'},
   {"suffix", required_argument, NULL, SUFFIX_OPTION},
-  {"tmpdir", optional_argument, NULL, TMPDIR_OPTION},
+  {"tmpdir", optional_argument, NULL, 'p'},
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
@@ -78,27 +77,24 @@ Files are created u+rw, and directories u+rwx, minus umask restrictions.\n\
       fputs (_("\
   -d, --directory     create a directory, not a file\n\
   -u, --dry-run       do not create anything; merely print a name (unsafe)\n\
-  -q, --quiet         suppress diagnostics about file/dir-creation failure\n\
+  -q, --quiet         suppress all error messages\n\
 "), stdout);
       fputs (_("\
       --suffix=SUFF   append SUFF to TEMPLATE; SUFF must not contain a slash.\n\
                         This option is implied if TEMPLATE does not end in X\n\
 "), stdout);
       fputs (_("\
-      --tmpdir[=DIR]  interpret TEMPLATE relative to DIR; if DIR is not\n\
+  -p DIR, --tmpdir[=DIR]  interpret TEMPLATE relative to DIR; if DIR is not\n\
                         specified, use $TMPDIR if set, else /tmp.  With\n\
                         this option, TEMPLATE must not be an absolute name;\n\
                         unlike with -t, TEMPLATE may contain slashes, but\n\
                         mktemp creates only the final component\n\
 "), stdout);
-      fputs ("\n", stdout);
       fputs (_("\
-  -p DIR              use DIR as a prefix; implies -t [deprecated]\n\
   -t                  interpret TEMPLATE as a single file name component,\n\
                         relative to a directory: $TMPDIR, if set; else the\n\
                         directory specified via -p; else /tmp [deprecated]\n\
 "), stdout);
-      fputs ("\n", stdout);
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
       emit_ancillary_info ();
@@ -195,11 +191,6 @@ main (int argc, char **argv)
           dry_run = true;
           break;
 
-        case TMPDIR_OPTION:
-          use_dest_dir = true;
-          dest_dir_arg = optarg;
-          break;
-
         case SUFFIX_OPTION:
           suffix = optarg;
           break;
-- 
1.7.7.6

Reply via email to