[CMake] Problem and proposed solution with cmake -E rename across devices

David Cole david.cole at kitware.com
Wed Aug 31 17:26:19 EDT 2011


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


More information about the CMake mailing list