rpms/util-linux-ng/F-10 util-linux-ng-2.14-flock-segfault.patch, NONE, 1.1 util-linux-ng-2.14-mount-canonicalize.patch, NONE, 1.1 util-linux-ng-2.14-setterm-man-blank.patch, NONE, 1.1 util-linux-ng.spec, 1.35, 1.36

Karel Zak kzak at fedoraproject.org
Mon Jun 1 11:04:36 UTC 2009


Author: kzak

Update of /cvs/pkgs/rpms/util-linux-ng/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19761

Modified Files:
	util-linux-ng.spec 
Added Files:
	util-linux-ng-2.14-flock-segfault.patch 
	util-linux-ng-2.14-mount-canonicalize.patch 
	util-linux-ng-2.14-setterm-man-blank.patch 
Log Message:
* Mon Jun  1 2009 Karel Zak <kzak at redhat.com> 2.14.1-3.3
- fix #489672 - flock segfaults when file name is not given
- fix #503266 - mountpoint named tmpfs confuses the mount command
- fix #474628 - setterm -blank no longer works as documented


util-linux-ng-2.14-flock-segfault.patch:

--- NEW FILE util-linux-ng-2.14-flock-segfault.patch ---
Based on upstream patch:

	commit 841f86dbc2e35166fd43341c8eb144680b0c7ece
	Author: Karel Zak <kzak at redhat.com>
	Date:   Wed Mar 11 12:49:50 2009 +0100

diff -up util-linux-ng-2.14.1/sys-utils/flock.c.kzak util-linux-ng-2.14.1/sys-utils/flock.c
--- util-linux-ng-2.14.1/sys-utils/flock.c.kzak	2008-09-10 11:02:43.000000000 +0200
+++ util-linux-ng-2.14.1/sys-utils/flock.c	2009-06-01 12:49:22.000000000 +0200
@@ -213,7 +213,7 @@ int main(int argc, char *argv[])
 	   EX_NOINPUT);
     }
 
-  } else {
+  } else if (optind < argc) {
     /* Use provided file descriptor */
 
     fd = (int)strtol(argv[optind], &eon, 10);
@@ -222,8 +222,15 @@ int main(int argc, char *argv[])
       exit(EX_USAGE);
     }
 
+  } else {
+    /* Bad options */
+
+    fprintf(stderr, "%s: requires file descriptor, file or directory\n",
+		program);
+    exit(EX_USAGE);
   }
 
