On Nov 1, 2008, at 7:12 PM, Eric Van Hensbergen wrote:
On Sat, Nov 1, 2008 at 4:05 PM, Roman Shaposhnik <[EMAIL PROTECTED]> wrote:
On Nov 1, 2008, at 8:04 AM, Eric Van Hensbergen wrote:

I would imagine that 99% of the time (more?) the behavior people
desire would be what you describe.

But what is the behavior? Is it literally the above set of rc commands?
Or is there an atomicity expectation as well? After dircp dirA dirB
the contents of dirB could be surprising, especially given the later
rm -r dirA.

It seems that mv(1) was taken as far as one could go in terms
of having a non-surprising behavior: mv dir1/file  dir2/file is
equivalent to cp -x dir1/file dir2/file ; rm dir1/file.


Well, I suppose there'd have to be a bit more wrapping around checking
for failure of the copy before the erase -- but otherwise perhaps I'm
being dense and don't see the surprise.

Well, it could be that I'm just too easily surprised. I'll try to explain. Suppose that you have the following sequence of directory renames (all within the single FS
tree):
(1)     /a          ->    /b
(2)     /a/1       ->    /a/2

Because of the POSIX atomicity guarantee the minute you have (1) succeed
your (2) will fail because /a/1 no longer exists. The following, on the other
hand:
  (1)  mv-dircp /a     /b
  (2)  mv-dircp /a/1 /a/2
is likely to produce /b/2, which, I find surprising. As a side note: the results
are even more surprising/subtle when renames need to be serialized
in a DSCM. There's been quite a few debates on what DSCM does it
better. Just like Al said -- somebody at UCB had one heck of a trip ;-)

Its clear you won't get the
atomicity, but there's no clear way to obtain that -- and, as I said,
I'm not sure who depends on that when using the mv command.


I would argue that personally I've been conditioned by POSIX to
be able to do:
    $ mv <root of the huge file hierarchy>  .hidden-from-everybody
and expect all references to anything in the original file hierarchy
to fail from that point on.

Thanks,
Roman.

Reply via email to