* Marius Mauch <[EMAIL PROTECTED]> 15. Apr 08:
> On Tue, 15 Apr 2008 16:17:54 +0200
> Frank Gruellich <[EMAIL PROTECTED]> wrote:
> > * Santiago M. Mola <[EMAIL PROTECTED]> 15. Apr 08:
> > > On Tue, Apr 15, 2008 at 1:14 PM, Marijn Schouten (hkBst)
> > > Currently is use ':' as sed delimiter when paths are involved. I'd
> > > also like to hear from you about proper delimiters if you think ':'
> > > is not safe enough.
> > Even though it's probably stupid to use it, but ':' is a valid
> > character within a path.  I've no solution for this problem, however.
> Valid maybe (but then pretty much every character is valid),

I've been a bigmouth so I couldn't sleep last night thinking about that
problem (which in fact happened to me sometimes).  The very last
character I'd expect in a path would be the NUL char (\x00).  I was not
able to create a filename or path containing it.  (Anyone else?)
Unfortunately that stupid sed does not work with \x00 as delimiter...

But because a path will not contain a \x00 you can replace all
"$delimiter_of_your_dreams" with a \x00 and later change it back to the
original without adding any new.

Looks like:

(0) [EMAIL PROTECTED] [~] % echo '/foo/bar/foo:baz/baz bar/laber_rabarber/' |tr 
'/' '\0' |sed 's/a/o/g' |tr '\0' '/'
/foo/bor/foo:boz/boz bor/lober_roborber/
(0) [EMAIL PROTECTED] [~] %

Moving that to OP's problem he could maybe use something like:

tr '/' '\0' <Makefile |sed "s_prefix = /usr/local/_prefix = ${D}/usr/_" |tr 
'\0' '/' >Makefile.new

This obviously introduces the problem that a Makefile contains more than
just paths and there could be a \x00 somewhere... but... well...

> but colon is used as path delimiter in many other contexts (e.g.
> $PATH) so it's rather unlikely to be used.

I'm *very* paranoid.  ;-)

Kind regards,
 Frank.
-- 
Sigmentation fault
-- 
gentoo-dev@lists.gentoo.org mailing list

Reply via email to