public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] livecdfs-update.sh: Escape ampersands in STARTX sed expression
@ 2013-03-03 16:53 W. Trevor King
  2013-03-04  3:13 ` [gentoo-catalyst] [PATCH] livecd-bashrc: Avoid a startx race by restricting to tty1 W. Trevor King
  2013-03-09  2:47 ` [gentoo-catalyst] [PATCH] livecdfs-update.sh: Escape ampersands in STARTX sed expression Matt Turner
  0 siblings, 2 replies; 11+ messages in thread
From: W. Trevor King @ 2013-03-03 16:53 UTC (permalink / raw
  To: Catalyst; +Cc: W. Trevor King

From: "W. Trevor King" <wking@tremily.us>

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



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

end of thread, other threads:[~2013-03-09 11:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-03 16:53 [gentoo-catalyst] [PATCH] livecdfs-update.sh: Escape ampersands in STARTX sed expression W. Trevor King
2013-03-04  3:13 ` [gentoo-catalyst] [PATCH] livecd-bashrc: Avoid a startx race by restricting to tty1 W. Trevor King
2013-03-06 17:02   ` [gentoo-catalyst] [PATCH v2 0/2] Fix livecdfs-update.sh startx handling W. Trevor King
2013-03-06 17:02     ` [gentoo-catalyst] [PATCH v2 1/2] livecd-bashrc: Avoid a startx race by restricting to tty1 W. Trevor King
2013-03-06 17:02     ` [gentoo-catalyst] [PATCH v2 2/2] livecdfs-update.sh: Use `bash --login` to spawn startx W. Trevor King
2013-03-09  2:55       ` Matt Turner
2013-03-09 11:48         ` [gentoo-catalyst] " W. Trevor King
2013-03-09  2:49   ` [gentoo-catalyst] [PATCH] livecd-bashrc: Avoid a startx race by restricting to tty1 Matt Turner
2013-03-09 11:46     ` [gentoo-catalyst] " W. Trevor King
2013-03-09  2:47 ` [gentoo-catalyst] [PATCH] livecdfs-update.sh: Escape ampersands in STARTX sed expression Matt Turner
2013-03-09 11:48   ` [gentoo-catalyst] " W. Trevor King

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