[util-linux-ng] 2.18-5: fix agetty -s (#645640)
kzak
kzak at fedoraproject.org
Tue Oct 26 22:18:54 UTC 2010
commit 334e0e7abe683e5df22777c8f0f5f8b2631b51b5
Author: Karel Zak <kzak at redhat.com>
Date: Tue Oct 26 23:39:38 2010 +0200
2.18-5: fix agetty -s (#645640)
Signed-off-by: Karel Zak <kzak at redhat.com>
util-linux-ng-2.18-agetty-baudrate.patch | 127 ++++++++++++++++++++++--------
util-linux-ng-2.18-agetty-clocal.patch | 42 +++++------
util-linux-ng.spec | 6 +-
3 files changed, 117 insertions(+), 58 deletions(-)
---
diff --git a/util-linux-ng-2.18-agetty-baudrate.patch b/util-linux-ng-2.18-agetty-baudrate.patch
index 68397dd..72dc257 100644
--- a/util-linux-ng-2.18-agetty-baudrate.patch
+++ b/util-linux-ng-2.18-agetty-baudrate.patch
@@ -1,27 +1,50 @@
-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:
+ based on upstream patch:
+
+ commit 848e5e6ce3978d921366b799d907a78a12299924
+ Author: Karel Zak <kzak at redhat.com>
+ Date: Wed Aug 18 09:02:03 2010 +0200
+
+ 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.
+ 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>
+
+ and
-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(-)
+ commit e98f4af950a64db188e0a9f3eed20fefaa463a99
+ Author: Karel Zak <kzak at redhat.com>
+ Date: Fri Oct 22 21:24:50 2010 +0200
-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
+ agetty: fix -s option (baud rate setup)
+
+ The problem is pretty visible in strace output:
+
+ broken version:
+ ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
+ [...]
+ ioctl(0, SNDCTL_TMR_START or TCSETS, {B0 -opost -isig -icanon -echo ...}) = 0
+ ^^^
+ fixed version:
+ ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
+ [...]
+ ioctl(0, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
+
+ Reported-by: Jon Masters <jcm at redhat.com>
+ Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=645640
+ Signed-off-by: Karel Zak <kzak at redhat.com>
+
+diff -up util-linux-ng-2.18/login-utils/agetty.8.kzak util-linux-ng-2.18/login-utils/agetty.8
+--- util-linux-ng-2.18/login-utils/agetty.8.kzak 2010-02-04 12:53:56.000000000 +0100
++++ util-linux-ng-2.18/login-utils/agetty.8 2010-10-22 22:07:43.000000000 +0200
@@ -3,7 +3,7 @@
agetty \- alternative Linux getty
@@ -48,7 +71,7 @@ index 8761374..53037dd 100644
.SH DESCRIPTION
.ad
-@@ -163,6 +153,10 @@ Force the line to be a local line with no need for carrier detect. This can
+@@ -163,6 +153,10 @@ Force the line to be a local line with n
be useful when you have a locally attached terminal where the serial line
does not set the carrier detect signal.
.TP
@@ -59,10 +82,9 @@ index 8761374..53037dd 100644
\-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
+diff -up util-linux-ng-2.18/login-utils/agetty.c.kzak util-linux-ng-2.18/login-utils/agetty.c
+--- util-linux-ng-2.18/login-utils/agetty.c.kzak 2010-04-01 16:11:56.000000000 +0200
++++ util-linux-ng-2.18/login-utils/agetty.c 2010-10-22 22:15:40.000000000 +0200
@@ -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! */
@@ -71,7 +93,7 @@ index 39a1fd3..9fc389b 100644
/* 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));
+@@ -203,7 +204,7 @@ void parse_args P_((int argc, char **arg
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));
@@ -108,7 +130,7 @@ index 39a1fd3..9fc389b 100644
case 't': /* time out */
if ((op->timeout = atoi(optarg)) <= 0)
error(_("bad timeout value: %s"), optarg);
-@@ -691,9 +695,8 @@ char gbuf[1024];
+@@ -691,11 +695,17 @@ char gbuf[1024];
char area[1024];
void
@@ -118,22 +140,62 @@ index 39a1fd3..9fc389b 100644
- int speed;
struct options *op;
{
++ speed_t ispeed, ospeed;
++
++ if (op->flags & F_KEEPSPEED) {
++ ispeed = cfgetispeed(tp); /* save the original setting */
++ ospeed = cfgetospeed(tp);
++ } else
++ ospeed = ispeed = op->speeds[FIRST_SPEED];
-@@ -707,8 +710,11 @@ termio_init(tp, speed, op)
+ /*
+ * Initial termios settings: 8-bit characters, raw-mode, blocking i/o.
+@@ -706,14 +716,20 @@ termio_init(tp, speed, op)
+ /* flush input and output queues, important for modems! */
(void) tcflush(0, TCIOFLUSH);
++ tp->c_iflag = tp->c_lflag = tp->c_oflag = 0;
++
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]);
-+ }
++ /* Note that the speed is stored in the c_cflag termios field, so we have
++ * set the speed always when the cflag se reseted.
++ */
++ cfsetispeed(tp, ispeed);
++ cfsetospeed(tp, ospeed);
++
if (op->flags & F_LOCAL) {
tp->c_cflag |= CLOCAL;
}
-@@ -1203,7 +1209,7 @@ bcode(s)
+
+- tp->c_iflag = tp->c_lflag = tp->c_oflag = 0;
+ #ifdef HAVE_STRUCT_TERMIOS_C_LINE
+ tp->c_line = 0;
+ #endif
+@@ -973,9 +989,18 @@ next_speed(tp, op)
+ struct termios *tp;
+ struct options *op;
+ {
+- static int baud_index = FIRST_SPEED;/* current speed index */
++ static int baud_index = -1;
++
++ if (baud_index == -1)
++ /*
++ * if the F_KEEPSPEED flags is set then the FIRST_SPEED is not
++ * tested yet (see termio_init()).
++ */
++ baud_index = (op->flags & F_KEEPSPEED) ? FIRST_SPEED :
++ 1 % op->numspeed;
++ else
++ baud_index = (baud_index + 1) % op->numspeed;
+
+- baud_index = (baud_index + 1) % op->numspeed;
+ cfsetispeed(tp, op->speeds[baud_index]);
+ cfsetospeed(tp, op->speeds[baud_index]);
+ (void) tcsetattr(0, TCSANOW, tp);
+@@ -1203,7 +1228,7 @@ bcode(s)
void
usage()
{
@@ -142,6 +204,3 @@ index 39a1fd3..9fc389b 100644
exit(1);
}
---
-1.7.2
-
diff --git a/util-linux-ng-2.18-agetty-clocal.patch b/util-linux-ng-2.18-agetty-clocal.patch
index 1708e4d..5d0b677 100644
--- a/util-linux-ng-2.18-agetty-clocal.patch
+++ b/util-linux-ng-2.18-agetty-clocal.patch
@@ -1,30 +1,26 @@
-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
-gettey should not clear the flag. It seems that the flag is
-automatically enabled for serial consoles tht don't use CD signal.
+ backport of upstream patch:
-Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=598631
-Signed-off-by: Karel Zak <kzak at redhat.com>
----
- login-utils/agetty.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+ Commit: e143d1f00497f0178a1febec8fb4aa7c842fa35a
+ From: Karel Zak <kzak at redhat.com>
+ Date: Mon, 12 Jul 2010 11:57:55 +0200
+ Subject: [PATCH] aggety: don't wipe CLOCAL flag
-diff --git a/login-utils/agetty.c b/login-utils/agetty.c
-index 9fc389b..2541948 100644
---- a/login-utils/agetty.c
-+++ b/login-utils/agetty.c
-@@ -709,7 +709,7 @@ termio_init(tp, op)
- /* flush input and output queues, important for modems! */
- (void) tcflush(0, TCIOFLUSH);
+ gettey should not clear the flag. It seems that the flag is
+ automatically enabled for serial consoles tht don't use CD signal.
+
+ Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=598631
+ Signed-off-by: Karel Zak <kzak at redhat.com>
+
+diff -up util-linux-ng-2.18/login-utils/agetty.c.kzak util-linux-ng-2.18/login-utils/agetty.c
+--- util-linux-ng-2.18/login-utils/agetty.c.kzak 2010-10-22 21:51:31.000000000 +0200
++++ util-linux-ng-2.18/login-utils/agetty.c 2010-10-22 21:51:31.000000000 +0200
+@@ -715,7 +715,7 @@ termio_init(tp, speed, op)
+
+ tp->c_iflag = tp->c_lflag = tp->c_oflag = 0;
- tp->c_cflag = CS8 | HUPCL | CREAD;
+ tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);
- if (!(op->flags & F_KEEPSPEED)) {
- cfsetispeed(tp, op->speeds[FIRST_SPEED]);
---
-1.7.2
-
+ /* Note that the speed is stored in the c_cflag termios field, so we have
+ * set the speed always when the cflag se reseted.
diff --git a/util-linux-ng.spec b/util-linux-ng.spec
index af7f369..f30a19e 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: 4%{?dist}
+Release: 5%{?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
@@ -110,6 +110,7 @@ Patch8: util-linux-ng-2.15-ipcs-32bit.patch
### Upstream Patches
###
# 623685 - please extend agetty to not require a baud rate to be specified
+# 645640 - new "-s" parameter parsing in agetty does not work
Patch9: util-linux-ng-2.18-agetty-baudrate.patch
# 598631 - shutdown, reboot, halt and C-A-D don't work
Patch10: util-linux-ng-2.18-agetty-clocal.patch
@@ -768,6 +769,9 @@ fi
%changelog
+* Tue Oct 26 2010 Karel Zak <kzak at redhat.com> 2.18-5
+- fix #645640 - new "-s" parameter parsing in agetty does not work
+
* 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
More information about the scm-commits
mailing list