[#7055] More on VC++ 2005 — Austin Ziegler <halostatue@...>

Okay. I've got Ruby compiling. I'm attempting to get everything in

17 messages 2006/01/05
[#7058] Re: More on VC++ 2005 — nobuyoshi nakada <nobuyoshi.nakada@...> 2006/01/06

Hi,

[#7084] mathn: ugly warnings — hadmut@... (Hadmut Danisch)

Hi,

22 messages 2006/01/10
[#7097] Re: mathn: ugly warnings — Daniel Berger <Daniel.Berger@...> 2006/01/10

Hadmut Danisch wrote:

[#7098] Design contracts and refactoring (was Re: mathn: ugly warnings) — mathew <meta@...> 2006/01/10

Daniel Berger wrote:

[#7118] Re: Design contracts and refactoring (was Re: mathn: ugly warnings) — mathew <meta@...> 2006/01/12

*Dean Wampler *<deanwampler gmail.com> writes:

[#7226] Fwd: Re: Question about massive API changes — "Sean E. Russell" <ser@...>

Hello,

23 messages 2006/01/28
[#7228] Re: Question about massive API changes — Caleb Tennis <caleb@...> 2006/01/28

>

Re: FileUtils.mv does not unlink source file when moving over filesystem boundary

From: ara.t.howard@...
Date: 2006-01-16 19:39:08 UTC
List: ruby-core #7168
On Tue, 17 Jan 2006, Jacob Fugal wrote:

> On 1/16/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
>> to emulate mv with copy really is shocking.
>
> Am I mistaken, or isn't that how the OS handles move across filesystem
> boundaries anyways? You'll notice this chunk of code (copy_entry,
> unlink) only happens in the rescue block for Errno::EXDEV.

if you mean that programs like 'mv' work this way then you are quite right.
afaik my os (linux) does not support a move (rename) across an fs boundary.
but this isn't an OS call - it's a method in a high level language.

>> at minimum this code should do something like
>>
>>    def transfer_entry s, d, hidden = true, ext = "tmp"
>>      dirname, basename = File.split d
>>      tmp = File.join dirname, "#{ '.' if hidden }#{ basename }.#{ ext }"
>>      copy_entry s, tmp, true
>>      File.rename tmp, d
>>    end
>>
>>      rescue Errno::EXDEV
>>        transfer_entry s, d
>>        File.unlink s
>>      end
>
> I don't see how this is significantly different. What's the point of
> copying to a tmp file and then renaming the tmp file versus just
> copying directly to the destination?

for applications reading files from the destination dir is is very different!  ;-)

consider

   process a:  mv src dst
   process b: cat dst

these two behave very very differently if the 'mv' is really a copy.

if you ask 100 programmers if 'mv' is atomic they will say yes - even though
it is not across fs boundaries, onto nfs, etc.  i've seen many, many errors
caused by this.  it would be nice if something high level like ruby provided
an abstraction that made the copy seem atomic to openers/readers of the
destination dir.

maybe this is too high level for file-utils, but it's my impression that this
is a high level module - otherwise one would simply use

   File.rename 'src', 'dst' rescue File.copy 'src', 'dst'

i think people expect something value added by doing a

   require 'fileutils'

kind regards.

-a
-- 
strong and healthy, who thinks of sickness until it strikes like lightning?
preoccupied with the world, who thinks of death, until it arrives like
thunder?  -- milarepa


In This Thread

Prev Next