[R-pkg-devel] Issue with non-standard file 'vert.txt' in R CMD check

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Tue Jan 28 19:18:10 CET 2025


Dear Zahra Heidari Ghahfarrokhi,

Welcome to R-package-devel!

В Tue, 28 Jan 2025 18:17:06 +0330
zahra heidari gh <z.heidari.gh using gmail.com> пишет:

>    - Additional details:
>       - The package FD is used during package building.
>       - In a previous post on the r-help using r-project.org mailing list,
> I was advised that this error might be due to the use of the FD
> package.

Thank you for providing these additional details. My analysis still
stands; this is a bug in the 'FD' package:
https://stat.ethz.ch/pipermail/r-help/2024-November/480198.html
https://github.com/cran/FD/blob/1993781d8fa7e6f4107ebd3f52f919c6fe1760f7/R/dbFD.R#L685

This line of code has been there for 16 years and nobody else noticed
the problem. In order to get the bug fixed, you will need to contact
the maintainer (see the output of the maintainer("FD") command in R)
and ask them to change the code so that it only creates temporary files
in the session temporary directory and cleans up afterwards:
https://contributor.r-project.org/cran-cookbook/code_issues.html#writing-files-and-directories-to-the-home-filespace

There is one workaround you can use. Before calling the function from
the 'FD' package, change the current directory and clean everything up
yourself:

# this temporary directory will be for the FD package to leave files in
newdir <- tempfile('FDbug')
stopifnot(dir.create(newdir))
# make sure it disappears after we are done
on.exit(unlink(newdir, recursive = TRUE), add = TRUE)
# 'FD' creates files in current directory, so switch it
olddir <- setwd(newdir)
# make sure the current directory is restored after we are done
on.exit(setwd(olddir), add = TRUE)
# now call the function from the 'FD' package

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list