Subject: bug#15926: RFE: unlink command already uses 'unlink' call; make 'rm' use 'remove' call

From: Bob Proulx <[email-masked]>
Date: Fri, 22 Nov 2013 10:39:22 -0700

Eric Blake wrote:
> Bernhard Voelker wrote:
> > Eric Blake wrote:
> >> Just noticing this context...
> >>>   # This test is too dangerous -- if there's a bug you're wiped out!
> >>>   # rm -fr / 2>/dev/null && fail=1
> >>
> >> What if we use chroot to create a safer /, where failing the test would
> >> only wipe out the chroot?
> > 
> > That's not that easy.

I think that it would be too complicated to be desired in the test suite.

> > Alternatively, that test could be secured by "skip_if_root_"
> > plus intercepting the unlinkat() call via LD_PRELOAD.
> 
> Indeed, LD_PRELOAD is great for this - since the test passes when no
> unlink/rmdir occurs, you just make the intercepts fail loudly if they
> are invoked.

Please make sure that if the LD_PRELOAD functionality fails that this
test is not run.  Since it would be a live fire exercise and if
LD_PRELOAD doesn't function then the test would wipe the system out.
I don't think it is worth the risk for this piece of functionality.

Bob