[R-pkg-devel] creating indelible file during unit test

Iñaki Úcar i.ucar86 at gmail.com
Tue Dec 12 18:36:07 CET 2017


2017-12-12 15:47 GMT+01:00 Barry Rowlingson <b.rowlingson at lancaster.ac.uk>:
> I think unix makes it impossible for you to create something that even you
> can't delete. You may need higher powers ("root") to change the ownership
> of the thing you've created.

In a Unix system with administrator rights, you can set the immutable flag:

$ touch foo
$ chmod a-w foo
$ sudo chattr +i foo
$ rm foo
Operation not permitted

Otherwise, you can always remove your own files. Moreover, Thierry may
want the test to be cross-platform... So I think the easiest way to go
is to bypass the R function used to remove the files (file.remove,
unlink, whatever), run the test and then restore it.

Iñaki



More information about the R-package-devel mailing list