1 |
On Tue, Apr 15, 2008 at 1:14 PM, Marijn Schouten (hkBst) |
2 |
<hkBst@g.o> wrote: |
3 |
> |
4 |
> Hi list, |
5 |
> |
6 |
> it seems I have been using some fragile sed expression and I'd like to tap |
7 |
> the collective |
8 |
> wisdom for avoiding doing that in the future. |
9 |
> |
10 |
> dev-scheme/slib-3.1.5-r1 currently does |
11 |
> |
12 |
> sed "s_prefix = /usr/local/_prefix = ${D}/usr/_" -i Makefile |
13 |
> |
14 |
> to make it not violate the sandbox. However a user had set |
15 |
> PORTAGE_TMPDIR=/home/gentoo_overflow/tmp causing the sed expression to |
16 |
> contain too may |
17 |
> underscores and failing.[1] |
18 |
> |
19 |
> There are several option to handle this. I could use a less common |
20 |
> delimiter or I could |
21 |
> escape it: ${D//_/\_} instead of ${D}. I could use a sed expression that |
22 |
> doesn't suffer |
23 |
> from this problem (thanks to dleverton): |
24 |
> |
25 |
> sed -ne '\_^prefix = /usr/local_!{p;d}' -e "iprefix = ${D}" -i Makefile |
26 |
> |
27 |
> Comments? |
28 |
> |
29 |
|
30 |
Currently is use ':' as sed delimiter when paths are involved. I'd |
31 |
also like to hear from you about proper delimiters if you think ':' is |
32 |
not safe enough. |
33 |
|
34 |
AFAIK, the only corner case which would make this fail would be |
35 |
Windows paths (C:/gentoo-prefix). |
36 |
|
37 |
Regards, |
38 |
|
39 |
-- |
40 |
Santiago M. Mola |
41 |
Jabber ID: cooldwind@×××××.com |
42 |
-- |
43 |
gentoo-dev@l.g.o mailing list |