236 points · by teddyh · 9y ago · 59 comments
$ apt-get moo
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
..."Have you mooed today?"...
Edit: maybe not actually! Just found this too: $ aptitude moo
There are no Easter Eggs in this program.
$ aptitude -v moo
There really are no Easter Eggs in this program. $ apt-get
apt 1.0.9.8.4 for amd64 compiled on Dec 11 2016 09:48:19
Usage: apt-get [options] command
apt-get [options] install|remove pkg1 [pkg2 ...]
apt-get [options] source pkg1 [pkg2 ...]
…
This APT has Super Cow Powers.
$ aptitude --help
aptitude 0.6.11
Usage: aptitude [-S fname] [-u|-i]
aptitude [options] <action> ...
…
This aptitude does not have Super Cow Powers.I don't think anything actually uses "apt-get moo" in its build script.
This kind of patch makes more sense for build tools like "ar" (static library creator). By default, "ar" injects a timestamp into the output file, so the binary is different each build. But, use the "D" flag and "ar" becomes deterministic.
$ apt-get moo moo
$ apt-get moo moo mooDid I just read a code review advocating for #gotofail, just to avoid a minor formatting nitpick?
The fact that it's pretty much the most sane way to consistently handle errors in a complicated C program. In particular if you have multiple paths out of your function and it also makes memory allocations, that's an overcomplicated amount of free() calls you need to take care of, remember are there, and maintain as you add/remove allocations and failure paths. goto lets you keep it simple by only maintaining a single block of free()s at your function's single exit path.
Granted it seems this file is C++ and therefore the "going full RAII" option exists and could avoid goto in favor of exceptions or early returns... But if your code is C style that is a tough conversion to make, and not everybody buys into it equally.
" The followers advice is dropping the curly brackets for these one-line ifs to make them all happy. "
I have never understood why anyone would do this. It's a bug waiting to happen (as goto fail showed), for truly marginal benefit
if (foo)
bar();
if (foo) {
bar();
}Any number of things could have prevented the bug. So lets do all of them.