monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] nvm.alt_tmpdir


From: Nathaniel Smith
Subject: Re: [Monotone-devel] nvm.alt_tmpdir
Date: Mon, 16 May 2011 15:15:24 -0700

On Mon, May 16, 2011 at 2:59 PM, Stephen Leake
<address@hidden> wrote:
> Stephen Leake <address@hidden> writes:
>
>> Nathaniel Smith <address@hidden> writes:
>>
>>> On Mon, May 16, 2011 at 1:23 PM, Stephen Leake
>>> <address@hidden> wrote:
>>>>    Note that 'mv' between two drives succeeds on Windows
>>>
>>> Wouldn't it be easier to just enhance the POSIX move-this-file
>>> function so that it checks if they're on the same filesystem (you can
>>> get this from stat(2)), and then either calls rename(2) or does a
>>> copy+unlink?
>>
>> Hmm.
>>
>> Yes, that would be easier.
>
> The issue of how to write a test for it is still relevant.

One could write reasonable tests of the "rename this file", "copy this
file and then delete the original", and "are these two files on the
same filesystem?" routines (this last is the trickiest, but any linux
system will have a separate filesystem stat-able at '/proc', and that
already gets you a fair amount of coverage; if there's something
similar on OS X and maybe Solaris then that covers most systems of
interest).

Then the actual move-or-copy routine would be 3 lines of
obviously-correct code, so testing it isn't as important.

-- Nathaniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]