3
0
forked from pool/util-linux

Accepting request 221269 from Base:System

- Add patch sulogin-does-not-find-any-console.patch to enable sulogin
  to find suitable console device even if first is not usable (bnc#862078)

- Avoid that hanging plymouth locks terminal lines that is
  add patch sulogin-fooled-on-tty-line-due-plymouth.patch and
  modify patch agetty-fooled-on-serial-line-due-plymouth.patch
  to remove any lock which had been left over.

OBS-URL: https://build.opensuse.org/request/show/221269
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=179
This commit is contained in:
Tomáš Chvátal 2014-02-09 12:18:02 +00:00 committed by Git OBS Bridge
commit 6d0e6aeaf8
5 changed files with 92 additions and 5 deletions

View File

@ -41,10 +41,11 @@ console as the flags are locked.
if (close_stream(dbf) != 0)
log_err("write failed: %s", DEBUG_OUTPUT);
#endif
@@ -1090,6 +1094,23 @@ static void termio_init(struct options *
@@ -1090,6 +1094,25 @@ static void termio_init(struct options *
{
speed_t ispeed, ospeed;
struct winsize ws;
+ struct termios lock;
+ int i;
+
+ for (i = 0; i < 20; i++) {
@ -53,7 +54,6 @@ console as the flags are locked.
+ * the termios flags become changed from under the first
+ * agetty on a serial system console as the flags are locked.
+ */
+ struct termios lock;
+ memset(&lock, 0, sizeof(struct termios));
+ if (ioctl(STDIN_FILENO, TIOCGLCKTRMIOS, &lock) < 0)
+ break;
@ -62,10 +62,12 @@ console as the flags are locked.
+ debug("termios locked\n");
+ sleep(1);
+ }
+ memset(&lock, 0, sizeof(struct termios));
+ ioctl(STDIN_FILENO, TIOCSLCKTRMIOS, &lock);
if (op->flags & F_VCONSOLE) {
#if defined(IUTF8) && defined(KDGKBMODE)
@@ -1154,9 +1175,6 @@ static void termio_init(struct options *
@@ -1154,9 +1177,6 @@ static void termio_init(struct options *
* later on.
*/
@ -75,7 +77,7 @@ console as the flags are locked.
#ifdef IUTF8
tp->c_iflag = tp->c_iflag & IUTF8;
if (tp->c_iflag & IUTF8)
@@ -1216,8 +1234,11 @@ static void termio_init(struct options *
@@ -1216,8 +1236,11 @@ static void termio_init(struct options *
if (op->flags & F_RTSCTS)
tp->c_cflag |= CRTSCTS;
#endif
@ -88,7 +90,7 @@ console as the flags are locked.
/* Go to blocking input even in local mode. */
fcntl(STDIN_FILENO, F_SETFL,
@@ -1238,6 +1259,10 @@ static void reset_vc(const struct option
@@ -1238,6 +1261,10 @@ static void reset_vc(const struct option
if (tcsetattr(STDIN_FILENO, TCSADRAIN, tp))
log_warn(_("setting terminal attributes failed: %m"));

View File

@ -0,0 +1,32 @@
Enable sulogin to find a suitable console device even if the first line
in /proc/consoles does not have any major and minor number (bnc#862078)
---
sulogin-consoles.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- login-utils/sulogin-consoles.c
+++ login-utils/sulogin-consoles.c 2014-02-07 15:47:14.246235487 +0000
@@ -319,7 +319,7 @@ static int detect_consoles_from_proc(str
char fbuf[16 + 1];
DIR *dir = NULL;
FILE *fc = NULL;
- int maj, min, rc = 1;
+ int maj, min, rc = 1, matches;
DBG(dbgprint("trying /proc"));
@@ -332,10 +332,12 @@ static int detect_consoles_from_proc(str
if (!dir)
goto done;
- while (fscanf(fc, "%*s %*s (%16[^)]) %d:%d", fbuf, &maj, &min) == 3) {
+ while ((matches = fscanf(fc, "%*s %*s (%16[^)]) %d:%d", fbuf, &maj, &min)) >= 1) {
char *name;
dev_t comparedev;
+ if (matches != 3)
+ continue;
if (!strchr(fbuf, 'E'))
continue;
comparedev = makedev(maj, min);

View File

@ -0,0 +1,33 @@
Make sure that plymouth does not break sulogin.
---
sulogin.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
--- login-utils/sulogin.c
+++ login-utils/sulogin.c 2014-02-06 09:39:57.726236116 +0000
@@ -83,7 +83,23 @@ static void tcinit(struct console *con)
{
int mode = 0, flags = 0;
struct termios *tio = &con->tio;
- int fd = con->fd;
+ struct termios lock;
+ int i, fd = con->fd;
+
+ for (i = 0; i < 5; i++) {
+ /*
+ * With plymouth the termios flags become changed after this
+ * function had changed the termios.
+ */
+ memset(&lock, 0, sizeof(struct termios));
+ if (ioctl(fd, TIOCGLCKTRMIOS, &lock) < 0)
+ break;
+ if (!lock.c_iflag && !lock.c_oflag && !lock.c_cflag && !lock.c_lflag)
+ break;
+ sleep(1);
+ }
+ memset(&lock, 0, sizeof(struct termios));
+ ioctl(fd, TIOCSLCKTRMIOS, &lock);
errno = 0;

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Fri Feb 7 15:59:20 UTC 2014 - werner@suse.de
- Add patch sulogin-does-not-find-any-console.patch to enable sulogin
to find suitable console device even if first is not usable (bnc#862078)
-------------------------------------------------------------------
Thu Feb 6 10:03:30 UTC 2014 - werner@suse.de
- Avoid that hanging plymouth locks terminal lines that is
add patch sulogin-fooled-on-tty-line-due-plymouth.patch and
modify patch agetty-fooled-on-serial-line-due-plymouth.patch
to remove any lock which had been left over.
-------------------------------------------------------------------
Tue Feb 4 10:24:02 UTC 2014 - werner@suse.de

View File

@ -112,6 +112,10 @@ Patch14: tty3270-on-serial-line-of-s390.patch
Patch15: agetty-fooled-on-serial-line-due-plymouth.patch
# PATCH-FIX-SUSE -- Let agetty detect /dev/3270/tty1 as device not as baud rate
Patch16: agetty-on-s390-on-dev-3270-tty1-line.patch
# PATCH-FIX-SUSE -- Make sure that plymouth does not break sulogin
Patch17: sulogin-fooled-on-tty-line-due-plymouth.patch
# PATCH-FIX-SUSE -- sulogin: find suitable console device even if first is not usable
Patch18: sulogin-does-not-find-any-console.patch
# hack for boot.localfs
Patch20: util-linux-HACK-boot.localfs.diff
@ -232,6 +236,8 @@ xzcat %{S:0} | %gpg_verify %{S:12} -
%patch14 -p0
%patch15 -p0
%patch16 -p0
%patch17 -p0
%patch18 -p0
#
%patch20 -p1
#