Package: lxc
Version: 0.7.5-24
Severity: wishlist
Tags: upstream patch
Hi, I've noticed that under lxc-console it's impossible to enter as is the
escape prefix configured to exit the console. E.g. if the exit command is
<Ctrl+a q> (the default), it's impossible to enter <Ctrl+a> itself in the
standard input, which makes interactive programs like Screen or Emacs quite
cumbersome (or impossible) to use. The lxc-console command offers the
"--escape" option, but the user still needs to think of a character that he
won't need to use.
The attached patch allows to enter the prefix into the standard input simply
by repeating it, e.g. <Ctrl+a q> exits the console, <Ctrl+a Ctrl+a> inserts
<Ctrl+a> in standard input in the same way as <Ctrl+a x> inserts "x". Thus
the behaviour for other characters after the prefix is maintained.
Thanks!
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages lxc depends on:
ii debconf [debconf-2.0] 1.5.41
ii libc6 2.13-26
ii libcap2 1:2.22-1
Versions of packages lxc recommends:
ii debootstrap 1.0.38
ii libcap2-bin 1:2.22-1
Versions of packages lxc suggests:
ii lxctl 0.3.1+debian-1
-- debconf information:
lxc/shutdown: stop
lxc/directory: /var/lib/lxc
lxc/title:
lxc/auto: true
diff --git a/src/lxc/lxc_console.c b/src/lxc/lxc_console.c
index 5a1e45a..d09c688 100644
--- a/src/lxc/lxc_console.c
+++ b/src/lxc/lxc_console.c
@@ -144,7 +144,7 @@ static int stdin_handler(int fd, void *data, struct lxc_epoll_descr *descr)
}
/* we want to exit the console with Ctrl+a q */
- if (c == my_args.escape) {
+ if (c == my_args.escape && !wait4q) {
wait4q = !wait4q;
return 0;
}
@@ -202,7 +202,9 @@ int main(int argc, char *argv[])
if (err)
goto out;
- fprintf(stderr, "\nType <Ctrl+%c q> to exit the console\n",
+ fprintf(stderr, "\n\
+Type <Ctrl+%1$c q> to exit the console, \
+<Ctrl+%1$c Ctrl+%1$c> to enter Ctrl+%1$c itself\n",
'a' + my_args.escape - 1);
err = setsid();