rpms/util-linux-ng/F-9 mount-add-docs-about-utf8-0-for-vfat.patch, NONE, 1.1 rtcwake-rebase-2.14.1.patch, NONE, 1.1 write-doesn-t-check-for-tty-group.patch, NONE, 1.1 util-linux-ng.spec, 1.25, 1.26

Karel Zak (kzak) fedora-extras-commits at redhat.com
Tue Aug 12 14:03:52 UTC 2008


Author: kzak

Update of /cvs/pkgs/rpms/util-linux-ng/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29801

Modified Files:
	util-linux-ng.spec 
Added Files:
	mount-add-docs-about-utf8-0-for-vfat.patch 
	rtcwake-rebase-2.14.1.patch 
	write-doesn-t-check-for-tty-group.patch 
Log Message:
* Tue Aug 12 2008 Karel Zak <kzak at redhat.com> 2.13.1-8.3
- fix #454252 - Problem with who,write and tty permissions
- fix #449738 - Wakeup on RTC alarm does not work anymore
                [rebase to rtcwake(8) from util-linux-ng 2.14.1]
- fix #454354 - FAT filesystem mount option utf8=0 is not documented


mount-add-docs-about-utf8-0-for-vfat.patch:

--- NEW FILE mount-add-docs-about-utf8-0-for-vfat.patch ---
diff -up util-linux-ng-2.13.1/mount/mount.8.kzak util-linux-ng-2.13.1/mount/mount.8
--- util-linux-ng-2.13.1/mount/mount.8.kzak	2008-08-12 15:34:29.000000000 +0200
+++ util-linux-ng-2.13.1/mount/mount.8	2008-08-12 15:34:32.000000000 +0200
@@ -1729,9 +1729,10 @@ before trying
 .IR name~num.ext .
 .TP
 .B utf8
-UTF8 is the filesystem safe 8-bit encoding of Unicode that is used
-by the console. It can be be enabled for the filesystem with this option.
-If `uni_xlate' gets set, UTF8 gets disabled.
+UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the
+console. It can be be enabled for the filesystem with this option or disabled
+with utf8=0, utf8=no or utf8=false. If `uni_xlate' gets set, UTF8 gets
+disabled.
 .TP
 .B shortname=[lower|win95|winnt|mixed]
 

rtcwake-rebase-2.14.1.patch:

--- NEW FILE rtcwake-rebase-2.14.1.patch ---
diff -up util-linux-ng-2.13.1/sys-utils/rtcwake.8.kzak util-linux-ng-2.13.1/sys-utils/rtcwake.8
--- util-linux-ng-2.13.1/sys-utils/rtcwake.8.kzak	2008-08-12 15:26:02.000000000 +0200
+++ util-linux-ng-2.13.1/sys-utils/rtcwake.8	2008-08-12 15:26:02.000000000 +0200
@@ -76,15 +76,20 @@ is the time in seconds since 1970-01-01,
 Use standby state \fImode\fP. Valid values are \fIstandby\fP,
 \fImem\fP, \fIdisk\fP and \fIon\fP (no suspend). The default is
 \fIstandby\fP.
+.SH NOTES
+Some PC systems can't currently exit sleep states such as \fImem\fP
+using only the kernel code accessed by this driver.
+They need help from userspace code to make the framebuffer work again.
 .SH HISTORY
-The program first appeared as kernel commit message for Linux 2.6 in the GIT
+The program was posted several times on LKML and other lists
+before appearing in kernel commit message for Linux 2.6 in the GIT
 commit 87ac84f42a7a580d0dd72ae31d6a5eb4bfe04c6d.
 .SH AVAILABILITY
 The rtcwake command is part of the util-linux-ng package and is available from
 ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
 .SH AUTHOR
