Gentoo Archives: gentoo-dev

From: "Petteri Räty" <betelgeuse@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] escaping variables in sed expressions
Date: Tue, 15 Apr 2008 14:53:12
Message-Id: 4804C141.7010705@gentoo.org
In Reply to: [gentoo-dev] escaping variables in sed expressions by "Marijn Schouten (hkBst)"
1 Marijn Schouten (hkBst) kirjoitti:
2 > Hi list,
3 >
4 > it seems I have been using some fragile sed expression and I'd like to
5 > tap the collective
6 > wisdom for avoiding doing that in the future.
7 >
8 > dev-scheme/slib-3.1.5-r1 currently does
9 >
10 > sed "s_prefix = /usr/local/_prefix = ${D}/usr/_" -i Makefile
11 >
12 > to make it not violate the sandbox. However a user had set
13 > PORTAGE_TMPDIR=/home/gentoo_overflow/tmp causing the sed expression to
14 > contain too may
15 > underscores and failing.[1]
16 >
17 > There are several option to handle this. I could use a less common
18 > delimiter or I could
19 > escape it: ${D//_/\_} instead of ${D}. I could use a sed expression that
20 > doesn't suffer
21 > from this problem (thanks to dleverton):
22 >
23 > sed -ne '\_^prefix = /usr/local_!{p;d}' -e "iprefix = ${D}" -i Makefile
24 >
25 > Comments?
26 >
27 > Marijn
28 >
29 > [1]: http://bugs.gentoo.org/show_bug.cgi?id=217735
30 >
31
32 You should just fix the Makefile to respect DESTDIR and send the patch
33 upstream.
34
35 Regards,
36 Petteri

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] escaping variables in sed expressions "Marijn Schouten (hkBst)" <hkBst@g.o>