delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/08/15:50:10

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: John Wiersba <John DOT Wiersba AT medstat DOT com>
To: "'Larry Hall (RFK Partners, Inc)'" <lhall AT rfk DOT com>,
"'cygwin'" <cygwin AT sourceware DOT cygnus DOT com>
Message-ID: <03F4742D8225D21191EF00805FE62B9908E23FC0@aa-msg-01.medstat.com>
Subject: RE: unlink() problem
Date: Wed, 8 Aug 2001 15:47:27 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

Thanks for your reply, Larry.  Unfortunately, this is a bad bug since the
simple perl script below removes the original file (whoops!) since it
assumes that if you have permission to unlink the original file, then you
have permission to create a new file of the same name (I believe this is
always true on unix).  The net result is that you lose your data.

I can't think of anyway around it except to know that you can't do inplace
editing on cygwin.

-- John Wiersba

> -----Original Message-----
> From: Larry Hall (RFK Partners, Inc) [mailto:lhall AT rfk DOT com]
> Sent: Tuesday, July 31, 2001 6:59 PM
> To: John Wiersba; 'cygwin'
> Subject: Re: unlink() problem
> 
> 
> At 06:22 PM 7/31/2001, John Wiersba wrote:
> >I'm having a problem with unlink().  I've scanned the FAQ 
> and searched some
> >in the newsgroup archives for information about the 
> following problem.  I
> >did find a post (see
> >http://sources.redhat.com/ml/cygwin/2001-05/msg01095.html) 
> but no apparent
> >resolution.
> >
> >$ touch asdf
> >$ perl -i -pe 1 asdf
> >Can't do inplace edit on asdf: Permission denied.
> >
> >What perl is doing is equivalent to:
> >
> >$ perl -e '
> >    open A, "< asdf" or die "one $!";  # open asdf for read
> >    unlink "asdf";
> >    open B, "> asdf" or die "two $!";  # open asdf for write
> >    while (<A>) { print B }            # copy from A to B
> >'
> >two Permission denied at -e line 4.
> >
> >The problem:  after the unlink(), I can't open the same 
> filename for write
> >as I can on unix.  If I pause the program after unlinking 
> asdf, it is still
> >there and can be seen by ls, but can't be read by ls -l.  
> >
> >Is there a workaround for this behavior?  Is it considered a 
> bug or is it
> >just a quirk of the cygwin implementation of trying to implement unix
> >filesystem semantics on top of windows?
> 
> 
> The latter.  This has been quite a day for this issue!  This is the 
> third time it came up.  Perhaps this qualifies as an FAQ now! ;-)
> 
> See my previous posts about this subject from earlier in the day:
> 
> http://www.cygwin.com/ml/cygwin/2001-07/msg01797.html
> http://www.cygwin.com/ml/cygwin/2001-07/msg01774.html
> 
> There's also a related FAQ, although the message it mentions doesn't
> seem to pop up anymore, which gives insight into the underlying 
> implementation.  See:
> 
> http://www.cygwin.com/faq/faq_4.html#SEC57
> 
> Of course, the code is the "last word" on this subject in terms of the
> actual implementation.
> 
> 
> 
> 
> 
> 
> 
> Larry Hall                              lhall AT rfk DOT com
> RFK Partners, Inc.                      http://www.rfk.com
> 118 Washington Street                   (508) 893-9779 - RFK Office
> Holliston, MA 01746                     (508) 893-9889 - FAX
> 

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

- Raw text -


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