[Rd] Minor configure bug in R 2.7.1-rc

Dirk Eddelbuettel edd at debian.org
Sat Jun 21 19:04:28 CEST 2008


Updating the Debian package to the current 2.7.1 rc, I noticed that R decides
to use its own bzip2 sources.  Looking at configure, I see the test is
essentially a strcmp on '1.0.5' from the version-returning function:
 
   #ifdef HAVE_BZLIB_H
   #include <bzlib.h>
   #endif
   int main() {
      char *ver = BZ2_bzlibVersion();
      exit(strcmp(ver, "1.0.5") < 0);
   }

but unfortunately, bzip2 returns a different string that includes the date:

   edd at ron:~/src/debian/R/R-2.7.1.20080621> cat /tmp/bzver.c
   #include <bzlib.h>
   #include <string.h>
   int main() {
       const char *ver = BZ2_bzlibVersion();
       printf("[%s] strcmp: %d strncmp(5): %d\n", ver, strcmp(ver, "1.0.5"), strncmp(ver, "1.0.5", 5));
       return 0;
   }
   edd at ron:~/src/debian/R/R-2.7.1.20080621> gcc -Wall -O2 -o /tmp/bzver  /tmp/bzver.c -lbz2
   edd at ron:~/src/debian/R/R-2.7.1.20080621> /tmp/bzver
   [1.0.5, 10-Dec-2007] strcmp: 1 strncmp(5): 0

Switching to strnmp with a limit of 5 'fixes' the issue but it probably too
fragile to be generally recommended.  

Dirk   


-- 
Three out of two people have difficulties with fractions.



More information about the R-devel mailing list