Discussion:
[Toybox] [PATCH] mktemp: fix the tests and the logic.
Rob Landley
2018-12-05 23:40:27 UTC
Permalink
* We weren't outputting anything in the case where we actually create a
  file or directory (but all the tests were for the -u case).
* There are more gnarls to the behavior if TEMPLATE contains a '/'. The
  new tests cover these.
Sigh. (See attached...)

Lemme try to reconcile them...

Rob
Rob Landley
2018-12-06 18:48:16 UTC
Permalink
it occurred to me overnight that the passwd code allows '/'. plus, as
i've said, it seems to be slightly wrong. so i've just sent a
replacement for my second patch (to be applied on top of the first
patch) that just does the simplest xgetrandom + convert to valid
character loop.
can we at least get the first patch in, since mktemp is pretty broken
right now (_except_ for -u, which was all the old tests exercised)?
Can you send me just a tests/mktemp.test patch to demonstrate the failures? I'll
try to fix it this evening. (Too many changes at once, I need to know what
success looks like...)

Thanks,

Rob
Rob Landley
2018-12-07 15:34:39 UTC
Permalink
Post by Rob Landley
it occurred to me overnight that the passwd code allows '/'. plus, as
i've said, it seems to be slightly wrong. so i've just sent a
replacement for my second patch (to be applied on top of the first
patch) that just does the simplest xgetrandom + convert to valid
character loop.
can we at least get the first patch in, since mktemp is pretty broken
right now (_except_ for -u, which was all the old tests exercised)?
Can you send me just a tests/mktemp.test patch to demonstrate the failures? I'll
try to fix it this evening. (Too many changes at once, I need to know what
success looks like...)
you could just apply the two patches... that way you'll have the tests
_and_ they'll pass. (the _real_ question is whether we're still
missing important tests, since we were only testing -u until now. plus
testing "the Xs get replaced with random data" is inherently hard to
test.)
i've attached "just the tests" to this mail.
Sorry for the delay replying, gmail unsubscribed everybody from the list again
and I had to do the web gui dance.

I just pushed a version that passes all those tests, but there's probably more
corner cases to add to mktemp.test. My notes are to check what -p "" and
TMPDIR="" do (set but act like not set), look at unifying the passwd and salt
and mktemp random char functions, and my "I tested this while developing" cut
and paste backscroll is:

$ TMPDIR=. mktemp -u blah.XXX
blah.Iq2
$ TMPDIR=/tmp mktemp -u murgle blah.XXX
mktemp: too many templates
$ TMPDIR=/tmp mktemp -p murgle/ blah.XXX
mktemp: failed to create file via template ‘murgle/blah.XXX’: No such file or
directory
$ TMPDIR=/tmp mktemp -up murgle/ blah.XXX
murgle/blah.jjs
$ TMPDIR=/tmp mktemp -tup murgle/ blah.XXX
/tmp/blah.3NR
$ mktemp -tup murgle/ blah.XXX
murgle/blah.rel
$ mktemp -tup "" blah.XXX
blah.V6Q
$ TMPDIR=/woot mktemp -tup "" blah.XXX
/woot/blah.lpm
$ TMPDIR=/woot mktemp -up "" blah.XXX
/woot/blah.Fh5

But it is $DAYJOB time again...

Rob
Rob Landley
2018-12-07 16:45:37 UTC
Permalink
Post by Rob Landley
Sorry for the delay replying, gmail unsubscribed everybody from the
list again and I had to do the web gui dance.
I had left my read only gmail account on this list as a comparison to
my account on my own email server. As expected, the gmail one did the
bouncy spam thing, mine didn't. So I'll go and properly remove my
gmail one now, should not be any of my gmail accounts left in your
mailing lists anymore. That's one less to dance for next time.
There's a little over 100 gmail accounts subscribed to the list. And the
dreamhost web interface can't _not_ sort them alphabetically, so I have to click
on every letter one at a time to bring up _that_ page of accounts and unclick
the ones with "B" as their disabled reason, then submit to reload the page, then
click on the next letter. (And there used to be some starting with digits, but
those apparently dropped off...)

My internet here in milwaukee is via phone tethering (never got a cable modem
for the apartment and I don't connect personal devices to the $DAYJOB network),
and since dreamhost's https support is only for the main website and _not_ the
lists.landley.net server, I prefer to do the unavoidably plaintext password
admin stuff via USB cable rather than wireless access point (so at least _one_
less hop is insecurely encrypted), and I didn't have a working USB cable with
me. (The little short one is a "charge but not carry data" cable, which I prefer
whem plugging into who knows what USB power to keep my phone charged, but didn't
have the other one in my backpack so had to do it when I got home.)

Rob

Loading...