Apt: please make the moo reproducible
bugs.debian.org
bugs.debian.org
$ 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.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.
https://github.com/Debian/apt/blob/master/apt-private/privat...
$ apt-get moo moo
$ apt-get moo moo moo $ 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.Did 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 fail in #gotofail wasn't in using GOTO - it was a coding error, where a misindented line after a bracketless condition was always executed, when it should have been only executed inside the condition.
^^^ that part works
if (something) blah(); goto fail;
^^^ that part is written in a misleading way and doesn't do what it seems to do on first glance.
It is unfortunate that the problematic line contained a jump, because "#gotofail" seems to convey "GOTO considered harmful", while it's something completely unrelated. Ironic, really, given the actual meaning of "human looks at a block of text and misparses it."
if (some_cond) {
goto fail;
}
goto fail;
if (some_cond) {
goto fail;
}
if (some_cond) {
goto fail;
}
if (some_cond) {
goto fail;
}
Is it more obvious? Sure. But the real issue is that they weren't testing all of the important failure cases, not that they weren't using one code style over another. Coding style is not going to help you if one of those some_cond values is incorrectly written...OTOH, this tool will help you avoid a common pitfall with potentially disastrous consequences. A high-visibility vest for coding, if you will: won't save you from slipping or your head from falling objects, but neither is its purpose.
(Iterative bootstrapping is how we got from sharpened rocks to virtual machines, not by "meh, this minor improvement won't fix everything, so why bother.")
" 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.
Though, your point here is interesting. Using curlies probably could have stopped that bug. Using static analysis that saw dead code definitely would have stopped it.
In this case, mechanisms (automatic checking for dead code) are vastly superior to good intentions (always using curlies).
I didn't mean literally everything. I mean everything that has more benefits than costs. I consider consistent curly brace style to fit in that category.
And to be clear, I find that just as weird as you probably do. :)
I think it is a strong argument for compilers' -Wall to detect misindented statements directly following unbracketed conditional expressions, though.
ip moo