delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/10/16:02:50

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 10 Sep 2010 22:02:21 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: quick way to find out if a file is in use by windows?
Message-ID: <20100910200221.GJ16534@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20100910114653 DOT GA19315 AT onderneming10 DOT xs4all DOT nl> <20100910145619 DOT GA29101 AT calimero DOT vinschen DOT de> <20100910212215 DOT GA32507 AT onderneming10 DOT xs4all DOT nl>
MIME-Version: 1.0
In-Reply-To: <20100910212215.GA32507@onderneming10.xs4all.nl>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Sep 10 21:22, jurriaan AT rivierenland DOT xs4all DOT nl wrote:
> > mv does not timeout.  The underlying unlink function checks if the file
> > is in use and, if so, moves the file to the bin and sets the delete
> > disposition so it will be deleted after the last process closes its
> > handle to the file.  If this fails, unlink silently gives up.  The reason
> > for the hang must be something else.
> > 
> Thanks for replying.
> I straced both mv and rm. The rm strace is at the bottom, below here
> first the mv strace. It only seems to hang, but the strace is filling up
> quickly with lots of lines like this continuously:
> 
>    63   77448 [main] mv 14716 rename: status 0xC0000043
> 
> Is this a status mv should fail on, or is Windows incorrectly returning
> a status that means 'repeat and retry by all means' ?

Oops.  I mixed up mv and rm, so my babble about unlink was off the
point.  Of course mv calls the rename function and the rename function
in fact has a loop which retries to rename a file or dir if a sharing
violation occurs.  The original idea of the retry loop was to workaround
a problem with some BLODAs - virus scanners - which block newly
generated files against deletion(*) for a short period of time while
checking them.  This breaks some applications which copy files by
creating a temporary filename and then rename the temp filename to the
target filename.

However, the workaround was missing a break from the loop, if the
sharing violation persists.  I fixed that in CVS.


Thanks,
Corinna


(*) On Windows a user needs delete permissions to rename a file.

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

- Raw text -


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