This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mv implemented as cp?!?!?!!? - problem!!


This brings up an interesting issue.  I'm not sure where the problem
lies, or who is responsible for which piece but I will try to describe this
as cohesively and clearly as I can.  

On my win2K box using FAT32, I have a perl script that does the following:
create a temp directory - foo
does a tar extract of  tarballname into foo/tarballname
rename foo/tarballname tarballname    
rmdir foo

Now, it appears that if the directory structure under tarballname is
sufficiently large, the rename command is not actually completed 
before control is returned to the perl script, and rmdir foo is invoked.
This causes rmdir foo to fail with a Permission Denied error.  However,
after the script runs, foo is empty.  And if I place a sleep(1) between
the rename foo... and rmdir foo, the script completes successfully.

Thinking about this as I write it, it seems to me that whatever is happening
in the rename() perl command, it is not being handled as an atomic unit,
and control is returning to the perl script before the system has actually
completed the rename operation.

Is there some system switch that controls when/how control is returned
in these types of scenarios, as adding random sleeps is neither precise
enough, nor is it even preferred?



On Wed, 12 Sep 2001 21:24:39 -0400, Matthew O. Persico wrote:

>"Gerrit P. Haase" wrote:
>> 
>> Matthew O. Persico schrieb am 2001-09-12, 18:52:
>> 
>> >I have a /usr/X11R6 directory that I wanted to get out of the way. So I
>> >renamed it like this:
>> >
>> >cd /usr
>> >mv X11R6 X11R6.XFree.4.1.0
>> >
>> >It is taking multiple minutes. Looking at it in Windows Explorer, I see
>> >both X11R6 and X11R6.XFree.4.1.0 in existance at the same time.
>> >
>> >Is mv implemented as cp and del?!?!. Why not just rename the file, a'la
>> >UNIX, or even Windows? Or am I really missing something?
>> 
>> It works as you would expect, but only if there is no file opened in the
>> dir you want to rename.
>> You can try this.
>> Create a dir and fill it up.
>> Make sure that there is no file opened and you're not looking in any
>> subdirectory with explorer or another shell window.
>> Then rename it.
>
>Wow. Who knew? Obviously not me. I have to see how UNIX (solaris 2.6 in
>partcular) behaves when I get back to work tomorrow.
>
>-- 
>Matthew O. Persico
>New York City - we're still here.
>
>--
>Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>Bug reporting:         http://cygwin.com/bugs.html
>Documentation:         http://cygwin.com/docs.html
>FAQ:                   http://cygwin.com/faq/




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]