[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 2/4] Do not multiply console hvc0 getty entries



target_kernkind_console_inittab is supposed to edit inittab to make
sure that there is a getty running on hvc0.

However:
 - It is not idempotent; if run more than once it can produce duplicate
   entries `1:' and `xc:'.
 - It works by copying and editing the entry `1:' but it might be that
   there is already another console entry for hvc0 for some other
   reason.

If we end up with multiple entries for hvc0, we can have two copies of
getty fighting, and if you manage to log in, one of them will be
fighting with your shell.

Guard the script with a grep, which looks for inittab entries
mentioning the intended console.  This makes makes it do nothing if
nothing is needed (and therefore it also makes it idempotent).

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 3fc8e15..09694f4 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -2027,7 +2027,8 @@ sub target_kernkind_console_inittab ($$$) {
     if (defined $console && length $console) {
         target_cmd_root($ho, <<END);
             set -ex
-            perl -i~ -ne "
+            egrep '^[0-9a-zA-Z].*getty.* $console\$' $inittabpath \\
+           || perl -i~ -ne "
                 next if m/^xc:/;
                 print \\\$_ or die \\\$!;
                 next unless s/^1:/xc:/;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.