delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/04/20/07:26:59

X-Spam-Check-By: sourceware.org
Message-ID: <4628A2F9.2000200@bonhard.uklinux.net>
Date: Fri, 20 Apr 2007 12:24:41 +0100
From: fergus <fergus AT bonhard DOT uklinux DOT net>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
To: Cygwin ML <cygwin AT cygwin DOT com>
CC: fergus <fergus AT bonhard DOT uklinux DOT net>
Subject: Problems with "sed -i"
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

I'm having a few problems with sed -i (using the current sed v.4.1.5).

Unfortunately they only occur when used in a system() call from within a program. That is to say

	$ /bin/sed -i 's/expr1/expr2/g' {pathto}/filename

works fine, but

	system("/bin/sed -i 's/expr1/expr2/g' {pathto}/filename")
	.. do stuff involving filename ..

invariably results in error messages of the style

	/bin/sed: cannot rename {pathto}//sedEfWWjX: Permission denied

If I could I would send straces etc, but, I'm sorry, I do not know how to do this from within an application. I've tried inserting sleep statements to give the rewritten file time to be saved before attempting to "do the stuff" in line 2. No difference in behaviour and presentation of error messages.

(i) I note the strange double slash // in the error message (eg if the file is called d/filename the error message will read d//sedEfWWjX). Not what I would have expected but is it right?

(ii) The same or a similar problem seems to have been reported with v.4.1.1 with the solution provided, or at least described, in

	http://cygwin.com/ml/cygwin/2003-01/msg00159.html

However, looking at the Changelog for 4.1.5 it looks as though this, or something like it, was attended to in the past.

I'm sorry that even by my own deplorable standards this report is less detailed than it should be. I'm just hoping the symptoms described might ring a bell with somebody.

Thank you.

Fergus


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