[patch] include/usage.h

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sun Jun 8 17:16:33 UTC 2008


On Sun, 8 Jun 2008, Cristian Ionescu-Idbohrn wrote:

> On Sun, 8 Jun 2008, Denys Vlasenko wrote:
>
> > # ./busybox mktemp --help
> > BusyBox v1.11.0.svn (2008-06-07 21:53:08 CEST) multi-call binary
> >
> > Usage: mktemp [-dt] [-p DIR] [TEMPLATE]
> >
> > Create a temporary file with name based on TEMPLATE and print its name.
> > TEMPLATE must end with XXXXXX (i.e., /tmp/temp.XXXXXX).

By the way, I just pulled down coreutils from gnu.org and built.

$ ./src/mktemp --version
mktemp (GNU coreutils) 6.12.23-68158

Could the TEMPLATE line provide a better wording?

$ ./src/mktemp --help
Usage: ./src/mktemp [OPTION]... [TEMPLATE]
Create a temporary file or directory, safely, and print its name.
If TEMPLATE is not specified, use tmp.XXXXXXXXXX.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I checked the coreutils mktemp and debian ditto.  They're different.

coreutils$ ./src/mktemp -u /tmp/tmp.$(perl -e 'print "X"x40;')
/tmp/tmp.Z4mPq71tp4LmiDovdemUHZNG4ig4Fktb7E2evlqt

debian$ mktemp -u /tmp/tmp.$(perl -e 'print "X"x40;')
/tmp/tmp.jkFdNGmRBHONugOgGRaRNwsMntSnIpPFnzH19308
                                            ^^^^^
Debian's uses the pid for the last characters in the generated name.

They don't use 'mkdtemp' or 'mkstemp' and the produced names provide the
advertised randomness.


Cheers,

-- 
Cristian



More information about the busybox mailing list