-The program was written by David Brownell <david-b at pacbell.net> and improved by
-Bernhard Walle <bwalle at suse.de>.
+The program was written by David Brownell <dbrownell at users.sourceforge.net>
+and improved by Bernhard Walle <bwalle at suse.de>.
 .SH COPYRIGHT
 This is free software.  You may redistribute copies of it  under  the  terms
 of  the  GNU General  Public  License <http://www.gnu.org/licenses/gpl.html>.
diff -up util-linux-ng-2.13.1/sys-utils/rtcwake.c.kzak util-linux-ng-2.13.1/sys-utils/rtcwake.c
--- util-linux-ng-2.13.1/sys-utils/rtcwake.c.kzak	2008-08-12 15:17:56.000000000 +0200
+++ util-linux-ng-2.13.1/sys-utils/rtcwake.c	2008-08-12 15:25:35.000000000 +0200
@@ -16,11 +16,13 @@
  * The best way to set the system's RTC is so that it holds the current
  * time in UTC.  Use the "-l" flag to tell this program that the system
  * RTC uses a local timezone instead (maybe you dual-boot MS-Windows).
+ * That flag should not be needed on systems with adjtime support.
  */
 
 #include <stdio.h>
 #include <getopt.h>
 #include <fcntl.h>
+#include <libgen.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -46,10 +48,10 @@ static char		*progname;
 
 #define VERSION_STRING		"rtcwake from " PACKAGE_STRING
 #define RTC_PATH		"/sys/class/rtc/%s/device/power/wakeup"
-#define SYS_POWER_SATE_PATH	"/sys/power/state"
+#define SYS_POWER_STATE_PATH	"/sys/power/state"
 #define ADJTIME_PATH		"/etc/adjtime"
 #define DEFAULT_DEVICE		"/dev/rtc0"
-#define DEFAULT_MODE		"suspend"
+#define DEFAULT_MODE		"standby"
 
 enum ClockMode {
 	CM_AUTO,
@@ -89,7 +91,7 @@ static void usage(int retval)
 	exit(retval);
 }
 
-static int may_wakeup(const char *devname)
+static int is_wakeup_enabled(const char *devname)
 {
 	char	buf[128], *s;
 	FILE	*f;
@@ -136,12 +138,12 @@ static int get_basetimes(int fd)
 	 */
 	if (ioctl(fd, RTC_RD_TIME, &rtc) < 0) {
 		perror(_("read rtc time"));
-		return 0;
+		return -1;
 	}
 	sys_time = time(0);
 	if (sys_time == (time_t)-1) {
 		perror(_("read system time"));
-		return 0;
+		return -1;
 	}
 
 	/* convert rtc_time to normal arithmetic-friendly form,
@@ -159,22 +161,26 @@ static int get_basetimes(int fd)
 
 	if (rtc_time == (time_t)-1) {
 		perror(_("convert rtc time"));
-		return 0;
+		return -1;
 	}
 
 	if (verbose) {
-		if (clock_mode == CM_LOCAL) {
-			printf("\ttzone   = %ld\n", timezone);
-			printf("\ttzname  = %s\n", tzname[daylight]);
-			gmtime_r(&rtc_time, &tm);
-		}
-		printf("\tsystime = %ld, (UTC) %s\n",
+		/* Unless the system uses UTC, either delta or tzone
+		 * reflects a seconds offset from UTC.  The value can
+		 * help sort out problems like bugs in your C library.
+		 */
+		printf("\tdelta   = %ld\n", sys_time - rtc_time);
+		printf("\ttzone   = %ld\n", timezone);
+
+		printf("\ttzname  = %s\n", tzname[daylight]);
+		gmtime_r(&rtc_time, &tm);
+		printf("\tsystime = %ld, (UTC) %s",
 				(long) sys_time, asctime(gmtime(&sys_time)));
-		printf("\trtctime = %ld, (UTC) %s\n",
+		printf("\trtctime = %ld, (UTC) %s",
 				(long) rtc_time, asctime(&tm));
 	}
 
-	return 1;
+	return 0;
 }
 
 static int setup_alarm(int fd, time_t *wakeup)
