delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/18/05:55:14

Message-Id: <200505180955.j4I9t6aN003852@delorie.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Gary R. Van Sickle" <g DOT r DOT vansickle AT worldnet DOT att DOT net>
To: <cygwin AT cygwin DOT com>
Subject: RE: Mv after tar in a shell script problems
Date: Wed, 18 May 2005 04:57:05 -0500
MIME-Version: 1.0
In-Reply-To: <428B0B51.CB8FB8A@dessent.net>
X-IsSubscribed: yes

> -----Original Message-----
> From: cygwin-owner AT cygwin DOT com 
> [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Brian Dessent
> Sent: Wednesday, May 18, 2005 4:31 AM
> To: cygwin AT cygwin DOT com
> Subject: Re: Mv after tar in a shell script problems
> 
> "Gary R. Van Sickle" wrote:
> 
> > ...and, if I change the mv to a loop which keeps trying if there's a
> > failure:
> > 
> >   while ! mv dir_name_file.tar.bz2_untars_to new_dir_name; do echo 
> > "retrying move..."; done
> > 
> > it will eventually work after a few iterations.
> > 
> > I... huh?
> > 
> > I'll brew up a test case, this is nutso.
> 
> The only thing I can think of is that tar exits immediately 
> after issuing the final write() of the last file, and mv 
> starts up before the file system has a chance to finish 
> commiting that write to disk.
> 

That's almost what it's acting like.  Well, sort of [see next].

> The question would then be, does the filesystem allow close() 
> to complete even if there is still outstanding IO.  Maybe it 
> has to do with write caching of the drive.

None of that should matter.  Once a file is close()ed (and certainly once
the close()ing program has terminated!), it's committed to the filesystem.
Where the filesystem puts the actual data and when is of no concern at the
open()/close() level.  In fact I'm certain the filesystem (whether NTFS or
FAT) *does* return from CloseHandle() potentially before anything gets
written to the physical medium.  But the filesystem knows (or should know)
about any files pending writing and act accordingly, i.e. allow the same
access to them as any other file, perhaps by blocking until it gets written
or whatever.

Unless tar is doing something like untarring to a temp directory and then
doing a shell-api move that it doesn't wait for.  I don't know.  I'll get a
test case together and... well, I'm sure then the problem will mysteriously
vanish. ;-)

-- 
Gary R. Van Sickle


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019