[util-linux-ng] 2.18-4: fix #623685

kzak kzak at fedoraproject.org
Wed Aug 18 08:34:41 UTC 2010


commit 39ece656f36c1c4e06930d776e20ac63a9ac5ef1
Author: Karel Zak <kzak at redhat.com>
Date:   Wed Aug 18 10:16:07 2010 +0200

    2.18-4: fix #623685
    
    Signed-off-by: Karel Zak <kzak at redhat.com>

 .gitignore                                         |    3 +
 util-linux-ng-2.18-agetty-baudrate.patch           |  147 ++++++++++++++++++++
 ...patch => util-linux-ng-2.18-agetty-clocal.patch |   14 +-
 util-linux-ng.spec                                 |   12 ++-
 4 files changed, 166 insertions(+), 10 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e3f316a..d0444d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
 floppy-0.16.tar.bz2
 util-linux-ng-2.18.tar.bz2
+*~
+*.rpm
+*.log
diff --git a/util-linux-ng-2.18-agetty-baudrate.patch b/util-linux-ng-2.18-agetty-baudrate.patch
new file mode 100644
index 0000000..68397dd
--- /dev/null
+++ b/util-linux-ng-2.18-agetty-baudrate.patch
@@ -0,0 +1,147 @@
+From 848e5e6ce3978d921366b799d907a78a12299924 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Wed, 18 Aug 2010 09:02:03 +0200
+Subject: [PATCH] agetty: add -s to reuse existing baud rate
+
+For example:
+
+	/sbin/agetty -s /dev/ttyS0 9600
+
+will reuse the speed the kernel configured on the port. If the setting
+from kernel is useless (tty returns BREAK character) then the baud
+rate from command line (9600) is used.
+
+Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623685
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ login-utils/agetty.8 |   16 +++++-----------
+ login-utils/agetty.c |   22 ++++++++++++++--------
+ 2 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/login-utils/agetty.8 b/login-utils/agetty.8
+index 8761374..53037dd 100644
+--- a/login-utils/agetty.8
++++ b/login-utils/agetty.8
+@@ -3,7 +3,7 @@
+ agetty \- alternative Linux getty
+ 
+ .SH SYNOPSIS
+-.BR "agetty " [\-8ihLmnUw]
++.BR "agetty " [\-8ihLmnsUw]
+ .RI "[-f " issue_file ]
+ .RI "[-l " login_program ]
+ .RI "[-I " init ]
+@@ -12,16 +12,6 @@ agetty \- alternative Linux getty
+ .I port
+ .I baud_rate,...
+ .RI [ term ]
+-.br
+-.BR "agetty " [\-8ihLmnw]
+-.RI "[-f " issue_file ]
+-.RI "[-l " login_program ]
+-.RI "[-I " init ]
+-.RI "[-t " timeout ]
+-.RI "[-H " login_host ]
+-.I baud_rate,...
+-.I port
+-.RI [ term ]
+ 
+ .SH DESCRIPTION
+ .ad
+@@ -163,6 +153,10 @@ Force the line to be a local line with no need for carrier detect. This can
+ be useful when you have a locally attached terminal where the serial line
+ does not set the carrier detect signal.
+ .TP
++\-s
++Try to keep the existing baud rate. The baud rates from
++the command line are used when agetty receives a BREAK character.
++.TP
+ \-U
+ Turn on support for detecting an uppercase only terminal.  This setting will
+ detect a login name containing only capitals as indicating an uppercase
+diff --git a/login-utils/agetty.c b/login-utils/agetty.c
+index 39a1fd3..9fc389b 100644
+--- a/login-utils/agetty.c
++++ b/login-utils/agetty.c
+@@ -133,6 +133,7 @@ struct options {
+ #define F_CUSTISSUE	(1<<6)		/* give alternative issue file */
+ #define F_NOPROMPT	(1<<7)		/* don't ask for login name! */
+ #define F_LCUC		(1<<8)		/* Support for *LCUC stty modes */
++#define F_KEEPSPEED	(1<<9)		/* Follow baud rate from kernel */
+ 
+ /* Storage for things detected while the login name was read. */
+ 
+@@ -203,7 +204,7 @@ void parse_args P_((int argc, char **argv, struct options *op));
+ void parse_speeds P_((struct options *op, char *arg));
+ void update_utmp P_((char *line));
+ void open_tty P_((char *tty, struct termios *tp, int local));
+-void termio_init P_((struct termios *tp, int speed, struct options *op));
++void termio_init P_((struct termios *tp, struct options *op));
+ void auto_baud P_((struct termios *tp));
+ void do_prompt P_((struct options *op, struct termios *tp));
+ void next_speed P_((struct termios *tp, struct options *op));
+@@ -297,7 +298,7 @@ main(argc, argv)
+     tcsetpgrp(0, getpid());
+     /* Initialize the termios settings (raw mode, eight-bit, blocking i/o). */
+     debug("calling termio_init\n");
+-    termio_init(&termios, options.speeds[FIRST_SPEED], &options);
++    termio_init(&termios, &options);
+ 
+     /* write the modem init string and DON'T flush the buffers */
+     if (options.flags & F_INITSTRING) {
+@@ -373,7 +374,7 @@ parse_args(argc, argv, op)
+     extern int optind;			/* getopt */
+     int     c;
+ 
+-    while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mt:wUn"))) {
++    while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mst:wUn"))) {
+ 	switch (c) {
+ 	case '8':
+ 	    op->eightbits = 1;
+@@ -443,6 +444,9 @@ parse_args(argc, argv, op)
+ 	case 'n':
+ 	    op->flags |= F_NOPROMPT;
+ 	    break;
++	case 's':
++	    op->flags |= F_KEEPSPEED;		/* keep kernel defined speed */
++	    break;
+ 	case 't':				/* time out */
+ 	    if ((op->timeout = atoi(optarg)) <= 0)
+ 		error(_("bad timeout value: %s"), optarg);
+@@ -691,9 +695,8 @@ char gbuf[1024];
+ char area[1024];
+ 
+ void
+-termio_init(tp, speed, op)
++termio_init(tp, op)
+      struct termios *tp;
+-     int     speed;
+      struct options *op;
+ {
+ 
+@@ -707,8 +710,11 @@ termio_init(tp, speed, op)
+     (void) tcflush(0, TCIOFLUSH);
+ 
+     tp->c_cflag = CS8 | HUPCL | CREAD;
+-    cfsetispeed(tp, speed);
+-    cfsetospeed(tp, speed);
++
++    if (!(op->flags & F_KEEPSPEED)) {
++	    cfsetispeed(tp, op->speeds[FIRST_SPEED]);
++	    cfsetospeed(tp, op->speeds[FIRST_SPEED]);
++    }
+     if (op->flags & F_LOCAL) {
+ 	tp->c_cflag |= CLOCAL;
+     }
+@@ -1203,7 +1209,7 @@ bcode(s)
+ void
+ usage()
+ {
+-    fprintf(stderr, _("Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname);
++    fprintf(stderr, _("Usage: %s [-8hiLmsUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname);
+     exit(1);
+ }
+ 
+-- 
+1.7.2
+
diff --git a/util-linux-ng-2.17-agetty-clocal.patch b/util-linux-ng-2.18-agetty-clocal.patch
similarity index 76%
rename from util-linux-ng-2.17-agetty-clocal.patch
rename to util-linux-ng-2.18-agetty-clocal.patch
index 9429a23..1708e4d 100644
--- a/util-linux-ng-2.17-agetty-clocal.patch
+++ b/util-linux-ng-2.18-agetty-clocal.patch
@@ -1,4 +1,4 @@
-From 9fcaa8826c180273829cf03e5fe34e08daef721f Mon Sep 17 00:00:00 2001
+From e143d1f00497f0178a1febec8fb4aa7c842fa35a Mon Sep 17 00:00:00 2001
 From: Karel Zak <kzak at redhat.com>
 Date: Mon, 12 Jul 2010 11:57:55 +0200
 Subject: [PATCH] aggety: don't wipe CLOCAL flag
@@ -13,18 +13,18 @@ Signed-off-by: Karel Zak <kzak at redhat.com>
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/login-utils/agetty.c b/login-utils/agetty.c
-index 39a1fd3..0cb00db 100644
+index 9fc389b..2541948 100644
 --- a/login-utils/agetty.c
 +++ b/login-utils/agetty.c
-@@ -706,7 +706,7 @@ termio_init(tp, speed, op)
+@@ -709,7 +709,7 @@ termio_init(tp, op)
      /* flush input and output queues, important for modems! */
      (void) tcflush(0, TCIOFLUSH);
  
 -    tp->c_cflag = CS8 | HUPCL | CREAD;
 +    tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);
-     cfsetispeed(tp, speed);
-     cfsetospeed(tp, speed);
-     if (op->flags & F_LOCAL) {
+ 
+     if (!(op->flags & F_KEEPSPEED)) {
+ 	    cfsetispeed(tp, op->speeds[FIRST_SPEED]);
 -- 
-1.6.6.1
+1.7.2
 
diff --git a/util-linux-ng.spec b/util-linux-ng.spec
index 846dbe9..af7f369 100644
--- a/util-linux-ng.spec
+++ b/util-linux-ng.spec
@@ -2,7 +2,7 @@
 Summary: A collection of basic system utilities
 Name: util-linux-ng
 Version: 2.18
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
 Group: System Environment/Base
 URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng
@@ -109,10 +109,12 @@ Patch8: util-linux-ng-2.15-ipcs-32bit.patch
 
 ### Upstream Patches
 ###
+# 623685 - please extend agetty to not require a baud rate to be specified
+Patch9: util-linux-ng-2.18-agetty-baudrate.patch
 # 598631 - shutdown, reboot, halt and C-A-D don't work
-Patch9: util-linux-ng-2.17-agetty-clocal.patch
+Patch10: util-linux-ng-2.18-agetty-clocal.patch
 # 618957 - ISO images listed in fstab are mounted twice at boot
-Patch10: util-linux-ng-2.17-mount-loopdev.patch
+Patch11: util-linux-ng-2.17-mount-loopdev.patch
 
 %description
 The util-linux-ng package contains a large variety of low-level system
@@ -229,6 +231,7 @@ cp %{SOURCE8} %{SOURCE9} .
 %patch8 -p1
 %patch9 -p1
 %patch10 -p1
+%patch11 -p1
 
 %build
 unset LINGUAS || :
@@ -765,6 +768,9 @@ fi
 
 
 %changelog
+* Wed Aug 18 2010 Karel Zak <kzak at redhat.com> 2.18-4
+- fix #623685 - please extend agetty to not require a baud rate to be specified
+
 * Thu Aug  5 2010 Karel Zak <kzak at redhat.com> 2.18-3
 - fix #620924 - /sbin/mount.tmpfs uses not available /usr/bin/id
 


More information about the scm-commits mailing list