[PATCH] New fstest to check rename POSIX conformance
Andre Marques
andre.lousa.marques at gmail.com
Tue Feb 11 10:05:32 UTC 2014
On 02/11/14 01:07, Nick Withers wrote:
> On Sat, 2014-02-08 at 12:26 +0000, Andre Marques wrote:
>> Hi,
>>
>> As discussed in [1], I created a new fstest to check the rename()
>> implementation against the POSIX specification [2].
>>
>> What the attached patch does not test:
>>
>> - Testing the existance of a link visible to other processes during the
>> rename process (ensuring that there is always a reference to the file).
>> Not sure about the best way to test this.
>>
>> - Testing that after all processes close their references to a file
>> after it was removed by rename() the file contents are removed (or
>> marked as free space, I guess). I only found platform dependent ways of
>> dealing with disk block's.
> I don't believe that rename() should lead to removal of file disk blocks
> (at least with a rename() on the same file-system, which seems to be all
> that POSIX requires be supported (see, e.g., the description of the
> EXDEV error case... though I do think it's ambiguous) and all RTEMS
> allows at present), since it's just changing the file name that links to
> that data.
If the new filename already exists in the same directory, the one
already there is deleted before the actual renaming.
Rename also works as the mv command, because it uses filepath's instead
of filenames, so when renaming file "a" with another file "b" on another
directory, "b" is replaced with "a" (now called "b"), and the original
location of "a" is removed.
About the disk block's, POSIX states that when removing a file:
"the space occupied by the file shall be freed"
, which can mean to mark that space as free space (not actually
"zeroing" those disk blocks).
>
>> - Testing errno values in error situations. There is already a fstest
>> named fserror which purpose seems to be checking errno values for a
>> bunch of functions (rename included, but with some errno values
>> missing). Not sure if I should put them in this test or add to fserror.
>>
>>
>> This test uses the MOUNTED IMFS filesystem, for no particular reason, so
>> if that's an issue please let me know.
>>
>> [1] - http://www.rtems.org/pipermail/rtems-users/2014-January/012378.html
>>
>> [2] - http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
>>
>> --Andr? Marques
More information about the devel
mailing list