[R-pkg-devel] Formatting .Rbuildignore

William Dunlap wdun|@p @end|ng |rom t|bco@com
Mon Aug 17 20:12:47 CEST 2020


I just tried this out with R-4.0.2 on Linux and it looks like
.Rbuildignore does not treat lines with '#'s as comments.  E.g.,

% mkdir test test/inst
% touch 'test/inst/#octothorp.txt' 'test/inst/normal.txt'
% echo > test/DESCRIPTION 'Package: test\nVersion: 0.1\nTitle:
test\nDescription: A test of .Rbuildignore'
% touch test/NAMESPACE
% R CMD build test > /dev/null

% tar ztf test_0.1.tar.gz | grep '\.txt$'
test/inst/#octothorp.txt
test/inst/normal.txt
% echo '#.*[.]txt' > test/.Rbuildignore
% R CMD build test > /dev/null

% tar ztf test_0.1.tar.gz | grep '\.txt$'
test/inst/normal.txt

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Aug 17, 2020 at 9:47 AM Ivan Krylov <krylov.r00t using gmail.com> wrote:
>
> On Mon, 17 Aug 2020 15:56:07 +0200
> Thierry Onkelinx <thierry.onkelinx using inbo.be> wrote:
>
> > Can we add blank lines in .Rbuildignore? Or lines with only comments
> > (line starting with #)?
>
> .Rbuildignore is not documented [1] to allow comments, but the
> current implementation does skip empty lines [2] since 2010 [3]
> (otherwise empty regular expressions would match all file names).
>
> It could be possible to get away with comment lines, since the
> resulting regular expressions are unlikely to ever match anything, but
> it would cost CPU cycles to match every file name against every
> regular expression, and some regular expressions may turn out to be
> really expensive on some inputs [4].
>
> I think that it's best not to try to add comments to .Rbuildignore, and
> to avoid blank lines unless not having them becomes really inconvenient.
>
> --
> Best regards,
> Ivan
>
> [1]
> https://cran.r-project.org/doc/manuals/R-exts.html#Building-package-tarballs
>
> [2]
> https://github.com/wch/r-source/blob/9d13622f41cfa0f36db2595bd6a5bf93e2010e21/src/library/tools/R/build.R#L85
>
> [3]
> https://github.com/wch/r-source/commit/b2065b2c36235b876977e405f567afec6ab644b3
>
> [4] https://en.wikipedia.org/wiki/ReDoS
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list