Problems with "sed -i"

Fri Apr 20 11:26:00 GMT 2007

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

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.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list