public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: untarring symlinks with ../ fails randomly, silghtly OT
Date: Mon, 04 Jul 2011 15:13:00 -0000	[thread overview]
Message-ID: <20110704151233.GB1457@calimero.vinschen.de> (raw)
In-Reply-To: <20110704142057.GA1457@calimero.vinschen.de>

On Jul  4 16:20, Corinna Vinschen wrote:
> On Jul  4 08:21, Ryan Johnson wrote:
> > However, I was wrong about not seeing the problem since. Choosing a
> > random source dir to blow away:
> > >$ rm -rf Python-2.6.6
> > >rm: cannot remove `Python-2.6.6/Lib/lib2to3/tests': Directory not empty
> > >$ rm -rf Python-2.6.6
> > >$
> > 
> > This seems to happen more than half the time (different non-empty
> > dir every time). Naturally, running under strace makes the problem
> > go away (it doesn't help that strace kills stderr, where any error
> > messages might have gone).
> > 
> > Running the following command 10x:
> > 
> > $ tar -xaf Python-2.6.6.tar.bz2 && sleep 3 && (rm -rf Python-2.6.6
> > || (echo 'Retrying...' && rm -rf Python-2.6.6))
> > 
> > I get six times with no error, two times with one error, one time
> > each with two and three errors.
> 
> I tried this(*) with Cygwin 1.7.9 as well as with the latest from CVS
> on 2K8R2 and it just works.  In a VM.

Btw., I would like to stress again that Cygwin does *not* lock files
it opens, except in very rare circumstances.  It always opens files
with all sharing flags set, except in these scenarios:

1. @file handling, file is opened w/ FILE_SHARE_READ only.

2. rename(): Omit FILE_SHARE_DELETE flag on Samba to avoid
   STATUS_ACCESS_DENIED if file has the DOS R/O attribute set.

3. unlink(): Tries to open with FILE_SHARE_DELETE only to check for
   files-in-use.  If that works, the file is deleted anyway.  If not,
   it retries to open with all sharing flags set.

4. On exit, if a DLL can't be found, the executable is opened without
   FILE_SHARE_DELETE to scan for DLLs.

5. When exec'ing a file, it's potentially tested for being a script.
   If so, the FILE_SHARE_DELETE is omitted.

I'm going to change 1, 4, and 5, but they can't be the culprit for what
you see.

If a file can't be removed, it's typically a non-Cygwin process holding
a handle to the file with file sharing set to 0.  Consider that a Cygwin
process opens the file with all sharing flags set, so removing the file
will at least work by moving it to the trashcan.  Well, except on remote
drives, that is, because we don't even know if a trashcan is available
on the remote drive and even if so, most of the time it's not accessible
from remote.


Corinna

-- 
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

  reply	other threads:[~2011-07-04 15:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30 12:43 untarring symlinks with ../ fails randomly Wolf Geldmacher
2011-06-30 13:37 ` Corinna Vinschen
2011-06-30 15:05   ` Ken Brown
2011-06-30 15:26     ` Corinna Vinschen
2011-06-30 15:28     ` Wolf Geldmacher
2011-07-04  9:16       ` untarring symlinks with ../ fails randomly, silghtly OT Wolf Geldmacher
2011-07-04 10:47         ` Corinna Vinschen
2011-07-04 10:56           ` Ryan Johnson
2011-07-04 11:34             ` Corinna Vinschen
2011-07-04 11:55               ` Corinna Vinschen
2011-07-04 12:07               ` Wolf Geldmacher
2011-07-04 12:22               ` Ryan Johnson
2011-07-04 14:21                 ` Corinna Vinschen
2011-07-04 15:13                   ` Corinna Vinschen [this message]
2011-07-05 12:12                   ` Corinna Vinschen
2011-07-04 15:05                 ` Ryan Johnson
2011-07-04 21:44                   ` Mark Geisert
2011-07-04 12:00           ` Wolf Geldmacher
2011-07-05 12:12           ` Corinna Vinschen
2011-07-05 12:21             ` Ryan Johnson
2011-07-05 17:02               ` Wolf Geldmacher
2011-07-05 15:53             ` Wolf Geldmacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110704151233.GB1457@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).