+
   if ( have_timeout ) {
     if ( timeout.it_value.tv_sec == 0 &&
 	 timeout.it_value.tv_usec == 0 ) {

util-linux-ng-2.14-mount-canonicalize.patch:

--- NEW FILE util-linux-ng-2.14-mount-canonicalize.patch ---

 Based on upstream patch:

	From f1b3f066f7cbeee0864317fb85e8bb622da34917 Mon Sep 17 00:00:00 2001
	From: Karel Zak <kzak at redhat.com>
	Date: Sat, 13 Dec 2008 02:47:42 +0100
	Subject: [PATCH] mount: clean up SPEC canonicalization

	The SPEC (fsname) field in fstab/mtab could be:

	 - devname
	 - NAME=value (e.g LABEL, UUID)
	 - directory (MS_MOVE, MS_BIND, ..)
	 - pseudo-fs keyword (tmpfs, proc, sysfs, ...)

	the pseudo-fs keywords shouldn't be canonicalized to absolute path. It
	means we have to differ between SPEC and mountpoint (fs_dir).

	Unfortunately, the keywords was checked on wrong place. This patch
	move this check to the new function canonicalize_spec().

	The fsname in mtab entry is canonicalized when the FS type is not
	pseudo filesystem.

	Signed-off-by: Karel Zak <kzak at redhat.com>
	---
	 mount/fsprobe.c  |    5 +++++
	 mount/fstab.c    |   13 +++++++------
	 mount/mount.c    |   18 ++++++++++++------
	 mount/realpath.c |   22 ++++++++++++++++------
	 mount/realpath.h |    3 ++-
	 5 files changed, 42 insertions(+), 19 deletions(-)

diff -up util-linux-ng-2.14.1/mount/fsprobe.c.kzak util-linux-ng-2.14.1/mount/fsprobe.c
--- util-linux-ng-2.14.1/mount/fsprobe.c.kzak	2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/fsprobe.c	2009-06-01 11:20:32.000000000 +0200
@@ -170,6 +170,9 @@ fsprobe_get_devname_for_mounting(const c
 	if (!spec)
 		return NULL;
 
+	if (is_pseudo_fs(spec))
+		return xstrdup(spec);
+
 	if (parse_spec(spec, &name, &value) != 0)
 		return NULL;				/* parse error */
 
@@ -203,6 +206,8 @@ fsprobe_get_devname(const char *spec)
 
 	if (!spec)
 		return NULL;
+	if (is_pseudo_fs(spec))
+		return xstrdup(spec);
 
 	if (parse_spec(spec, &name, &value) != 0)
 		return NULL;				/* parse error */
diff -up util-linux-ng-2.14.1/mount/fstab.c.kzak util-linux-ng-2.14.1/mount/fstab.c
--- util-linux-ng-2.14.1/mount/fstab.c.kzak	2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/fstab.c	2009-06-01 11:20:32.000000000 +0200
@@ -323,7 +323,7 @@ getfs_by_specdir (const char *spec, cons
 	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
 		/* dir */
 		if (!streq(mc->m.mnt_dir, dir)) {
-			char *dr = canonicalize_mountpoint(mc->m.mnt_dir);
+			char *dr = canonicalize(mc->m.mnt_dir);
 			int ok = 0;
 
 			if (streq(dr, dir))
@@ -335,7 +335,7 @@ getfs_by_specdir (const char *spec, cons
 
 		/* spec */
 		if (!streq(mc->m.mnt_fsname, spec)) {
-			char *fs = canonicalize(mc->m.mnt_fsname);
+			char *fs = canonicalize_spec(mc->m.mnt_fsname);
 			int ok = 0;
 
 			if (streq(fs, spec))
@@ -369,7 +369,7 @@ getfs_by_dir (const char *dir) {
 		if (streq(mc->m.mnt_dir, dir))
 			return mc;
 
-	cdir = canonicalize_mountpoint(dir);
+	cdir = canonicalize(dir);
 	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
 		if (streq(mc->m.mnt_dir, cdir)) {
 			free(cdir);
@@ -402,7 +402,7 @@ getfs_by_spec (const char *spec) {
 		return mc;
 	}
 
-	cspec = canonicalize(spec);
+	cspec = canonicalize_spec(spec);
 	mc = getfs_by_devname(cspec);
 	free(cspec);
 
@@ -433,7 +433,7 @@ getfs_by_devname (const char *devname) {
 				strncmp(mc->m.mnt_fsname, "UUID=", 5) == 0)
 			continue;
 
-		fs = canonicalize(mc->m.mnt_fsname);
+		fs = canonicalize_spec(mc->m.mnt_fsname);
 		if (streq(fs, devname)) {
 			free(fs);
 			return mc;
@@ -919,7 +919,8 @@ void my_endmntent (mntFILE *mfp) { }
 int my_addmntent (mntFILE *mfp, struct my_mntent *mnt) { return 0; }
 
 char *canonicalize (const char *path) {  return NULL; }
-char *canonicalize_mountpoint (const char *path) { return NULL; }
+char *canonicalize_spec (const char *path) { return NULL; }
+int is_pseudo_fs(const char *type) { return 0; };
 
 int
 main(int argc, char **argv)
diff -up util-linux-ng-2.14.1/mount/mount.c.kzak util-linux-ng-2.14.1/mount/mount.c
--- util-linux-ng-2.14.1/mount/mount.c.kzak	2009-06-01 10:22:19.000000000 +0200
+++ util-linux-ng-2.14.1/mount/mount.c	2009-06-01 11:20:32.000000000 +0200
@@ -240,7 +240,7 @@ print_one (const struct my_mntent *me) {
 		printf (" type %s", me->mnt_type);
 	if (me->mnt_opts != NULL)
 		printf (" (%s)", me->mnt_opts);
-	if (list_with_volumelabel) {
+	if (list_with_volumelabel && is_pseudo_fs(me->mnt_type) == 0) {
 		const char *devname = fsprobe_get_devname(me->mnt_fsname);
 
 		if (devname) {
@@ -498,9 +498,11 @@ fix_opts_string (int flags, const char *
 }
 
 static int
-already (const char *spec, const char *node) {
+already (const char *spec0, const char *node0) {
 	struct mntentchn *mc;
 	int ret = 1;
+	char *spec = canonicalize_spec(spec0);
+	char *node = canonicalize(node0);
 
 	if ((mc = getmntfile(node)) != NULL)
 		error (_("mount: according to mtab, "
@@ -512,6 +514,10 @@ already (const char *spec, const char *n
 		       spec, mc->m.mnt_dir);
 	else
 		ret = 0;
+
+	free(spec);
+	free(node);
+
 	return ret;
 }
 
@@ -839,7 +845,7 @@ is_mounted_same_loopfile(const char *nod
 	char *node;
 	int res = 0;
 
-	node = canonicalize_mountpoint(node0);
+	node = canonicalize(node0);
 
 	/* Search for mountpoint node in mtab,
 	 * procceed if any of these has the loop option set or
@@ -979,8 +985,8 @@ update_mtab_entry(const char *spec, cons
 		  const char *opts, int flags, int freq, int pass) {
 	struct my_mntent mnt;
 
-	mnt.mnt_fsname = canonicalize (spec);
-	mnt.mnt_dir = canonicalize_mountpoint (node);
+	mnt.mnt_fsname = is_pseudo_fs(type) ? xstrdup(spec) : canonicalize(spec);
+	mnt.mnt_dir = canonicalize (node);
 	mnt.mnt_type = type;
 	mnt.mnt_opts = opts;
 	mnt.mnt_freq = freq;
@@ -1496,7 +1502,7 @@ mounted (const char *spec0, const char *
 	if (!spec)
 		return ret;
 
-	node = canonicalize_mountpoint(node0);
+	node = canonicalize(node0);
 
 	mc0 = mtab_head();
 	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
diff -up util-linux-ng-2.14.1/mount/realpath.c.kzak util-linux-ng-2.14.1/mount/realpath.c
--- util-linux-ng-2.14.1/mount/realpath.c.kzak	2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/realpath.c	2009-06-01 11:20:32.000000000 +0200
@@ -29,6 +29,19 @@
 # define MAXSYMLINKS 256
 #endif
 
+int
+is_pseudo_fs(const char *type)
+{
+	if (type == NULL || *type == '/')
+		return 0;
+	if (streq(type, "none") ||
+	    streq(type, "proc") ||
+	    streq(type, "tmpfs") ||
+	    streq(type, "sysfs") ||
+	    streq(type, "devpts"))
+		return 1;
+	return 0;
+}
 
 /* Make a canonical pathname from PATH.  Returns a freshly malloced string.
    It is up the *caller* to ensure that the PATH is sensible.  i.e.
@@ -36,15 +49,12 @@
    is not a legal pathname for ``/dev/fd0''.  Anything we cannot parse
    we return unmodified.   */
 char *
-canonicalize_mountpoint (const char *path) {
+canonicalize_spec (const char *path)
+{
 	if (path == NULL)
 		return NULL;
-
-	if (streq(path, "none") ||
-	    streq(path, "proc") ||
-	    streq(path, "devpts"))
+	if (is_pseudo_fs(path))
 		return xstrdup(path);
-
 	return canonicalize(path);
 }
 
diff -up util-linux-ng-2.14.1/mount/realpath.h.kzak util-linux-ng-2.14.1/mount/realpath.h
--- util-linux-ng-2.14.1/mount/realpath.h.kzak	2008-05-29 01:01:02.000000000 +0200
+++ util-linux-ng-2.14.1/mount/realpath.h	2009-06-01 11:20:32.000000000 +0200
@@ -8,6 +8,7 @@
 
 extern char *myrealpath(const char *path, char *resolved_path, int m);
 extern char *canonicalize (const char *path);
-extern char *canonicalize_mountpoint (const char *path);
+extern char *canonicalize_spec (const char *path);
+extern int is_pseudo_fs(const char *type);
 
 #endif /* REALPATH_H */

util-linux-ng-2.14-setterm-man-blank.patch:

--- NEW FILE util-linux-ng-2.14-setterm-man-blank.patch ---
>From e273df94bab7785df778de7eaeacfa729ee7d56e Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak at redhat.com>
Date: Fri, 5 Dec 2008 11:41:28 +0100
Subject: [PATCH] setterm: fix -blank man page

Signed-off-by: Karel Zak <kzak at redhat.com>
---
 misc-utils/setterm.1 |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/misc-utils/setterm.1 b/misc-utils/setterm.1
index ec4b6a8..ed05dc1 100644
--- a/misc-utils/setterm.1
+++ b/misc-utils/setterm.1
@@ -135,8 +135,8 @@ every specified number of positions.  Without an argument, defaults to 8.
 .TP
 .BR \-blank " [0-60|force|poke] (virtual consoles only)"
 Sets the interval of inactivity, in minutes, after which the screen will be
-automatically blanked (using APM if available).  Without an argument,
-defaults to 0 (disable console blanking).
+automatically blanked (using APM if available).  Without an argument, gets the
+blank status (returns which vt was blanked or zero for unblanked vt).
 
 The
 .B force
@@ -144,7 +144,7 @@ option keeps screen blank even if a key is pressed.
 
 The
 .B poke
-option returns which vt was blanked.
+option unblank the screen.
 .TP
 .BR \-dump " [1-NR_CONS]"
 Writes a snapshot of the given virtual console (with attributes) to the file
-- 
1.6.0.6



Index: util-linux-ng.spec
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-10/util-linux-ng.spec,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -p -r1.35 -r1.36
--- util-linux-ng.spec	22 Jan 2009 11:27:06 -0000	1.35
+++ util-linux-ng.spec	1 Jun 2009 11:04:05 -0000	1.36
@@ -2,7 +2,7 @@
 Summary: A collection of basic system utilities
 Name: util-linux-ng
 Version: 2.14.1
-Release: 3.2%{?dist}
+Release: 3.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
@@ -103,6 +103,12 @@ Patch11: util-linux-ng-2.14-mount-file_t
 Patch12: util-linux-ng-2.14-mount-man-tmpfs.patch
 # 472502: Problem with fdisk and use +sectors for the end of partition (upstream patch)
 Patch13: util-linux-ng-2.14-fdisk-cylinder.patch
+# 489672 - flock segfaults when file name is not given
+Patch14: util-linux-ng-2.14-flock-segfault.patch
+# 503266 - mountpoint named tmpfs confuses the mount command
+Patch15: util-linux-ng-2.14-mount-canonicalize.patch
+# 474628 - setterm -blank no longer works as documented
+Patch16: util-linux-ng-2.14-setterm-man-blank.patch
 
 %description
 The util-linux-ng package contains a large variety of low-level system
@@ -127,6 +133,9 @@ cp %{SOURCE8} %{SOURCE9} .
 %patch11 -p1
 %patch12 -p1
 %patch13 -p1
+%patch14 -p1
+%patch15 -p1
+%patch16 -p1
 
 %build
 unset LINGUAS || :
@@ -521,6 +530,11 @@ exit 0
 /sbin/losetup
 
 %changelog
+* Mon Jun  1 2009 Karel Zak <kzak at redhat.com> 2.14.1-3.3
+- fix #489672 - flock segfaults when file name is not given
+- fix #503266 - mountpoint named tmpfs confuses the mount command
+- fix #474628 - setterm -blank no longer works as documented
+
 * Thu Jan 22 2009 Karel Zak <kzak at redhat.com> 2.14.1-3.2
 - fix #480413 - util-linux-ng doesn't include scriptreplay
 




More information about the fedora-extras-commits mailing list