delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/03/12:55:10

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <3E15C5A2.4020307@veritas.com>
Date: Fri, 03 Jan 2003 09:17:22 -0800
From: Bob McGowan <rmcgowan AT veritas DOT com>
Organization: VERITAS Software, Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Robert Mecklenburg <mecklen AT cimsoft DOT com>, bonzini AT gnu DOT org
CC: Cygwin Users List <cygwin AT cygwin DOT com>
Subject: Re: sed -i problem?
References: <200301031627 DOT h03GRTRQ020947 AT wolf DOT cimsoft DOT com> <031401c2b34f$67eb5720$9783883e AT pomello>

Some additional info, perhaps helpful in the final analysis -

Supply a suffix to the -i option, the original gets renamed with the suffix 
appended, and the temp file gets renamed to the original name.

This was found by checking the file dates from a long listing, not strace-ing 
the execution.

This may also provide a work-around for Robert, requiring the removal of the 
backup file, but at least the original named file has the edited content, as 
desired.

Bob

Max Bowsher wrote:
> Robert Mecklenburg wrote:
> 
>>I seem to be having problem with the -i flag in sed 4.0.1 in the
>>latest cygwin release.  The docs state -i places output in a tmp file
>>and renames the tmp to the original when finished.  It appears the
>>rename is not happening for me:
> 
> [snip example]
> 
> I did a quick bit of strace-ing, and it seems that sed isn't closing the
> input and output files before doing the rename. Unsurprisingly, this fails
> with "Access is denied.".
> 
> But sed is trying to close the files. It gets as far as
> lib/utils.c:ck_fclose(stream), but then it does something complicated with a
> linked list, and ends up never calling do_ck_fclose(), which would actually
> call fclose().
> 
> Right, I've got no more time now, so hopefully someone else will take my
> analysis, and finish tracking down this bug.
> 
> Max.
> 
> 
> 
> --
> 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/

-- 
Bob McGowan
Staff Development Engineer
VERITAS Software
rmcgowan AT veritas DOT com


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