Every now and then we get reports from CRAN about our packages failing a test there. A challenging one concerns UBSAN, or Undefined Behaviour Sanitizer. For background on UBSAN, see this RedHat blog post for gcc and this one from LLVM about clang.
I had written briefly about this before in a blog post introducing the sanitizers package for tests, as well as the corresponding package page for sanitizers, which clearly predates our follow-up Rocker.org repo / project described in this initial announcement and when we became the official R container for Docker.
Rocker had support for SAN testing, but UBSAN was not working yet. So following a recent CRAN report against our RcppAnnoy package, I was unable to replicate the error and asked for help on r-devel in this thread.
Martyn Plummer and Jan van der Laan kindly sent their configurations in the same thread and off-list; Jeff Horner did so too following an initial tweet offering help. None of these worked for me, but further trials eventually lead me to the (already mentioned above) RedHat blog post with its mention of -fno-sanitize-recover to actually have an error abort a test. Which, coupled with the settings used by Martyn, were what worked for me: clang-3.5 -fsanitize=undefined -fno-sanitize=float-divide-by-zero,vptr,function -fno-sanitize-recover.
This is now part of the updated Dockerfile of the R-devel-SAN-Clang repo behind the r-devel-ubsan-clang. It contains these settings, as well a new support script check.r for littler---which enables testing right out the box.
Here is a complete example:
docker # run Docker (any recent version, I use 1.2.0)
run # launch a container
--rm # remove Docker temporary objects when dome
-ti # use a terminal and interactive mode
-v $(pwd):/mnt # mount the current directory as /mnt in the container
rocker/r-devel-ubsan-clang # using the rocker/r-devel-ubsan-clang container
check.r # launch the check.r command from littler (in the container)
--setwd /mnt # with a setwd() to the /mnt directory
--install-deps # installing all package dependencies before the test
RcppAnnoy_0.0.5.tar.gz # and test this tarball
I know. It is a mouthful. But it really is merely the standard practice of running Docker to launch a single command. And while I frequently make this the /bin/bash command (hence the -ti options I always use) to work and explore interactively, here we do one better thanks to the (pretty useful so far) check.r script I wrote over the last two days.
check.r does about the same as R CMD check. If you look inside check you will see a call to a (non-exported) function from the (R base-internal) tools package. We call the same function here. But to make things more interesting we also first install the package we test to really ensure we have all build-dependencies from CRAN met. (And we plan to extend check.r to support additional apt-get calls in case other libraries etc are needed.) We use the dependencies=TRUE option to have R smartly install Suggests: as well, but only one level (see help(install.packages) for details. With that prerequisite out of the way, the test can proceed as if we had done R CMD check (and additional R CMD INSTALL as well). The result for this (known-bad) package:
edd@max:~/git$ docker run --rm -ti -v $(pwd):/mnt rocker/r-devel-ubsan-clang check.r --setwd /mnt --install-deps RcppAnnoy_0.0.5.tar.gz
also installing the dependencies Rcpp , BH , RUnit
trying URL 'http://cran.rstudio.com/src/contrib/Rcpp_0.11.3.tar.gz'
Content type 'application/x-gzip' length 2169583 bytes (2.1 MB)
opened URL
==================================================
downloaded 2.1 MB
trying URL 'http://cran.rstudio.com/src/contrib/BH_1.55.0-3.tar.gz'
Content type 'application/x-gzip' length 7860141 bytes (7.5 MB)
opened URL
==================================================
downloaded 7.5 MB
trying URL 'http://cran.rstudio.com/src/contrib/RUnit_0.4.28.tar.gz'
Content type 'application/x-gzip' length 322486 bytes (314 KB)
opened URL
==================================================
downloaded 314 KB
trying URL 'http://cran.rstudio.com/src/contrib/RcppAnnoy_0.0.4.tar.gz'
Content type 'application/x-gzip' length 25777 bytes (25 KB)
opened URL
==================================================
downloaded 25 KB
* installing *source* package Rcpp ...
** package Rcpp successfully unpacked and MD5 sums checked
** libs
clang++-3.5 -fsanitize=undefined -fno-sanitize=float-divide-by-zero,vptr,function -fno-sanitize-recover -I/usr/local/lib/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -pipe -Wall -pedantic -
g -c Date.cpp -o Date.o
[...]
* checking examples ... OK
* checking for unstated dependencies in tests ... OK
* checking tests ...
Running runUnitTests.R
ERROR
Running the tests in tests/runUnitTests.R failed.
Last 13 lines of output:
+ if (getErrors(tests)$nFail > 0)
+ stop("TEST FAILED!")
+
+ if (getErrors(tests)$nErr > 0)
+ stop("TEST HAD ERRORS!")
+
+ if (getErrors(tests)$nTestFunc < 1)
+ stop("NO TEST FUNCTIONS RUN!")
+
+
Executing test function test01getNNsByVector ... ../inst/include/annoylib.h:532:40: runtime error: index 3 out of bounds for type 'int const[2]'
* checking PDF version of manual ... OK
* DONE
Status: 1 ERROR, 2 WARNINGs, 1 NOTE
See
/tmp/RcppAnnoy/..Rcheck/00check.log
for details.
root@a7687c014e55:/tmp/RcppAnnoy#
The log shows that thanks to check.r, we first download and the install the required packages Rcpp, BH, RUnit and RcppAnnoy itself (in the CRAN release). Rcpp is installed first, we then cut out the middle until we get to ... the failure we set out to confirm.
Now having a tool to confirm the error, we can work on improved code.
One such fix currently under inspection in a non-release version 0.0.5.1 then passes with the exact same invocation (but pointing at RcppAnnoy_0.0.5.1.tar.gz):
edd@max:~/git$ docker run --rm -ti -v $(pwd):/mnt rocker/r-devel-ubsan-clang check.r --setwd /mnt --install-deps RcppAnnoy_0.0.5.1.tar.gz
also installing the dependencies Rcpp , BH , RUnit
[...]
* checking examples ... OK
* checking for unstated dependencies in tests ... OK
* checking tests ...
Running runUnitTests.R
OK
* checking PDF version of manual ... OK
* DONE
Status: 1 WARNING
See
/mnt/RcppAnnoy.Rcheck/00check.log
for details.
edd@max:~/git$
This proceeds the same way from the same pristine, clean container for testing. It first installs the four required packages, and the proceeds to test the new and improved tarball. Which passes the test which failed above with no issues. Good.
So we now have an "appliance" container anybody can download from free from the Docker hub, and deploy as we did here in order to have fully automated, one-command setup for testing for UBSAN errors.
UBSAN is a very powerful tool. We are only beginning to deploy it. There are many more useful configuration settings. I would love to hear from anyone who would like to work on building this out via the R-devel-SAN-Clang GitHub repo. Improvements to the littler scripts are similarly welcome (and I plan on releasing an updated littler package "soon").
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
Earlier today I came across some classical sheet music that included a "playalong" CD, just like a regular recording except it omits the solo cello part. After a quick listen it became clear there were two problems:
Next, we rip the material from the CD:
$ sudo apt-get install ripit flac [..] $ ripit --coder 2 --eject --nointeraction [..]
$ apt-get install sox libsox-fmt-mp3 [..] $ sox 01.flac 01.mp3 pitch -7.85 tempo 1.00 # (Tuning notes) $ sox 02.flac 02.mp3 pitch -7.85 tempo 0.95 # Too fast! $ sox 03.flac 03.mp3 pitch -7.85 tempo 1.01 # Close.. $ sox 04.flac 04.mp3 pitch -7.85 tempo 1.03 # Too slow!
As I said, I did not certain events that begun with lea and end with ing prevent me from organising a Debian/m68k hack weekend. Well, that weekend is now.
I m too unorganised, and I spent too much time in the last few evenings to organise things so I built up a sleep deficit already and the feedback was slow. (But so are the computers.) And someone I d have loved to come was hurt and can t come.
On the plus side, several people I ve long wanted to meet IRL are coming, either already today or tomorrow. I hope we all will have a lot of fun.
Legal disclaimer: Debian/m68k is a port of Debian to m68k. It used to be official, but now isn t. It belongs to debian-ports.org, which may run on DSA hardware, but is not acknowledged by Debian at large, unfortunately. Debian is a registered trademark owned by Software in the Public Interest, Inc.
Unfortunately I could not go on stage at the 31st Chaos Communication
Congress
to present reproducible builds in
Debian alongside Mike Perry
from the Tor Project and Seth Schoen from the Electronic Frontier
Foundation. I've tried to make it up for it, though and we have made
amazing progress.
Wiki reorganization
What was a massive and frightening wiki
page
now looks really more welcoming:
Depending on what one is looking for, it should be much easier to find.
There's now a high-level status overview given on the landing page,
maintainers can learn how to make their packages
reproducible,
enthusiasts can more easily find what can help the
project,
and we have even started writing some
history.
.buildinfo for all packages
New year's eve saw me hacking Perl to write
dpkg-genbuildinfo.
Similar to dpkg-genchanges, it's run by dpkg-buildpackage to produce
.buildinfo control
files.
This is where the build environment, and hash of source and binary
packages are recorded. This script, integrated with dpkg, replace the
previous debhelper interim solution written by Niko Tyni.
We used to fix mtimes in control.tar and
data.tar
using a specific addition to debhelper named dh_fixmtimes. To better
support the ALWAYS_EXCLUDE environment variable and for pragramtic
reasons, we moved the process in
dh_builddeb.
Both changes were quickly pushed to our continuous integration
platform. Before, only packages using
dh would create a .buildinfo and
thus eventually be considered reproducible. With these modifications,
many more packages had their chance and this shows:
Yes, with our experimental
toolchain
we are now at more than eighty percent! That's more than 17200 source
packages!
srebuild
Another big item on the todo-list was crossed over by Johannes Schauer.
srebuild
is a wrapper around sbuild:
Given aUnderstanding problems Over 1700 packages have now been reviewed to understand why build results could not be reproduced on our experimental platform. The variations between the two builds are currently limited to time and file ordering, but this still has uncovered many problems. There are still toolchain fixes to be made (more than 180 packages for the PHP registry) which can make many packages reproducible at once, but others like C pre-processor macros will require many individual changes. debbindiff, the main tool used to understand differences, has gained support for.buildinfofile, it first finds a timestamp of Debian Sid from snapshot.debian.org which contains the requested packages in their exact versions. It then runs sbuild with the right architecture as given by the.buildinfofile and the right base system to upgrade from, as given by the version of thebase-filespackage version in the.buildinfofile. Using two hooks it will install the right package versions and verify that the installed packages are in the right version before the build starts.
.udeb, TrueType and
OpenType fonts, PNG and PDF files. It's less likely to crash on problems
with encoding or external tool. But most importantly for large package,
it has been made a lot faster, thanks to Reiner Herrmann and Helmut
Grohne. Helmut has also been able to spot cross-compilation
issues by using debbindiff!
Targeting our efforts
It gives warm fuzzy feelings to hit the 80% mark, but it would be a bit
irrelevant if this would not concern packages that matter. Thankfully,
Holger worked on producing statistics for more specific package
sets. Mattia
Rizzolo has also done great work to improve the scripts generating the
various pages visible on
reproducible.debian.net.
All
essential
and
build-esential
packages, except gcc and bash, are considered reproducible or have
patches ready. After some lengthy builds, I also managed to come up
with a patch to make
linux build reproducibly.
Miscellaneous
After my initial attempt to modify
r-base to remove a timestamp
in R packages, Dirk Eddelbuettel discussed the issue with upstream and
came up with a better patch. The latter has already been merged
upstream!
Dirk's solution is to allow timestamps to be set using an external
environment variable. This is also how I modified
FontForge to make it possible to
reproduce
fonts.
Identifiers generated by
xsltproc have also been an
issue. After reviewing my initial patch, Andrew Awyer came up with a
much nicer solution. Its potential performance implications need to be
evaluated before submission, though.
Chris West has been working on packages built with
Maven
amongst other things.
PDF generated by
GhostScript,
another painful source of troubles, is being worked on by Peter De
Wachter.
Holger got X.509 certificates signed by the CA cartel for
jenkins.debian.net and reproducible.debian.net. No more scary
security messages now. Let's hope next year we will be able to get
certificates through Let's Encrypt!
Let's make a difference together
As you can imagine with all that happened in the past weeks, the
#debian-reproducible IRC channel has been a cool place to hang out.
It's very energizing to get together and share contributions, exchange
tips and discuss hardest points. Mandatory quote:
* h01ger is very happy to see again and again how this is a nice
learning circle...! i've learned a whole lot here too... in
just 3 months... and its going on...!
Reproducible builds are not going to change anything for most of our
users. They simply don't care how they get software on their computer.
But they care to get the right software without having to worry about
it. That's our responsibility, as developers. Enabling users to
trust their software is important and a major contribution, we as
Debian, can make to the wider free software movement. Once Jessie is
released, we should make a collective effort to make reproducible builds
an highlight of our next release.
A new version of RcppGSL is now on CRAN today. This package provides an interface from R to the GNU GSL using our Rcpp.
Similar to the recent RcppClassic release, this update was triggered by the CRAN maintainers desire to keep the Makefile free of GNU make extensions. At the same time we simplified the configure file a little, and refreshed the look and feel of the vignette.
No user-facing changes were made.
The NEWS file entries follows below:
Changes in version 0.2.3 (2015-01-10)Courtesy of CRANberries, a summary of changes to the most recent release is available. More information is on the RcppGSL page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page.
- The
src/Makevars.inwas pruned of GNU make features at the request of the CRAN Maintainersconfigure.acandconfigurewere updated, and shortened- The
RcppGSL-intro.Rnwvignette was updated for its look and feel.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
A brand new and shiny version of rfoaas is now on CRAN. The rfoaas package provides an interface for R to the most excellent FOAAS service--which provides a modern, scalable and RESTful web service for the frequent need to tell someone to f$#@ off.
There are two (internal) changes of merit in this version. First off, as FOAAS was refactored upstream, we are now forced to supply an accept: text/plain http request header. Which, sadly enough, is not something the url() function in R can do---so we brought in more cavalry and now depend on the httr package by Hadley, and use its GET() method. A second change is that we added a (simple but effective enough) regression test which simply calls all foaas entry points available throug rfoaas, and compares this to the anticipated result. To run it, you need to set an environment variable RunFOAASTests=yes as eg out Travis script does. Finally, we aligned the version number with upstream to signal that we cover all available entry points of that version.
As usual, CRANberries provides a diff to the previous release. Questions, comments etc should go to the GitHub issue tracker.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
There was a regression in Linux 3.2.65, which unfortunately was
included in this weekend's Debian stable point release (7.8) as I
didn't point out the
bug
reports to the stable
release team. At least some systems are now failing to resume after
suspending to RAM; instead they reboot.
I have tracked down the change that caused this, and it should be
fixed as part of a security update soon. The change is in code
specific to 64-bit x86 (i.e. the Debian amd64 architecture). If you
need suspend/resume to work, you might wish to avoid upgrading the
linux-image-3.2.0-4-amd64 package until that future update.
Update: I have uploaded packages with the
problematic changes reverted to people.debian.org.
The version number is 3.2.65-1+deb7u1~test (lower than the next
security update will be). Mail
774436@bugs.debian.org
if this doesn't work for you.
Time for another update on my work
for UEFI
improvements in Jessie!
I've spent more time on the integration of 32-bit grub-efi with a
64-bit Debian system, and just published a new test image on
pettersson. I've added:
A maintenance release of RcppClassic, now at version 0.9.6, went out to CRAN today. This package provides a maintained version of the otherwise deprecated first Rcpp API; no new projects should use it.
No changes were in user-facing code. The Makevars file was change to accomodate a request by the CRAN Maintainer to keep it free of GNU Make extensions. At the same time, we overhauled the look and feel of the (very short) vignette. Build instructions were updated both in the vignette and in the included example package. Other accumulated changes since the last release were updates to the DESCRIPTION and NAMESPACE file as well two namespace-related R code updates.
Courtesy of CRANberries, there is the set of changes relative to the previous release.
Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
First sequel to my Link Pack series (I ll remove the quotes when it s LP#05): Link Pack #01.
This time I m going for fewer articles, to try to keep things less overwhelming. There s no special theme, and I m actually leaving out some nice things I read recently. On the plus side, that means I have good material for a Link Pack #03.
Also, I m gonna stick with Link Pack as a name, because it s good enough :-).
Bottom Line: The low-fat, high-carb diet recommended by the mainstream nutrition organizations is a miserable failure and has been repeatedly proven to be ineffective. ( ) Bottom Line: Low-carb diets are the easiest, healthiest and most effective way to lose weight and reverse metabolic disease. It is pretty much a scientific fact at this point.GM s hit and run: How a lawyer, mechanic, and engineer blew open the worst auto scandal in history
Countless articles have been written about General Motors and its massive recalls earlier this year. What hasn t been fully told is how GM might have gotten away with multiple counts of consumercide were it not for the efforts of three men: a Georgia lawyer, a Mississippi mechanic, and a Florida engineer. ( ) Brooke Melton needn t have died that night. She was killed by a corporation s callous disregard for the safety of its customers, made worse by a regulatory agency reluctant to regulate.The Long Game: Part 1 and The Long Game: Part 2
A new release of my random package for truly (hardware-based) random numbers as provided by random.org is now on CRAN.
The main change is a switch to the curl() function from the eponymous package by Jeroen Ooms. This was caused by random.org now using https instead of http, annd the fact that te url() function from R does not cope well with the redirect. Besides this (enforced) change, everything else remains the same.
Courtesy of CRANberries comes a diffstat report for this release. Current and previous releases are available here as well as on CRAN.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
All I want for 2015 is a Free/Open Source Software social network which is:
Every few days, someone publishes a new guide, tutorial, library or framework about web scraping, the practice of extracting information from websites where an API is either not provided or is otherwise incomplete.
However, I find these resources fundamentally deceptive the arduous parts of "real world" scraping simply aren't in the parsing and extraction of data from the target page, the typical focus of these articles.
The difficulties are invariably in "post-processing"; working around incomplete data on the page, handling errors gracefully and retrying in some (but not all) situations, keeping on top of layout/URL/data changes to the target site, not hitting your target site too often, logging into the target site if necessary and rotating credentials and IP addresses, respecting robots.txt, target site being utterly braindead, keeping users meaningfully informed of scraping progress if they are waiting of it, target site adding and removing data resulting in a null-leaning database schema, sane parallelisation in the presence of prioritisation of important requests, difficulties in monitoring a scraping system due to its implicitly non-deterministic nature, and general problems associated with long-running background processes in web stacks.
Et cetera.
In other words, extracting the right text on the page is the easiest and trivial part by far, with little practical difference between an admittedly cute jQuery-esque parsing library or even just using a blunt regular expression.
It would be quixotic to simply retort that sites should provide "proper" APIs but I would love to see more attempts at solutions that go beyond the superficial.
A new release of the RcppCNPy package is now on CRAN.
This release mostly solidifies and fixes things. Support for saving integer objects, which was expanded in release 0.2.3, was not entirely correct. Operations on big-endian systems were not up to snuff either.
Wush Wu helped in getting this right with very diligent testing and patching particularly on big-endian hardware. We also got a pull request from Romain to reflect better const correctness at the Rcpp side of things. Last but not least we obliged by the CRAN Maintainers to not assume one could call gzip from system() call because, well, you guessed it.
Changes in version 0.2.4 (2015-01-05)CRANberries also provides a diffstat report for the latest release. As always, feedback is welcome and the rcpp-devel mailing list off the R-Forge page for Rcpp is may be the best place to start a discussion. GitHub issue tickets are also welcome.
- Support for saving integer objects was not correct and has been fixed.
- Support for loading and saving on 'big endian' systems was incomplete, has been greatly expanded and corrected, thanks in large part to very diligent testing as well as patching by Wush Wu.
- The implementation now uses const iterators, thanks to a pull request by Romain Francois.
- The vignette no longer assumes that one can call
gzipviasystemas the world's leading consumer OS may disagree.
This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings.
My LTS December
In December 2014 I spent 11h on Debian LTS work and managed to get six DLAs released and another one almost done... I did:

Next.