RSTR:=0x$(shell dd if=/dev/urandom bs=4 count=1 \ of=/dev/stdout | cksum | tr -c -d [:xdigit:] \ | cut -b-8)
how might you do things differently? cksum is POSIX, unlike md5sum(1) (which, for starters, is just "md5(1)" on freebsd). intuition suggests the 802.3 (Ethernet) CRC used by cksum(1) doesn't wreck your uniform distribution properties (the simple one's-complement checksum method of RFC 793 (IPv4) obviously would suffice, but isn't trivially available from the POSIX command line).
Note that cksum(1posix) is introduced solely for converting dd-generated seed material into the necessary human-readable format. i'd like to use printf(1posix), but we need to pass dd's output through a pipe. it mustn't go to the shell, or there is a 4*N*(1/256) likelyhood of failure for each of N bytes interpreted as metacharacters. we can use single quotes to interpret only single quote characters, meaning a 1.5625% chance of failure. NASA called and said, "thanks, assmaster! now we'll never know whether tiny screws can be sorted in space!"
remember that variable definitions don't directly abort the build (aka cause a syntax error) for this kind of thing, so it will propagate up in your build...quite probably unnoticed, quite possibly until all too late (this is why i distrust $()/backtick substitution in scripts). Oh, and NASA called. They said you're off the Makefile team. Perhaps you'd have better luck writing PHP for Wet Seal?
unfortunately there's this big fat Hummer2-like (as in it wastes resources) entry in the printf(1) man page:
STDIN Not used.three bitches in a bitch boat! printf(1posix) ought accept a format conversion modifier indicating "take this one from stdin" (or, to be more flexible, a file descriptor which defaults to stdin's STDIN_FILENO aka 0).
Indeed, if we hijacked %n for this purpose, it would help fix a bug in the printf(1) and printf(1posix) man pages:
"...FORMAT controls the output as in C printf..."
Like hell it does; the byzantine %n conversion specifier, according to printf(3), "store[s] into the integer indicated by the int * (or variant) pointer argument. No argument is converted."
Well, there's jolly little pointer context you can very meaningfully pass to printf(1posix) code, following an exec(2) call as it (by virtue of being printf(1posix) and not printf(3)) does. in fact, this sounds like some incredibly subtle exploit in the making (%n certainly has been for printf(3) over the years). so maybe printf(1posix) ought grab the next $IFS-delimited value from stdin for %n.
so that was 5 seconds to write the Makefile definition, and about 15 minutes to blog this, huzzah!
[recombinator](127) $ \time -f %E ssh -oControlPath=none hogwarts true 0:01.44 [recombinator](0) $ \time -f %E ssh -oControlPath=none hogwarts true 0:01.65 [recombinator](0) $ \time -f %E ssh -oControlPath=none hogwarts true 0:01.68 [recombinator](0) $ \time -f %E ssh -oControlPath=none hogwarts true 0:01.61 [recombinator](0) $ \time -f %E ssh hogwarts true 0:00.26 [recombinator](0) $ \time -f %E ssh hogwarts true 0:00.20 [recombinator](0) $ \time -f %E ssh hogwarts true 0:00.20 [recombinator](0) $ \time -f %E ssh hogwarts true 0:00.22 [recombinator](0) $Those are some pretty solid improvements, folks. I've got a minor writeup here, or just read ssh_config(5). Oh yes: I quit McAfee Research 2009-11 to pursue academics full-time. It was a great five years there, and I appreciate all the good times. Back to my HotPar 2010 submission!