public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] escaping variables in sed expressions
@ 2008-04-15 11:14 Marijn Schouten (hkBst)
  2008-04-15 11:05 ` Santiago M. Mola
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Marijn Schouten (hkBst) @ 2008-04-15 11:14 UTC (permalink / raw
  To: gentoo-dev@lists.gentoo.org

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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?

Marijn

[1]: http://bugs.gentoo.org/show_bug.cgi?id=217735

- --
Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgEjjEACgkQp/VmCx0OL2zGDQCcCcgx1/g/UXpB38HIjKjNhmL6
S4MAoK1aXJS6SW9FaZT4i2iaeo6AlD2u
=Id31
-----END PGP SIGNATURE-----
-- 
gentoo-dev@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2008-04-21 15:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 11:14 [gentoo-dev] escaping variables in sed expressions Marijn Schouten (hkBst)
2008-04-15 11:05 ` Santiago M. Mola
2008-04-15 11:14   ` Fabian Groffen
2008-04-15 14:17   ` Frank Gruellich
2008-04-15 15:16     ` Marius Mauch
2008-04-16 17:17       ` Frank Gruellich
2008-04-16 17:24         ` Ciaran McCreesh
2008-04-17  4:31           ` [gentoo-dev] " Duncan
2008-04-17  5:49             ` Rémi Cardona
2008-04-18  0:45               ` Duncan
2008-04-17  9:51             ` Santiago M. Mola
2008-04-18  1:05               ` Duncan
2008-04-17 10:40             ` Olivier Galibert
2008-04-21 15:39           ` Steve Long
2008-04-15 11:29 ` [gentoo-dev] " David Leverton
2008-04-15 13:10 ` Ulrich Mueller
2008-04-15 14:52 ` Petteri Räty
2008-04-15 15:29   ` Marijn Schouten (hkBst)
2008-04-15 15:35 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox