Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for CRAN release #369

Merged
merged 9 commits into from
Feb 7, 2025
Merged

Prepare for CRAN release #369

merged 9 commits into from
Feb 7, 2025

Conversation

zkamvar
Copy link
Collaborator

@zkamvar zkamvar commented Feb 5, 2025

No description provided.

@zkamvar zkamvar changed the title update changelog Prepare for CRAN release Feb 5, 2025
@zkamvar
Copy link
Collaborator Author

zkamvar commented Feb 5, 2025

I have attempted to verify this works by using Docker, but I am having trouble installing dartR.base:

> install.packages("dartR.base")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘poisbinom’, ‘SNPassoc’

trying URL 'http://cloud.r-project.org/src/contrib/poisbinom_1.0.1.tar.gz'
trying URL 'http://cloud.r-project.org/src/contrib/SNPassoc_2.1-2.tar.gz'
trying URL 'http://cloud.r-project.org/src/contrib/dartR.base_0.98.tar.gz'
* installing *source* package ‘poisbinom’ ...
** this is package ‘poisbinom’ version ‘1.0.1’
** package ‘poisbinom’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (Debian 14.2.0-16) 14.2.0’
using C++ compiler: ‘g++ (Debian 14.2.0-16) 14.2.0’
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2 -Wall -pedantic -mtune=native  -DR_NO_REMAP -c RcppExports.cpp -o RcppExports.o
gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-pointer -std=gnu11 -I"/usr/local/lib/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c init.c -o init.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2 -Wall -pedantic -mtune=native  -DR_NO_REMAP -c poisbinom.cpp -o poisbinom.o
poisbinom.cpp:3:10: fatal error: fftw3.h: No such file or directory
    3 | #include <fftw3.h>
      |          ^~~~~~~~~
compilation terminated.
make: *** [/usr/local/lib/R/etc/Makeconf:210: poisbinom.o] Error 1
ERROR: compilation failed for package ‘poisbinom’
* removing ‘/usr/local/lib/R/site-library/poisbinom’
ERROR: dependency ‘poisbinom’ is not available for package ‘SNPassoc’
Perhaps try a variation of:
install.packages('poisbinom')
* removing ‘/usr/local/lib/R/site-library/SNPassoc’
ERROR: dependency ‘SNPassoc’ is not available for package ‘dartR.base’
Perhaps try a variation of:
install.packages('SNPassoc')
* removing ‘/usr/local/lib/R/site-library/dartR.base’

The downloaded source packages are in
	‘/tmp/Rtmp2um7Lm/downloaded_packages’
Warning messages:
1: In install.packages("dartR.base") :
  installation of package ‘poisbinom’ had non-zero exit status
2: In install.packages("dartR.base") :
  installation of package ‘SNPassoc’ had non-zero exit status
3: In install.packages("dartR.base") :
  installation of package ‘dartR.base’ had non-zero exit status

This is the contents of the dockerfile I'm working with (which is modified from the one in this repository). Note that I know that I can use install2.r to speed up installation and I will likely do that on my next iteration, but for now, I am done for the night.

FROM rocker/r-devel-san

MAINTAINER Thibaut Jombart <[email protected]>

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y libcurl4-openssl-dev libssl-dev libfontconfig1-dev libxml2-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev gdal-bin proj-bin libgdal-dev libproj-dev libgmp3-dev jags

## add guest user

RUN adduser --disabled-password --gecos "" guest
RUN usermod -a -G users guest && usermod -a -G staff guest
RUN chmod a+rw /usr/local/lib/R/site-library -R



## install CRAN packages

# RUN echo 'options(download.file.method = "libcurl", repos = c(CRAN = "https://cran.ma.imperial.ac.uk"))' > ~/.Rprofile

RUN r -e "install.packages('devtools')" \
 && r -e "install.packages('adegenet', dependencies = TRUE)" \
 && r -e 'install.packages("BiocManager")' \
 && r -e 'BiocManager::install("SNPRelate")' \
 && r -e 'install.packages("dartR.base")'


## clone repos to get sources
RUN apt-get install -y git

RUN su guest
RUN mkdir ~/dev
WORKDIR /home/guest/dev

RUN git clone https://github.com/thibautjombart/adegenet

WORKDIR /home/guest/
CMD Rscript -e 'library(dartR.base); gl.pcoa(testset.gl)'

I also fixed some indentation issues.

This was prompted by a message I got from Ivan. I took his suggestion
and applied it to `bytesToInt()` and `bytesToDouble()`

Ivan Krylov

2:05 AM (14 hours ago)

to me
Dear Zhian,

Thank you for undertaking the fix on such a short notice! I'm afraid
there's still one reachable overflow.

Consider the case of an SNPbin object with nLoc(.) = 201 byte-packed
SNPs. They have to be stored in ceiling(201/8) = 26 bytes, with 7 last
bits used for padding.

Currently, the functions bytesToInt(), bytesToDouble() [*] always write
(*veclength)*8 entries into the destination vector. When nLoc(.) is not
divisible by 8, this will cause them to decode and write the padding
bytes past the end of 'vecres'. The original case caught by dartR.base
involves such an object (with nLoc(.) = 199).

I think that the overflow can be avoided by adding a check to the
innermost loop:

for(j=0;j<=7;j++){
 if (j+idres >= *reslength) break; // do not decode padding bytes
@zkamvar zkamvar linked an issue Feb 6, 2025 that may be closed by this pull request
@zkamvar
Copy link
Collaborator Author

zkamvar commented Feb 7, 2025

On cran now

@zkamvar zkamvar merged commit 9f24e97 into master Feb 7, 2025
5 of 7 checks passed
@zkamvar zkamvar deleted the release/2.1.11 branch February 7, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overflow with snpbin.c
1 participant