delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/07/31/15:17:50

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: "Joe Smith" <unknown_kev_cat AT hotmail DOT com>
Subject: unlink()'s not quite POSIX behavior.
Date: Tue, 31 Jul 2007 15:16:42 -0400
Lines: 37
Message-ID: <f8o1qr$jtk$1@sea.gmane.org>
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

It appears that currently unlink will not immedately remove a file (that has 
only one link) if a handle to the file is open, but will flag it for 
deletion once the file handle closes.

This is causing a problem with Python 3000.

POSIX says:

>When the file's link count becomes 0 and no process has the file open,
>the space occupied by the file shall be freed and the file shall no longer
>be accessible. If one or more processes have the file open when the last
>link is removed, the link shall be removed before unlink() returns, but
>the removal of the file contents shall be postponed until all references
>to the file are closed.

AIUI,
Windows NT had a design goal of allowing a complient implementation
of POSIX to be implmented in a subsystem (along with userespace utilities).
(Hence services for unix).


Could we at least simulate the behavior by moving the file out of the way 
(simultaionsly renaming it to something unique),
and forcing it into the delqueue? (by Setting the 
FILE_DISPOSITION_INFORMATION's DeleteFile flag to true?)

Wait a moment, that looks to be exactly what unlink_nt is doing?
What is going on?

(The problem is with a call in Python3k getting a "Permission denied" (ERRNO 
13) error when attempting to create a file shortly after it has been deleted 
with unlink. That seems to be consistant with standard windows behavior for 
deleting a file, as trying to create it again before the last handle is 
closed would return an ERROR_ACCESS_DENIED.)

However, it looks like with unlink_nt that should not be happening, right?



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