On Tue, Apr 15, 2008 at 1:14 PM, Marijn Schouten (hkBst) <[EMAIL PROTECTED]> wrote: > > Hi list, > > it seems I have been using some fragile sed expression and I'd like to tap > the collective > wisdom for avoiding doing that in the future. > > dev-scheme/slib-3.1.5-r1 currently does > > sed "s_prefix = /usr/local/_prefix = ${D}/usr/_" -i Makefile > > to make it not violate the sandbox. However a user had set > PORTAGE_TMPDIR=/home/gentoo_overflow/tmp causing the sed expression to > contain too may > underscores and failing.[1] > > There are several option to handle this. I could use a less common > delimiter or I could > escape it: ${D//_/\_} instead of ${D}. I could use a sed expression that > doesn't suffer > from this problem (thanks to dleverton): > > sed -ne '\_^prefix = /usr/local_!{p;d}' -e "iprefix = ${D}" -i Makefile > > Comments? >
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. AFAIK, the only corner case which would make this fail would be Windows paths (C:/gentoo-prefix). Regards, -- Santiago M. Mola Jabber ID: [EMAIL PROTECTED] -- gentoo-dev@lists.gentoo.org mailing list