[Bug 1822269] Re: mktemp does not handle -p option when --tmpdir option goes after -p option

Brian Foster blf.ireland at gmail.com
Thu Apr 11 19:02:43 UTC 2019


This is not a bug, it is expected & reasonable behaviour.
The `-p DIR' and `--tmpdir[=DIR]' mktemp(1) options
are the same, excepting that the <DIR> argument is
mandatory for -p and optional for --tmpdir.  (See
the manpage (`man mktemp') or try `mktemp --help'.)
That is, the following are equivalent:

   mktemp -u -p /       --tmpdir
   mktemp -u -p/        --tmpdir
   mktemp -u --tmpdir=/ --tmpdir
   mktemp -u -p /       -p "${TMPDIR:-/tmp}"

All print "FOO/tmp.<random-stuff>" where <FOO> is the
value of TMPDIR (/tmp if not set (the usual case)).
Clearly, the LAST (right→most) -p or --tmpdir option
is being used, with all the preceding ones ignored.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1822269

Title:
  mktemp does not handle  -p option when --tmpdir option goes after -p
  option

Status in coreutils package in Ubuntu:
  New

Bug description:
  #  This is correct.  The printed temp file name is in folder /
  $ mktemp -u --tmpdir -p /
  /tmp.aFd4MwfGDU

  # after swapping the options, mktemp do not handle the -p option correctly.
  # swapping options should not affect the output.
  $ mktemp -u -p / --tmpdir
  /tmp/tmp.FkTPrEsTMs

  This should be a software bug, not relevant to any hardware.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1822269/+subscriptions



More information about the foundations-bugs mailing list