From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9208B198003 for ; Sat, 9 Mar 2013 02:48:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 78484E062D; Sat, 9 Mar 2013 02:48:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E7202E062D for ; Sat, 9 Mar 2013 02:47:59 +0000 (UTC) Received: from mail-qe0-f50.google.com (mail-qe0-f50.google.com [209.85.128.50]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mattst88) by smtp.gentoo.org (Postfix) with ESMTPSA id B93D433E224 for ; Sat, 9 Mar 2013 02:47:58 +0000 (UTC) Received: by mail-qe0-f50.google.com with SMTP id k5so1405794qej.37 for ; Fri, 08 Mar 2013 18:47:57 -0800 (PST) X-Received: by 10.229.175.8 with SMTP id v8mr1524556qcz.127.1362797277126; Fri, 08 Mar 2013 18:47:57 -0800 (PST) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org MIME-Version: 1.0 Received: by 10.49.121.167 with HTTP; Fri, 8 Mar 2013 18:47:37 -0800 (PST) In-Reply-To: <48b5405f720c6aa9e9472be0fc3a66e7ef336d3e.1362329514.git.wking@tremily.us> References: <48b5405f720c6aa9e9472be0fc3a66e7ef336d3e.1362329514.git.wking@tremily.us> From: Matt Turner Date: Fri, 8 Mar 2013 18:47:37 -0800 Message-ID: Subject: Re: [gentoo-catalyst] [PATCH] livecdfs-update.sh: Escape ampersands in STARTX sed expression To: gentoo-catalyst@lists.gentoo.org Cc: "W. Trevor King" Content-Type: text/plain; charset=ISO-8859-1 X-Archives-Salt: 09c21b6f-8b92-49c8-8bad-7f9b1a8a57b6 X-Archives-Hash: 45a6add8c272f477e98e7deecaa33da0 On Sun, Mar 3, 2013 at 8:53 AM, W. Trevor King wrote: > From: "W. Trevor King" > > From sed(1): > > s/regexp/replacement/ > Attempt to match regexp against the pattern space. If successful, > replace that portion matched with replacement. The replacement > may contain the special character & to refer to that portion of > the pattern space which matched, and the special escapes \1 > through \9 to refer to the corresponding matching sub-expressions > in the regexp. > > This means that the old expression (with unescaped ampersands) lead > to: > > source /etc/profile ##STARTX##STARTX su - ${first_user} -c startx > > when we want: > > source /etc/profile && su - ${first_user} -c startx > > with ${first_user} expanded in both cases. > --- > targets/support/livecdfs-update.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh > index 77d694e..fda3e36 100644 > --- a/targets/support/livecdfs-update.sh > +++ b/targets/support/livecdfs-update.sh > @@ -389,7 +389,7 @@ esac > if [ -e /etc/startx ] > then > sed -i \ > - "s:##STARTX:source /etc/profile && su - ${first_user} -c startx:" \ > + "s:##STARTX:source /etc/profile \&\& su - ${first_user} -c startx:" \ > /root/.bashrc > fi > > -- > 1.8.2.rc0.16.g20a599e > > Nice. Bug since 2006. I've committed this. Thanks!