Skip to content
Back to formatted view

Raw Message

Message-ID: <CALEXWq0WoJ-0R=H1UjFnWAgwrpHp8hsOr441c3iG_sHCLuudtQ@mail.gmail.com>
Date: 2017-12-12T17:36:07Z
From: IƱaki Ucar
Subject: [R-pkg-devel] creating indelible file during unit test
In-Reply-To: <CANVKczN_7ap0KO--HHJr+UJZ98O4vosRtS2DQq46LrTgc=jdNg@mail.gmail.com>

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