8 ms·
Apt: please make the moo reproducible
- smcl 10y agoTook me a while (after reading through the reply, to no avail) to figure out what this refers to. Here's the feature this is referring to: $ 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.
- simias 10y agoI don't really understand what in this feature makes the build non-reproducible. Judging by the patch it's the call to time(NULL) that seems to be problematic, but I don't understand why.
- lamby 10y agoIt doesn't; it makes anyone using the output...
- smcl 10y agoYeh I only skimmed the patch but I presumed "reproducable build" referred to the actual binary, and the patch addresses runtime behaviour. Guess I'm missing something.
- karrotwaltz 10y agoFrom what I can read in patch file, it seems to be doing something different on April fools day.
- kr7 10y agoThe output of "apt-get moo" changes on special days (4/1, 12/25, 8/16, 11/7, 2/18). So if another program was using "apt-get moo" in its build script, the build would not be reproducible. With the patch, the SOURCE_DATE_EPOCH environment variable can be set to make "apt-get moo" deterministic. 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.
- rzzzt 10y agoThe time-dependent part can be seen here: https://github.com/Debian/apt/blob/master/apt-private/private-moo.cc#L164 https://github.com/Debian/apt/blob/master/apt-private/privat...
- kr7 10y agoThere is a second part above too: https://github.com/Debian/apt/blob/master/apt-private/private-moo.cc#L33 https://github.com/Debian/apt/blob/master/apt-private/privat...
- CroCroCro 10y agoKeep adding more v.
- smcl 10y agoYep it gets good - wasn't sure whether to spoil the fun or not :)
- paulddraper 10y ago> I got a fever! And the only prescription.. is more -v!
- dabber 10y agotry $ apt-get moo moo $ apt-get moo moo moo
- TimWolla 10y agoThis is “documented” as well. apt-get has got Super Cow Powers and aptitude has not. $ 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.
- deleted 10y ago[deleted]
- mvo 10y agoTry `aptitude -vv moo` :)
- ansgri 10y agoThanks. A nice New Year's gift, to learn Super Cow Powers. Though talking about more -v's, I don't think Aptitude is written in Python, is it?
- Gaelan 10y agoI recall that aptitude has more messages for more v's.
- dfc 10y agoThis is a patch for apt, it does not have anything to do with aptitude.
- dabber 10y agoRelated bug: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/56125 https://bugs.launchpad.net/ubuntu/+source/apt/+bug/56125
- jordigh 10y agoI am sad that my contribution to this bug has been dropped from Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=413725 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=413725
- pksadiq 10y agoThere is also: ip moo
- kworker 10y agoPETA approved.
- the_duke 10y agoDavid Kalnischkies response is the most hilarious code review I've ever read.
- ja30278 10y agoIt's quite funny, but.. " 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(); }
- swift 10y agoI agree, but to be fair, goto fail was not really caused by the lack of curly braces around an if statement body. It was caused by inadequate code review and lack of testing coverage. The latter especially is inexcusable in security-critical code.
- paulddraper 10y ago"The building's collapse was not caused by poor choices in materials, but by inadequate inspection procedures." Any number of things could have prevented the bug. So lets do all of them.
- taeric 10y agoThat logic clearly fails, though. You will never do everything to prevent a failure. (As an example, there are almost always stronger materials. Cost is a requirement,) 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).
- paulddraper 10y ago
- Piskvorrr 10y agoHilarious, yes. Except this: "The followers advice is dropping the curly brackets for these one-line ifs to make them all happy." Did I just read a code review advocating for #gotofail, just to avoid a minor formatting nitpick?
- cyphar 10y agoIt's also the Linux kernel style.
- Piskvorrr 10y agoPopularity doesn't make a bad idea any better.
- asveikau 10y agoSure, but you know what does make this idea better? 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.
- Sean1708 10y agoBut you could also do all of that without omitting curly brackets.
- Piskvorrr 10y agoTrue, insightful, but completely beside the point - which was "bracketless conditionals open up an avenue for coding errors." 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.
- hellofunk 10y agoCan I just say.. Holy cow!
- syassami 10y agoapt-get install cowsay - for all your mooing desires.
- fennecfoxen 10y agofortune | cowsay | lolcat
- deleted 10y ago[deleted]