[CMake] Problem and proposed solution with cmake -E rename across devices
Michael Wild
themiwi at gmail.com
Thu Sep 1 00:29:25 EDT 2011
On Wed 31 Aug 2011 11:26:19 PM CEST, David Cole wrote:
> On Wed, Aug 31, 2011 at 5:12 PM, Clinton Stimpson <clinton at elemtech.com> wrote:
>> On Wednesday, August 31, 2011 10:30:22 am David Cole wrote:
>>> On Wed, Aug 31, 2011 at 11:49 AM, David Cole <david.cole at kitware.com> wrote:
>>>> The cmake -E rename command is documented to work only when src and
>>>> dst are on the same volume:
>>>>
>>>> If you run "cmake -E" with no other args, the rename command is
>>>> documented as:
>>>>
>>>> rename oldname newname - rename a file or directory (on one volume)
>>>>
>>>> I think doing a copy as a fallback is a reasonable thing, but I think
>>>> it's on your side of the fence. CMake properly returns an error and
>>>> tells you "can't do that rename operation" and then it should be uo to
>>>> you to make a copy if that's what you want.
>>>>
>>>> Others may want to do something else if rename cannot be done. I don't
>>>> think we should add code that says CMake will do a copy if rename
>>>> fails...
>>>>
>>>> On Tue, Aug 30, 2011 at 3:21 PM, Clifford Yapp <cliffyapp at gmail.com> wrote:
>>>>> We've run into an issue with cmake -E rename where the rename fails
>>>>> due to rename() throwing EXDEV when done between devices (different
>>>>> partitions, nfs to local, etc). Erik Greenwald has investigated and
>>>>> has proposed a fix to allow cmake -E rename to succeed across devices
>>>>> - if possible we'd like to get this or some related fix included,
>>>>> since this is a real-world build environment situation for us:
>>>>>
>>>>> http://public.kitware.com/Bug/view.php?id=12433
>>>>>
>>>>> Cheers, and thanks!
>>>>>
>>>>> CY
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>> Furthermore:
>>>
>>> Additionally, "cmake -E rename" is supposed to be guaranteed to be
>>> "atomic" -- adding this code makes it "mostly atomic" and would negate
>>> the intent of some significant callers of rename...
>>>
>>> Thx,
>>> David
>>
>> What about adding something like "cmake -E move" which could be used to rename
>> files but also support moving between devices?
>>
>> --
>> Clinton Stimpson
>> Elemental Technologies, Inc
>> Computational Simulation Software, LLC
>> www.csimsoft.com
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
> I'm ok with an additional cmake -E command being invented that means
> "rename if you can, copy if you can't" but I think "move" and "mv" are
> largely synonyms for rename in terms of people's conceptual mental
> space as it relates to file system operations....
>
> So I'd prefer a name like "rename_or_copy" and/or
> "rename_or_copy_and_delete" -- even though it's more verbose, it's
> clearer what the difference is to the normal "rename".
>
> Thx,
> David
Not if you've ever read rename(2) and mv(1) ;-) Honestly, most people
would expect "cmake -E rename" to behave like mv(1), not like
rename(2). OTOH, if you look at the source code of mv [1, 2], getting
it right seems to be quite involved...
Michael
[1] http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/mv.c
[2] http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/copy.c
More information about the CMake
mailing list