Bug#374543: sysvinit: ^C and ^Z don't work in emergency mode
Samuel Thibault, le Wed 21 Jun 2006 01:52:03 +0200, a écrit : > Sulogin needs patched too, here it is. Here is a better patch: before starting a new session, it checks thanks to tcgetsid() whether stdin is the controlling terminal. Samuel diff -ur sysvinit-2.86.ds1/src/sulogin.c sysvinit-2.86.ds1youpi/src/sulogin.c --- sysvinit-2.86.ds1/src/sulogin.c 2004-07-30 13:40:28.0 +0200 +++ sysvinit-2.86.ds1youpi/src/sulogin.c2006-06-21 01:49:54.0 +0200 @@ -23,6 +23,7 @@ #include #include #include +#include #include #if defined(__GLIBC__) # include @@ -410,7 +411,6 @@ if (pid != getsid(0)) { if (pid == getpgid(0)) setpgid(0, getpgid(getppid())); - setsid(); } signal(SIGHUP, SIG_IGN); @@ -421,13 +421,17 @@ close(2); close(fd); fd = open(tty, O_RDWR); - ioctl(0, TIOCSCTTY, (char *)1); dup(fd); dup(fd); } else close(fd); } } + if (tcgetsid(0) == -1) { + setsid(); + if (ioctl(0, TIOCSCTTY, (char *)1)) + perror("ioctl(TIOCSCTTY)"); + } /* * Get the root password.
Bug#374543: sysvinit: ^C and ^Z don't work in emergency mode
tags 374543 + pending confirmed thanks I've tested booting with kernel argument 'emergency', and without the patch, ^C and ^Z fail to work as you said, while with the patch they work. Because of this, I've commited the patch to the pkg-sysvinit svn repository, and it will be included in the next upload. Friendly, -- Petter Reinholdtsen -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#374543: sysvinit: ^C and ^Z don't work in emergency mode
Hi, Sulogin needs patched too, here it is. (Yes, it doesn't hurt to systematically do setsid();ioctl(TIOCSCTTY)). Samuel diff -ur sysvinit-2.86.ds1/src/sulogin.c sysvinit-2.86.ds1youpi/src/sulogin.c --- sysvinit-2.86.ds1/src/sulogin.c 2004-07-30 13:40:28.0 +0200 +++ sysvinit-2.86.ds1youpi/src/sulogin.c2006-06-21 01:49:54.0 +0200 @@ -23,6 +23,7 @@ #include #include #include +#include #include #if defined(__GLIBC__) # include @@ -410,7 +411,6 @@ if (pid != getsid(0)) { if (pid == getpgid(0)) setpgid(0, getpgid(getppid())); - setsid(); } signal(SIGHUP, SIG_IGN); @@ -421,13 +421,15 @@ close(2); close(fd); fd = open(tty, O_RDWR); - ioctl(0, TIOCSCTTY, (char *)1); dup(fd); dup(fd); } else close(fd); } } + setsid(); + if (ioctl(0, TIOCSCTTY, (char *)1)) + perror("ioctl(TIOCSCTTY)"); /* * Get the root password.
Bug#374543: sysvinit: ^C and ^Z don't work in emergency mode
Package: sysvinit Version: 2.86.ds1-14.1youpi Severity: normal Tags: patch upstream Hi, When booting in emergency mode (with -b or emergency option), tty controlling sequences like ^C or ^Z don't work. The incurred unfortunate effect is that one can't interrupt the programs one runs (like ping, e2fsck, badblocks, ...). This is because init doesn't initialize a session for the emergency sulogin (like it does for single-user logins). The attached patch corrects that (and makes sense since we indeed want to wait for the emergency shell to end). Please apply. Regards, Samuel -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (900, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.17 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) Versions of packages sysvinit depends on: ii file-rc0.8.7 Alternative boot mechanism using a ii initscripts2.86.ds1-14.1 Scripts for initializing and shutt ii libc6 2.3.6-13 GNU C Library: Shared libraries ii libselinux11.30-1SELinux shared libraries ii libsepol1 1.12-1Security Enhanced Linux policy lib sysvinit recommends no packages. -- no debconf information Seulement dans sysvinit-2.86.ds1: build diff -ur sysvinit-2.86.ds1/debian/changelog sysvinit-2.86.ds1youpi/debian/changelog --- sysvinit-2.86.ds1/debian/changelog 2006-06-19 22:29:37.0 +0200 +++ sysvinit-2.86.ds1youpi/debian/changelog 2006-06-19 22:22:16.0 +0200 @@ -1,3 +1,9 @@ +sysvinit (2.86.ds1-14.1youpi) unstable; urgency=low + + * Fix emergency mode's tty. + + -- Samuel Thibault <[EMAIL PROTECTED]> Sat, 6 May 2006 21:12:39 +0200 + sysvinit (2.86.ds1-14.1) unstable; urgency=low * Non-maintainer upload. diff -ur sysvinit-2.86.ds1/src/init.c sysvinit-2.86.ds1youpi/src/init.c --- sysvinit-2.86.ds1/src/init.c2004-07-30 14:16:20.0 +0200 +++ sysvinit-2.86.ds1youpi/src/init.c 2006-06-19 22:30:48.0 +0200 @@ -89,7 +89,7 @@ CHILD *newFamily = NULL; /* The list after inittab re-read */ CHILD ch_emerg = { /* Emergency shell */ - 0, 0, 0, 0, 0, + WAITING, 0, 0, 0, 0, "~~", "S", 3,