bug#15926: RFE: unlink command already uses 'unlink' call; make 'rm' use
From:
Bernhard Voelker
Subject:
bug#15926: RFE: unlink command already uses 'unlink' call; make 'rm' use 'remove' call
Date:
Wed, 27 Nov 2013 00:08:08 +0100
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5
On 11/25/2013 08:31 AM, Bernhard Voelker wrote:
> On 11/25/2013 02:10 AM, PƔdraig Brady wrote:
>> So this might race with rm being preempted between the touch() and the
>> exit(),
>> causing a false failure? It's probably best to not kill if the 'x' file
>> exists,
>> as it's very unlikely that rm will run as normal in that case.
>
> outch, the race is even more likely for the newly added "rm -r file1 / file2"
> case where unlinkat() is called twice without the immediate _exit() due to
> CU_TEST_SKIP_EXIT=1.
>
> I have to reconsider, but won't have time for that today.
Hi Padraig,
I simplified it by using timeout(1), as you already suggested:
if [ "$CU_TEST_SKIP_EXIT" = 1 ]; then
# Pass on this variable into 'rm's environment.
skip_exit='CU_TEST_SKIP_EXIT=1'
fi
timeout --signal=KILL 2 \
env LD_PRELOAD=./k.so $skip_exit \
rm -rv --one-file-system "$@" > out 2> err
I also changed the other things you mentioned.
Finally, I had to pass --interactive=never to the last test to
avoid the "descend into write-protected directory?" prompt.
This is since rm has been executed in the background.
Next try attached.
Have a nice day,
Berny