<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/bh-1-69-0-0-pre-releases-and-three-required-changes/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://dirk.eddelbuettel.com/blog/2018/12/19#bh_1.69.0-0_prerelease"> Thinking inside the box </a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Our <a rel="nofollow" href="http://dirk.eddelbuettel.com/code/bh.html" target="_blank">BH</a> package provides a sizeable portion of the <a rel="nofollow" href="http://www.boost.org/" target="_blank">Boost</a> C++ libraries as a set of template headers for use by <a rel="nofollow" href="http://www.r-project.org/" target="_blank">R</a>. It is quite popular, and frequently used together with <a rel="nofollow" href="http://dirk.eddelbuettel.com/code/rcpp.html" target="_blank">Rcpp</a>. The <a rel="nofollow" href="https://cran.r-project.org/package=BH" target="_blank">BH CRAN page</a> shows <em>e.g.</em> that it is used by <a rel="nofollow" href="https://cran.r-project.org/package=rstan" target="_blank">rstan</a>, <a rel="nofollow" href="https://cran.r-project.org/package=dplyr" target="_blank">dplyr</a> as well as a few other packages. The current count of reverse dependencies is at 159.</p>
<p><a rel="nofollow" href="http://www.boost.org/" target="_blank">Boost</a> releases every four months. The last release we packaged was 1.66 from February—and a new Boost 1.69 just came out. So I packaged it, being somewhat careful as usual as CRAN insists on suppressing compiler diagnostics <code>#pragma</code> statements and a few other things, see the <a rel="nofollow" href="https://github.com/eddelbuettel/bh/" target="_blank">BH GitHub repo</a> for details.</p>
<p>Given the rather ginormous footprint of <a rel="nofollow" href="http://dirk.eddelbuettel.com/code/bh.html" target="_blank">BH</a> — in this release about 154mb installed — I am proceeding carefully as usual. I started with two full reverse-depends checks on the weekend which lead to three regressions for which I will contact the two corresponding maintainers (as it affects me for the third package). Details follow. In short, we should be in good shape to release in due course. Details are below on how to access the package now for testing and local use.</p>
<h3>Upgrading BH on CRAN from 1.66 to 1.69</h3>
<p>We ran two initial reverse-dependency checks, with results pushed to the <a rel="nofollow" href="https://github.com/RcppCore/rcpp-logs" target="_blank">usual repo</a>. The finally summary is <a rel="nofollow" href="https://github.com/RcppCore/rcpp-logs/blob/master/results/bh/BH-Summary-20181216-2.txt" target="_blank">in this file</a> with the moneyline being</p>
<blockquote>
<p>141 successes, 10 failures, and 8 skipped packages.</p>
</blockquote>
<p>Of the 10 failures, four are due to missing depends or suggests: these packages passed once installed. Of the remaining six, three are recurring issues we also have with <em>e.g.</em> Rcpp. That leaves three new regressions, or as CRAN calls it, ‘change to worse’. We also verified that these packages do indeed pass with the CRAN version of BH, <em>i.e</em>, 1.66.</p>
<p>What follows is a short discussion of each respective package.</p>
<h3>First regression: phonics</h3>
<p>The package uses</p>
<div>
<pre><code><a data-line-number="1"><span>using</span> <span>namespace</span> Rcpp;</a>
<a data-line-number="2"><span>using</span> <span>namespace</span> boost;</a>
<a data-line-number="3"><span>using</span> <span>namespace</span> std;</a></code></pre>
</div>
<p>which flattens namespaces—and with Boost 1.69 now gets a collision as <code>distance()</code> is no longer unique. Simply prefixing the four or five occurrances with <code>std::</code> fixes it. The complete (and very short) patch follows.</p>
<div>
<pre><code><a data-line-number="1"><span>diff -ru phonics.orig/src/metaphone.cpp phonics/src/metaphone.cpp</span></a>
<a data-line-number="2"><span>--- phonics.orig/src/metaphone.cpp 2018-08-16 19:05:22.000000000 +0000</span></a>
<a data-line-number="3"><span>+++ phonics/src/metaphone.cpp 2018-12-20 03:31:06.325881441 +0000</span></a>
<a data-line-number="4"><span>@@ -151,13 +151,13 @@</span></a>
<a data-line-number="5"> break;</a>
<a data-line-number="6"> case 'G':</a>
<a data-line-number="7"> if (nc == 'H') {</a>
<a data-line-number="8"><span>- if(!(is(&quot;BDH&quot;, at(word, distance(word.begin(), i) - 3)) ||</span></a>
<a data-line-number="9"><span>- at(word, distance(word.begin(), i) - 4) == 'H')) {</span></a>
<a data-line-number="10"><span>+ if(!(is(&quot;BDH&quot;, at(word, std::distance(word.begin(), i) - 3)) ||</span></a>
<a data-line-number="11"><span>+ at(word, std::distance(word.begin(), i) - 4) == 'H')) {</span></a>
<a data-line-number="12"> meta += 'F';</a>
<a data-line-number="13"> i++;</a>
<a data-line-number="14"> }</a>
<a data-line-number="15"> } else if(nc == 'N') {</a>
<a data-line-number="16"><span>- if (is(alpha, nnc) &amp;&amp; substr(word, distance(word.begin(), i) + 1, 3) != &quot;NED&quot;) {</span></a>
<a data-line-number="17"><span>+ if (is(alpha, nnc) &amp;&amp; substr(word, std::distance(word.begin(), i) + 1, 3) != &quot;NED&quot;) {</span></a>
<a data-line-number="18"> meta += 'K';</a>
<a data-line-number="19"> }</a>
<a data-line-number="20"> } else if(is(soft, nc) &amp;&amp; pc != 'G') {</a>
<a data-line-number="21"><span>@@ -187,7 +187,7 @@</span></a>
<a data-line-number="22"> } else if(nc == 'H') {</a>
<a data-line-number="23"> meta += 'X';</a>
<a data-line-number="24"> i += 1;</a>
<a data-line-number="25"><span>- } else if(!traditional &amp;&amp; substr(word, distance(word.begin(), i) + 1, 3) == &quot;CHW&quot;) {</span></a>
<a data-line-number="26"><span>+ } else if(!traditional &amp;&amp; substr(word, std::distance(word.begin(), i) + 1, 3) == &quot;CHW&quot;) {</span></a>
<a data-line-number="27"> meta += 'X';</a>
<a data-line-number="28"> i += 2;</a>
<a data-line-number="29"> } else {</a>
<a data-line-number="30"><span>@@ -200,7 +200,7 @@</span></a>
<a data-line-number="31"> } else if(nc == 'H') {</a>
<a data-line-number="32"> meta += '0';</a>
<a data-line-number="33"> i += 1;</a>
<a data-line-number="34"><span>- } else if(substr(word, distance(word.begin(), i) + 1, 2) != &quot;CH&quot;) {</span></a>
<a data-line-number="35"><span>+ } else if(substr(word, std::distance(word.begin(), i) + 1, 2) != &quot;CH&quot;) {</span></a>
<a data-line-number="36"> meta += 'T';</a>
<a data-line-number="37"> }</a>
<a data-line-number="38"> break;</a></code></pre>
</div>
<h3>Second regression: RcppStreams</h3>
<p>Here we end up with a linking error. The following symbol, expanded with <code>c++filt</code> is coming up as missing:</p>
<div>
<pre><code><a data-line-number="1">$ <span>c++filt</span> _ZN5boost5proto6detail17display_expr_implC1ERKS2_</a>
<a data-line-number="2"><span>boost</span>::proto::detail::display_expr_impl::display_expr_impl(boost::proto::detail::display_expr_impl const<span>&amp;</span>)</a>
<a data-line-number="3">$</a></code></pre>
</div>
<p>I am the upstream author/maintainer here. This looks somewhat tricky, but a quick commenting-out of an optional / verbose display call does the trick. So that is what we may end up doing.</p>
<h3>Third regression: TDA</h3>
<p>This generated <em>a lot</em> of messages with <code>error: ‘next’ is not a member of ‘boost’</code> when <code>boost::next(somevar)</code> was invoked. A quick Google search suggests that the declaration moved to another header file and that including <code>boost/next_prior.hpp</code> should fix it — and it does. One-line patch follows.</p>
<div>
<pre><code><a data-line-number="1"><span>diff -ru TDA.orig/src/diag.cpp TDA/src/diag.cpp</span></a>
<a data-line-number="2"><span>--- TDA.orig/src/diag.cpp 2018-08-06 00:09:20.000000000 +0000</span></a>
<a data-line-number="3"><span>+++ TDA/src/diag.cpp 2018-12-20 03:48:10.404143947 +0000</span></a>
<a data-line-number="4"><span>@@ -5,6 +5,8 @@</span></a>
<a data-line-number="5"> // for Rcpp</a>
<a data-line-number="6"> #include &lt;Rcpp.h></a>
<a data-line-number="7"></a>
<a data-line-number="8"><span>+#include </span></a></code></pre></div>