@@ -182,7 +188,17 @@ static int setup_alarm(int fd, time_t *w
 	struct tm		*tm;
 	struct rtc_wkalrm	wake;
 
-	tm = gmtime(wakeup);
+	/* The wakeup time is in POSIX time (more or less UTC).
+	 * Ideally RTCs use that same time; but PCs can't do that
+	 * if they need to boot MS-Windows.  Messy...
+	 *
+	 * When clock_mode == CM_UTC this process's timezone is UTC,
+	 * so we'll pass a UTC date to the RTC.
+	 *
+	 * Else clock_mode == CM_LOCAL so the time given to the RTC
+	 * will instead use the local time zone.
+	 */
+	tm = localtime(wakeup);
 
 	wake.time.tm_sec = tm->tm_sec;
 	wake.time.tm_min = tm->tm_min;
@@ -190,41 +206,41 @@ static int setup_alarm(int fd, time_t *w
 	wake.time.tm_mday = tm->tm_mday;
 	wake.time.tm_mon = tm->tm_mon;
 	wake.time.tm_year = tm->tm_year;
-	wake.time.tm_wday = tm->tm_wday;
-	wake.time.tm_yday = tm->tm_yday;
-	wake.time.tm_isdst = tm->tm_isdst;
-
-	/* many rtc alarms only support up to 24 hours from 'now' ... */
-	if ((rtc_time + (24 * 60 * 60)) > *wakeup) {
-		if (ioctl(fd, RTC_ALM_SET, &wake.time) < 0) {
-			perror(_("set rtc alarm"));
-			return 0;
-		}
-		if (ioctl(fd, RTC_AIE_ON, 0) < 0) {
-			perror(_("enable rtc alarm"));
-			return 0;
-		}
-
-		/* ... so use the "more than 24 hours" request only if we must */
-	} else {
-		/* avoid an extra AIE_ON call */
-		wake.enabled = 1;
-
-		if (ioctl(fd, RTC_WKALM_SET, &wake) < 0) {
+	/* wday, yday, and isdst fields are unused by Linux */
+	wake.time.tm_wday = -1;
+	wake.time.tm_yday = -1;
+	wake.time.tm_isdst = -1;
+
+	wake.enabled = 1;
+	/* First try the preferred RTC_WKALM_SET */
+	if (ioctl(fd, RTC_WKALM_SET, &wake) < 0) {
+		wake.enabled = 0;
+		/* Fall back on the non-preferred way of setting wakeups; only
+		* works for alarms < 24 hours from now */
+		if ((rtc_time + (24 * 60 * 60)) > *wakeup) {
+			if (ioctl(fd, RTC_ALM_SET, &wake.time) < 0) {
+				perror(_("set rtc alarm"));
+				return -1;
+			}
+			if (ioctl(fd, RTC_AIE_ON, 0) < 0) {
+				perror(_("enable rtc alarm"));
+				return -1;
+			}
+		} else {
 			perror(_("set rtc wake alarm"));
-			return 0;
+			return -1;
 		}
 	}
 
-	return 1;
+	return 0;
 }
 
 static void suspend_system(const char *suspend)
 {
-	FILE	*f = fopen(SYS_POWER_SATE_PATH, "w");
+	FILE	*f = fopen(SYS_POWER_STATE_PATH, "w");
 
 	if (!f) {
-		perror(SYS_POWER_SATE_PATH);
+		perror(SYS_POWER_STATE_PATH);
 		return;
 	}
 
@@ -243,24 +259,24 @@ static int read_clock_mode(void)
 
 	fp = fopen(ADJTIME_PATH, "r");
 	if (!fp)
-		return 0;
+		return -1;
 
 	/* skip first line */
 	if (!fgets(linebuf, MAX_LINE, fp)) {
 		fclose(fp);
-		return 0;
+		return -1;
 	}
 
 	/* skip second line */
 	if (!fgets(linebuf, MAX_LINE, fp)) {
 		fclose(fp);
-		return 0;
+		return -1;
 	}
 
 	/* read third line */
 	if (!fgets(linebuf, MAX_LINE, fp)) {
 		fclose(fp);
-		return 0;
+		return -1;
 	}
 
 	if (strncmp(linebuf, "UTC", 3) == 0)
@@ -270,7 +286,7 @@ static int read_clock_mode(void)
 
 	fclose(fp);
 
-	return 1;
+	return 0;
 }
 
 int main(int argc, char **argv)
@@ -321,8 +337,9 @@ int main(int argc, char **argv)
 				suspend = strdup(optarg);
 				break;
 			}
-			fprintf(stderr, _("%s: unrecognized suspend state '%s'\n"),
-					progname, optarg);
+			fprintf(stderr,
+				_("%s: unrecognized suspend state '%s'\n"),
+				progname, optarg);
 			usage(EXIT_FAILURE);
 
 			/* alarm time, seconds-to-sleep (relative) */
@@ -372,14 +389,14 @@ int main(int argc, char **argv)
 	}
 
 	if (clock_mode == CM_AUTO) {
-		if (!read_clock_mode()) {
+		if (read_clock_mode() < 0) {
 			printf(_("%s: assuming RTC uses UTC ...\n"), progname);
 			clock_mode = CM_UTC;
 		}
-		if (verbose)
-			printf(_("Using %s time\n"),
-					clock_mode == CM_UTC ? "UTC" : _("local"));
 	}
+	if (verbose)
+		printf(clock_mode == CM_UTC ? _("Using UTC time.\n") :
+				_("Using local time.\n"));
 
 	if (!alarm && !seconds) {
 		fprintf(stderr, _("%s: must provide wake time\n"), progname);
@@ -402,7 +419,7 @@ int main(int argc, char **argv)
 		devname = new_devname;
 	}
 
-	if (strcmp(suspend, "on") != 0 && !may_wakeup(devname)) {
+	if (strcmp(suspend, "on") != 0 && !is_wakeup_enabled(devname)) {
 		fprintf(stderr, _("%s: %s not enabled for wakeup events\n"),
 				progname, devname);
 		exit(EXIT_FAILURE);
@@ -416,15 +433,16 @@ int main(int argc, char **argv)
 	}
 
 	/* relative or absolute alarm time, normalized to time_t */
-	if (!get_basetimes(fd))
+	if (get_basetimes(fd) < 0)
 		exit(EXIT_FAILURE);
 	if (verbose)
 		printf(_("alarm %ld, sys_time %ld, rtc_time %ld, seconds %u\n"),
 				alarm, sys_time, rtc_time, seconds);
 	if (alarm) {
 		if (alarm < sys_time) {
-			fprintf(stderr, _("%s: time doesn't go backward to %s\n"),
-					progname, ctime(&alarm));
+			fprintf(stderr,
+				_("%s: time doesn't go backward to %s\n"),
+				progname, ctime(&alarm));
 			exit(EXIT_FAILURE);
 		}
 		alarm += sys_time - rtc_time;

write-doesn-t-check-for-tty-group.patch:

--- NEW FILE write-doesn-t-check-for-tty-group.patch ---
>From ced94242e11e2ac121c9dae5c707bac5b47e501a Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak at redhat.com>
Date: Mon, 7 Jul 2008 15:22:22 +0200
Subject: [PATCH] write: doesn't check for tty group

write(1) selects a wrong tty, because there is not a proper
check of tty group ownership:

	$ write kzak
	write: kzak is logged in more than once; writing to tty7
	write: /dev/tty7: Permission denied

	$ ls -la /dev/tty7
	crw--w---- 1 root root 4, 7 2008-07-04 00:32 /dev/tty7
	                  ^^^^

	$ ls -la /usr/bin/write
	-rwxr-sr-x 1 root tty 11864 2008-04-02 16:24 /usr/bin/write
	      ^           ^^^

We have to check for tty group owner, because we don't have
permissions to write to arbitrary tty.

Fixed version:

	$ write kzak
	write: kzak is logged in more than once; writing to pts/6
	                                                    ^^^^
	Message from test at nb on pts/7 at 15:22 ...

	^C

	$ ls -la /dev/pts/6
	crw--w---- 1 kzak tty 136, 6 2008-07-07 15:35 /dev/pts/6
	                  ^^^

Addresses-Red-Hat-Bugzilla: #454252
Signed-off-by: Karel Zak <kzak at redhat.com>
---
 misc-utils/write.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/misc-utils/write.c b/misc-utils/write.c
index 46b8f0a..276fe96 100644
--- a/misc-utils/write.c
+++ b/misc-utils/write.c
@@ -72,6 +72,8 @@ static void done(int);
 int term_chk(char *, int *, time_t *, int);
 int utmp_chk(char *, char *);
 
+static gid_t myegid;
+
 int
 main(int argc, char **argv) {
 	time_t atime;
@@ -83,6 +85,8 @@ main(int argc, char **argv) {
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
+	myegid = getegid();
+
 	/* check that sender has write enabled */
 	if (isatty(fileno(stdin)))
 		myttyfd = fileno(stdin);
@@ -267,7 +271,9 @@ int term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
 			    "write: %s: %s\n", path, strerror(errno));
 		return(1);
 	}
-	*msgsokP = (s.st_mode & (S_IWRITE >> 3)) != 0;	/* group write bit */
+
+	/* group write bit and group ownership */
+	*msgsokP = (s.st_mode & (S_IWRITE >> 3)) && myegid == s.st_gid;
 	*atimeP = s.st_atime;
 	return(0);
 }
-- 
1.5.5.1



Index: util-linux-ng.spec
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-9/util-linux-ng.spec,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- util-linux-ng.spec	28 Apr 2008 10:34:54 -0000	1.25
+++ util-linux-ng.spec	12 Aug 2008 14:03:21 -0000	1.26
@@ -2,7 +2,7 @@
 Summary: A collection of basic system utilities
 Name: util-linux-ng
 Version: 2.13.1
-Release: 8.2%{?dist}
+Release: 8.3%{?dist}
 License: GPLv2 and GPLv2+ 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,13 @@
 Patch14: util-linux-ng-2.13-login-audit.patch
 # 443823 - ionice.1 doesn't to reflect idle class changes in 2.6.25
 Patch15: util-linux-ng-2.13-ionice-man-idle.patch
+# 454252 - Problem with who,write and tty permissions (upstream patch)
+Patch16: write-doesn-t-check-for-tty-group.patch
+# 449738 -  Wakeup on RTC alarm does not work anymore
+# [rebase to rtcwake(8) from util-linux-ng 2.14.1]
+Patch17: rtcwake-rebase-2.14.1.patch
+# 454354 - FAT filesystem mount option utf8=0 is not documented
+Patch18: mount-add-docs-about-utf8-0-for-vfat.patch
 
 %description
 The util-linux-ng package contains a large variety of low-level system
@@ -137,6 +144,9 @@
 %patch13 -p1
 %patch14 -p1
 %patch15 -p1
+%patch16 -p1
+%patch17 -p1
+%patch18 -p1
 
 %build
 unset LINGUAS || :
@@ -530,6 +540,12 @@
 /sbin/losetup
 
 %changelog
+* Tue Aug 12 2008 Karel Zak <kzak at redhat.com> 2.13.1-8.3
+- fix #454252 - Problem with who,write and tty permissions
+- fix #449738 - Wakeup on RTC alarm does not work anymore
+                [rebase to rtcwake(8) from util-linux-ng 2.14.1]
+- fix #454354 - FAT filesystem mount option utf8=0 is not documented
+
 * Mon Apr 28 2008 Karel Zak <kzak at redhat.com> 2.13.1-8.2
 - fix #443823 - ionice.1 doesn't to reflect idle class changes in 2.6.25
 




More information about the fedora-extras-commits mailing list