2.21-0.1: upgrade to v2.21-rc2

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2012-02-07 14:12:06 +01:00
parent b2fdd8fbf3
commit f6117ff853
14 changed files with 91 additions and 722 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@
/util-linux-2.20-rc2.tar.bz2
/util-linux-2.20.tar.bz2
/util-linux-2.20.1.tar.bz2
/util-linux-2.21-rc2.tar.xz

View File

@ -1,2 +1,2 @@
079b37517fd4e002a2e6e992e8b4e361 util-linux-2.20.1.tar.bz2
d36eb7c452ffb79d71e619710894305d util-linux-2.21-rc2.tar.xz
a02aac97c74259ca1b24972c89147ca4 floppy-0.18.tar.bz2

View File

@ -1,32 +0,0 @@
From fa7e0d6d442de9f5940f99fd93f4522602439131 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 6 Jun 2011 12:35:26 +0200
Subject: [PATCH] lib: [linux_version.c] accommodate two-component linux
version (e.g. 3.0)
Signed-off-by: Karel Zak <kzak@redhat.com>
---
lib/linux_version.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/linux_version.c b/lib/linux_version.c
index f9fbd8d..ada566a 100644
--- a/lib/linux_version.c
+++ b/lib/linux_version.c
@@ -16,10 +16,10 @@ get_linux_version (void)
return kver;
if (uname (&uts))
kver = 0;
- else if (sscanf (uts.release, "%d.%d.%d", &major, &minor, &teeny) != 3)
- kver = 0;
- else
+ else if (sscanf (uts.release, "%d.%d.%d", &major, &minor, &teeny) == 3)
kver = KERNEL_VERSION (major, minor, teeny);
+ else if (sscanf (uts.release, "%d.%d", &major, &minor) == 2)
+ kver = KERNEL_VERSION (major, minor, 0);
return kver;
}
--
1.7.5.2

View File

@ -1,290 +0,0 @@
From 5c60a0eab5155043f58fa88909d89e0b06cad2f8 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 31 May 2011 18:01:36 +0200
Subject: [PATCH] libmount: add mnt_table_is_mounted()
Signed-off-by: Karel Zak <kzak@redhat.com>
---
shlibs/mount/src/libmount.h.in | 3 +
shlibs/mount/src/libmount.sym | 1 +
shlibs/mount/src/tab.c | 210 ++++++++++++++++++++++++++++++++++++++++
shlibs/mount/src/tab_update.c | 2 +-
4 files changed, 215 insertions(+), 1 deletions(-)
diff --git a/shlibs/mount/src/libmount.h.in b/shlibs/mount/src/libmount.h.in
index 3ea2f92..1522208 100644
--- a/shlibs/mount/src/libmount.h.in
+++ b/shlibs/mount/src/libmount.h.in
@@ -308,6 +308,9 @@ extern int mnt_table_find_next_fs(struct libmnt_table *tb,
int (*match_func)(struct libmnt_fs *, void *), void *userdata,
struct libmnt_fs **fs);
+extern int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs);
+
+
/* tab_update.c */
extern struct libmnt_update *mnt_new_update(void);
extern void mnt_free_update(struct libmnt_update *upd);
diff --git a/shlibs/mount/src/libmount.sym b/shlibs/mount/src/libmount.sym
index 0b7c560..a498916 100644
--- a/shlibs/mount/src/libmount.sym
+++ b/shlibs/mount/src/libmount.sym
@@ -195,6 +195,7 @@ global:
mnt_update_is_ready;
mnt_update_set_fs;
mnt_update_table;
+ mnt_table_is_fs_mounted;
local:
*;
};
diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c
index 2a6a235..38a5d5b 100644
--- a/shlibs/mount/src/tab.c
+++ b/shlibs/mount/src/tab.c
@@ -712,6 +712,175 @@ struct libmnt_fs *mnt_table_find_pair(struct libmnt_table *tb, const char *sourc
return NULL;
}
+/*
+ * @tb: /proc/self/mountinfo
+ * @fs: filesystem
+ * @mountflags: MS_BIND or 0
+ * @fsroot: fs-root that will be probably used in the mountinfo file
+ * for @fs after mount(2)
+ *
+ * For btrfs subvolumes this function returns NULL, but @fsroot properly set.
+ *
+ * Returns: entry from @tb that will be used as a source for @fs if the @fs is
+ * bindmount.
+ */
+struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb,
+ struct libmnt_fs *fs,
+ unsigned long mountflags,
+ char **fsroot)
+{
+ char *root = NULL, *mnt = NULL;
+ const char *fstype;
+ struct libmnt_fs *src_fs = NULL;
+
+ assert(tb);
+ assert(fs);
+ assert(fsroot);
+
+ DBG(TAB, mnt_debug("lookup fs-root for %s", mnt_fs_get_source(fs)));
+
+ fstype = mnt_fs_get_fstype(fs);
+
+ if (mountflags & MS_BIND) {
+ const char *src, *src_root;
+
+ DBG(TAB, mnt_debug("fs-root for bind"));
+
+ src = mnt_resolve_spec(mnt_fs_get_source(fs), tb->cache);
+ if (!src)
+ goto err;
+
+ mnt = mnt_get_mountpoint(src);
+ if (!mnt)
+ goto err;
+
+ root = mnt_get_fs_root(src, mnt);
+
+ src_fs = mnt_table_find_target(tb, mnt, MNT_ITER_BACKWARD);
+ if (!src_fs) {
+ DBG(TAB, mnt_debug("not found '%s' in mountinfo -- using default", mnt));
+ goto dflt;
+ }
+
+ /* on btrfs the subvolume is used as fs-root in
+ * /proc/self/mountinfo, so we have to get the original subvolume
+ * name from src_fs and prepend the subvolume name to the
+ * fs-root path
+ */
+ src_root = mnt_fs_get_root(src_fs);
+ if (src_root && !startswith(root, src_root)) {
+ size_t sz = strlen(root) + strlen(src_root) + 1;
+ char *tmp = malloc(sz);
+
+ if (!tmp)
+ goto err;
+ snprintf(tmp, sz, "%s%s", src_root, root);
+ free(root);
+ root = tmp;
+ }
+ }
+
+ /*
+ * btrfs-subvolume mount -- get subvolume name and use it as a root-fs path
+ */
+ else if (fstype && !strcmp(fstype, "btrfs")) {
+ char *vol = NULL, *p;
+ size_t sz, volsz = 0;
+
+ if (mnt_fs_get_option(fs, "subvol", &vol, &volsz))
+ goto dflt;
+
+ DBG(TAB, mnt_debug("setting FS root: btrfs subvol"));
+
+ sz = volsz;
+ if (*vol != '/')
+ sz++;
+ root = malloc(sz + 1);
+ if (!root)
+ goto err;
+ p = root;
+ if (*vol != '/')
+ *p++ = '/';
+ memcpy(p, vol, volsz);
+ *(root + sz) = '\0';
+ }
+dflt:
+ if (!root) {
+ root = strdup("/");
+ if (!root)
+ goto err;
+ }
+ *fsroot = root;
+
+ DBG(TAB, mnt_debug("FS root result: %s", root));
+
+ free(mnt);
+ return src_fs;
+err:
+ free(root);
+ free(mnt);
+ return NULL;
+}
+
+/**
+ * mnt_table_is_mounted:
+ * @tb: /proc/self/mountinfo file
+ * @fstab_fs: /etc/fstab entry
+ *
+ * Checks if the @fstab_fs entry is already in the @tb table. The "swap"
+ * is ignored.
+ *
+ * TODO: check for loopdev (see mount/mount.c is_fstab_entry_mounted().
+ *
+ * Returns: 0 or 1
+ */
+int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
+{
+ char *root = NULL;
+ struct libmnt_fs *src_fs;
+ const char *src, *tgt;
+ int flags = 0, rc = 0;
+
+ assert(tb);
+ assert(fstab_fs);
+
+ if (fstab_fs->flags & MNT_FS_SWAP)
+ return 0;
+
+ if (mnt_fs_get_option(fstab_fs, "bind", NULL, NULL) == 0)
+ flags = MS_BIND;
+
+ src_fs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);
+ if (src_fs)
+ src = mnt_fs_get_srcpath(src_fs);
+ else
+ src = mnt_resolve_spec(mnt_fs_get_source(fstab_fs), tb->cache);
+
+ tgt = mnt_fs_get_target(fstab_fs);
+
+ if (tgt || src || root) {
+ struct libmnt_iter itr;
+ struct libmnt_fs *fs;
+
+ mnt_reset_iter(&itr, MNT_ITER_FORWARD);
+
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
+ const char *s = mnt_fs_get_srcpath(fs),
+ *t = mnt_fs_get_target(fs),
+ *r = mnt_fs_get_root(fs);
+
+ if (s && t && r && !strcmp(t, tgt) &&
+ !strcmp(s, src) && !strcmp(r, root))
+ break;
+ }
+ if (fs)
+ rc = 1; /* success */
+ }
+
+ free(root);
+ return rc;
+}
+
#ifdef TEST_PROGRAM
static int parser_errcb(struct libmnt_table *tb, const char *filename, int line)
@@ -869,6 +1038,46 @@ done:
return rc;
}
+static int test_is_mounted(struct libmnt_test *ts, int argc, char *argv[])
+{
+ struct libmnt_table *tb = NULL, *fstab = NULL;
+ struct libmnt_fs *fs;
+ struct libmnt_iter *itr = NULL;
+ int rc;
+
+ tb = mnt_new_table_from_file("/proc/self/mountinfo");
+ if (!tb) {
+ fprintf(stderr, "failed to parse mountinfo\n");
+ return -1;
+ }
+
+ fstab = create_table(argv[1]);
+ if (!fstab)
+ goto done;
+
+ itr = mnt_new_iter(MNT_ITER_FORWARD);
+ if (!itr)
+ goto done;
+
+ while(mnt_table_next_fs(fstab, itr, &fs) == 0) {
+ if (mnt_table_is_fs_mounted(tb, fs))
+ printf("%s already mounted on %s\n",
+ mnt_fs_get_source(fs),
+ mnt_fs_get_target(fs));
+ else
+ printf("%s not mounted on %s\n",
+ mnt_fs_get_source(fs),
+ mnt_fs_get_target(fs));
+ }
+
+ rc = 0;
+done:
+ mnt_free_table(tb);
+ mnt_free_table(fstab);
+ mnt_free_iter(itr);
+ return rc;
+}
+
int main(int argc, char *argv[])
{
struct libmnt_test tss[] = {
@@ -877,6 +1086,7 @@ int main(int argc, char *argv[])
{ "--find-backward", test_find_bw, "<file> <source|target> <string>" },
{ "--find-pair", test_find_pair, "<file> <source> <target>" },
{ "--copy-fs", test_copy_fs, "<file> copy root FS from the file" },
+ { "--is-mounted", test_is_mounted, "<fstab> check what from <file> are already mounted" },
{ NULL }
};
diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c
index 5abb566..9817f20 100644
--- a/shlibs/mount/src/tab_update.c
+++ b/shlibs/mount/src/tab_update.c
@@ -410,7 +410,7 @@ static int set_fs_root(struct libmnt_fs *result, struct libmnt_fs *fs, unsigned
mnt_fs_set_fstype(result, mnt_fs_get_fstype(src_fs));
/* on btrfs the subvolume is used as fs-root in
- * /proc/self/mountinfo, so we have get the original subvolume
+ * /proc/self/mountinfo, so we have to get the original subvolume
* name from src_fs and prepend the subvolume name to the
* fs-root path
*/
--
1.7.5.2

View File

@ -1,105 +0,0 @@
From 0cac8948216a298deaf5fd30837ed9cc80618f80 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 31 May 2011 18:02:29 +0200
Subject: [PATCH] mount: use libmount to detect already mounted bind mounts
It's pretty tricky to detect that a bind mount from fstab is already
mounted on system without /etc/mtab. Let's use functionality from
libmount.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=701176
Signed-off-by: Karel Zak <kzak@redhat.com>
---
mount/mount.c | 42 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/mount/mount.c b/mount/mount.c
index 29963c2..3ba705f 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -212,7 +212,7 @@ static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_sizelimit,
*opt_encryption, *opt_speed, *opt_comment, *opt_uhelper;
static int is_readonly(const char *node);
-static int mounted (const char *spec0, const char *node0);
+static int mounted (const char *spec0, const char *node0, struct mntentchn *fstab_mc);
static int check_special_mountprog(const char *spec, const char *node,
const char *type, int flags, char *extra_opts, int *status);
@@ -1562,7 +1562,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
/* The "mount -f" checks for for existing record in /etc/mtab (with
* regular non-fake mount this is usually done by kernel)
*/
- if (!(flags & MS_REMOUNT) && fake && mounted (spec, node))
+ if (!(flags & MS_REMOUNT) && fake && mounted (spec, node, NULL))
die(EX_USAGE, _("mount: according to mtab, "
"%s is already mounted on %s\n"),
spec, node);
@@ -2016,13 +2016,46 @@ mount_one (const char *spec, const char *node, const char *types,
return try_mount_one (spec, node, types, opts, freq, pass, 0);
}
+#ifdef HAVE_LIBMOUNT_MOUNT
+static struct libmnt_table *minfo; /* parsed mountinfo file */
+#endif
+
/* Check if an fsname/dir pair was already in the old mtab. */
static int
-mounted (const char *spec0, const char *node0) {
+mounted (const char *spec0, const char *node0, struct mntentchn *fstab_mc) {
struct mntentchn *mc, *mc0;
const char *spec, *node;
int ret = 0;
+#ifdef HAVE_LIBMOUNT_MOUNT
+ /*
+ * Use libmount to check for already mounted bind mounts on systems
+ * without mtab.
+ */
+ if (fstab_mc && fstab_mc->m.mnt_opts &&
+ mtab_is_a_symlink() && strstr(fstab_mc->m.mnt_opts, "bind")) {
+
+ struct libmnt_fs *fs = mnt_new_fs();
+ int rc = fs ? 0 : -1;
+
+ if (!rc)
+ rc = mnt_fs_set_fstype(fs, fstab_mc->m.mnt_type);
+ if (!rc)
+ rc = mnt_fs_set_source(fs, fstab_mc->m.mnt_fsname);
+ if (!rc)
+ rc = mnt_fs_set_target(fs, fstab_mc->m.mnt_dir);
+ if (!rc)
+ rc = mnt_fs_set_options(fs, fstab_mc->m.mnt_opts);
+ if (!rc && !minfo)
+ minfo = mnt_new_table_from_file("/proc/self/mountinfo");
+ if (!rc && minfo)
+ rc = mnt_table_is_fs_mounted(minfo, fs);
+
+ mnt_free_fs(fs);
+ if (rc == 1)
+ return 1;
+ }
+#endif
/* Handle possible UUID= and LABEL= in spec */
spec = spec_to_devname(spec0);
if (!spec)
@@ -2030,6 +2063,7 @@ mounted (const char *spec0, const char *node0) {
node = canonicalize(node0);
+
mc0 = mtab_head();
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
if (streq (spec, mc->m.mnt_fsname) &&
@@ -2050,7 +2084,7 @@ is_fstab_entry_mounted(struct mntentchn *mc, int verbose)
{
struct stat st;
- if (mounted(mc->m.mnt_fsname, mc->m.mnt_dir))
+ if (mounted(mc->m.mnt_fsname, mc->m.mnt_dir, mc))
goto yes;
/* extra care for loop devices */
--
1.7.5.2

View File

@ -1,33 +0,0 @@
From aab72640daa7ee2db3d42fc8278ab86e3aef2d71 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 2 Jun 2011 14:53:42 +0200
Subject: [PATCH] mount: canonicalize fstab mnt_dir
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=709681
Signed-off-by: Karel Zak <kzak@redhat.com>
---
mount/fstab.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/mount/fstab.c b/mount/fstab.c
index 8ce733b..4fa26b4 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -455,7 +455,13 @@ getfs_by_dir (const char *dir) {
cdir = canonicalize(dir);
for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
- if (streq(mc->m.mnt_dir, cdir)) {
+ int ok = streq(mc->m.mnt_dir, cdir);
+ if (!ok) {
+ char *dr = canonicalize(mc->m.mnt_dir);
+ ok = dr ? streq(dr, cdir) : 0;
+ free(dr);
+ }
+ if (ok) {
free(cdir);
return mc;
}
--
1.7.5.2

View File

@ -1,76 +0,0 @@
From 067e9b4934372f72b89b2c0442a3d28290834537 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 29 Jun 2011 09:02:50 +0200
Subject: [PATCH] mount: first look for mountpoint
# mount <device|dir>
The current code looks for a device and then for a mountpoint in
/etc/fstab. This is not user friendly solution. People usually use
# mount /dir
to mount any filesystem. It makes more sense to check for mountpoint
and if not found then for device.
This is also important for bind mounts, for example if you have in
your fstab:
/dev/sda1 /mnt/foo auto defaults
/mnt/foo /mnt/bar none bind
then
# mount /mnt/foo
should be interpreted as the first entry and /dev/sda1 should be
mounted.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=716483
Signed-off-by: Karel Zak <kzak@redhat.com>
---
mount/mount.8 | 11 +++++++++++
mount/mount.c | 4 ++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/mount/mount.8 b/mount/mount.8
index 8982537..e9a52dd 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -101,6 +101,17 @@ the pathname
refers to the root of the filesystem on
.IR device .
+If only directory or device is given, for example:
+.RS
+
+.br
+.BI "mount /dir"
+.br
+
+.RE
+then mount looks for a mountpoint and if not found then for a device in the
+/etc/fstab file.
+
.B The listing and help.
.RS
Three forms of invocation do not actually mount anything:
diff --git a/mount/mount.c b/mount/mount.c
index 3ba705f..00637f5 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -2347,10 +2347,10 @@ getfs(const char *spec, const char *uuid, const char *label)
else if (label)
mc = getfs_by_label(label);
else {
- mc = getfs_by_spec(spec);
+ mc = getfs_by_dir(spec);
if (!mc)
- mc = getfs_by_dir(spec);
+ mc = getfs_by_spec(spec);
}
if (mc)
return mc;
--
1.7.5.4

View File

@ -1,64 +0,0 @@
diff -up util-linux-2.20-rc1/libblkid/libblkid.3.kzak util-linux-2.20-rc1/libblkid/libblkid.3
--- util-linux-2.20-rc1/libblkid/libblkid.3.kzak 2011-07-26 16:43:07.000000000 +0200
+++ util-linux-2.20-rc1/libblkid/libblkid.3 2011-07-29 21:17:20.883777687 +0200
@@ -28,7 +28,7 @@ partitions and block device topology.
.P
The high-level part of the library keeps information about block devices
in a cache file
-.I /etc/blkid.tab
+.I /etc/blkid/blkid.tab
and is verified to still be valid before being returned to the user
(if the user has read permission on the raw block device, otherwise not).
The cache file also allows unprivileged users (normally anyone other
@@ -69,7 +69,7 @@ symlink does not match with LABEL or UUI
.I CACHE_FILE=<path>
Overrides the standard location of the cache file. This setting can be
overridden by the environment variable BLKID_FILE. Default is
-.I /etc/blkid.tab.
+.I /etc/blkid/blkid.tab.
.TP
.I EVALUATE=<methods>
Defines LABEL and UUID evaluation method(s). Currently, the libblkid library
@@ -87,7 +87,7 @@ from Ted Ts'o. The library was subseque
The low-level probing code was rewritten by Karel Zak.
.SH FILES
.TP 18
-.I /etc/blkid.tab
+.I /etc/blkid/blkid.tab
caches data extracted from each recognized block device
.TP
.I /etc/blkid.conf
diff -up util-linux-2.20-rc1/libblkid/src/blkidP.h.kzak util-linux-2.20-rc1/libblkid/src/blkidP.h
--- util-linux-2.20-rc1/libblkid/src/blkidP.h.kzak 2011-07-20 21:55:23.000000000 +0200
+++ util-linux-2.20-rc1/libblkid/src/blkidP.h 2011-07-29 21:17:52.852169993 +0200
@@ -286,7 +286,7 @@ extern char *blkid_strdup(const char *s)
extern char *blkid_strndup(const char *s, const int length);
extern char *blkid_strconcat(const char *a, const char *b, const char *c);
-#define BLKID_CACHE_FILE "/etc/blkid.tab"
+#define BLKID_CACHE_FILE "/etc/blkid/blkid.tab"
#define BLKID_CONFIG_FILE "/etc/blkid.conf"
#define BLKID_ERR_IO 5
diff -up util-linux-2.20-rc1/misc-utils/blkid.8.kzak util-linux-2.20-rc1/misc-utils/blkid.8
--- util-linux-2.20-rc1/misc-utils/blkid.8.kzak 2011-07-20 21:55:23.000000000 +0200
+++ util-linux-2.20-rc1/misc-utils/blkid.8 2011-07-29 21:15:37.312506693 +0200
@@ -79,7 +79,7 @@ same meaning as "KiB") or decimal (10^N)
Read from
.I cachefile
instead of reading from the default cache file
-.IR /etc/blkid.tab .
+.IR /etc/blkid/blkid.tab .
If you want to start with a clean cache (i.e. don't report devices previously
scanned but not necessarily available at this time), specify
.IR /dev/null .
@@ -242,7 +242,7 @@ Display version number and exit.
Write the device cache to
.I writecachefile
instead of writing it to the default cache file
-.IR /etc/blkid.tab .
+.IR /etc/blkid/blkid.tab .
If you don't want to save the cache at all, specify
.IR /dev/null.
If not specified, it will be the same file as that given with the
diff -up util-linux-2.20-rc1/misc-utils/blkid.c.kzak util-linux-2.20-rc1/misc-utils/blkid.c

View File

@ -1,10 +1,10 @@
diff -up util-linux-2.20-rc2/sys-utils/ipcs.c.kzak util-linux-2.20-rc2/sys-utils/ipcs.c
--- util-linux-2.20-rc2/sys-utils/ipcs.c.kzak 2011-08-12 11:13:00.000000000 +0200
+++ util-linux-2.20-rc2/sys-utils/ipcs.c 2011-08-17 01:16:23.629928605 +0200
@@ -255,6 +255,28 @@ print_perms (int id, struct ipc_perm *ip
diff -up util-linux-2.21-rc1/sys-utils/ipcs.c.kzak util-linux-2.21-rc1/sys-utils/ipcs.c
--- util-linux-2.21-rc1/sys-utils/ipcs.c.kzak 2012-01-19 13:31:26.328579820 +0100
+++ util-linux-2.21-rc1/sys-utils/ipcs.c 2012-01-19 13:33:40.968066006 +0100
@@ -262,6 +262,27 @@ static void print_perms (int id, struct
printf(" %-10u\n", ipcp->gid);
}
+static unsigned long long
+shminfo_from_proc(const char *name, unsigned long def)
+{
@ -25,15 +25,14 @@ diff -up util-linux-2.20-rc2/sys-utils/ipcs.c.kzak util-linux-2.20-rc2/sys-utils
+ fclose(f);
+ return res;
+}
+
+
void do_shm (char format)
{
int maxid, shmid, id;
@@ -277,12 +299,12 @@ void do_shm (char format)
return;
/* glibc 2.1.3 and all earlier libc's have ints as fields
of struct shminfo; glibc 2.1.91 has unsigned long; ach */
int maxid, shmid, id;
@@ -286,12 +307,12 @@ void do_shm (char format)
* glibc 2.1.3 and all earlier libc's have ints as fields of
* struct shminfo; glibc 2.1.91 has unsigned long; ach
*/
- printf (_("max number of segments = %lu\n"),
- (unsigned long) shminfo.shmmni);
- printf (_("max seg size (kbytes) = %lu\n"),
@ -42,9 +41,9 @@ diff -up util-linux-2.20-rc2/sys-utils/ipcs.c.kzak util-linux-2.20-rc2/sys-utils
+ shminfo_from_proc("shmmni", shminfo.shmmni));
+ printf (_("max seg size (kbytes) = %llu\n"),
+ (shminfo_from_proc("shmmax", shminfo.shmmax) >> 10));
printf (_("max total shared memory (kbytes) = %llu\n"),
printf (_("max total shared memory (kbytes) = %llu\n"),
- getpagesize() / 1024 * (unsigned long long) shminfo.shmall);
+ getpagesize() / 1024 * shminfo_from_proc("shmall", shminfo.shmall));
printf (_("min seg size (bytes) = %lu\n"),
(unsigned long) shminfo.shmmin);
return;
printf (_("min seg size (bytes) = %lu\n"),
(unsigned long) shminfo.shmmin);
return;

View File

@ -1,11 +1,8 @@
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# ACTION=="add", KERNEL=="sda", RUN+="/usr/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/usr/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

View File

@ -1,10 +0,0 @@
--- util-linux-2.13-pre6/sys-utils/ctrlaltdel.8.kzak 2006-08-10 12:23:53.000000000 +0200
+++ util-linux-2.13-pre6/sys-utils/ctrlaltdel.8 2006-08-10 12:24:08.000000000 +0200
@@ -32,7 +32,6 @@
.SH FILES
.I /etc/rc.local
.SH "SEE ALSO"
-.BR simpleinit (8),
.BR init (8)
.SH AUTHOR
Peter Orbaek (poe@daimi.aau.dk)

View File

@ -1,13 +0,0 @@
Index: util-linux-ng-2.14.2-rc1/login-utils/login.c
===================================================================
--- util-linux-ng-2.14.2-rc1.orig/login-utils/login.c
+++ util-linux-ng-2.14.2-rc1/login-utils/login.c
@@ -1415,7 +1415,7 @@ dolastlog(int quiet) {
struct lastlog ll;
int fd;
- if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) {
+ if ((fd = open(_PATH_LASTLOG, O_RDWR|O_CREAT, 0)) >= 0) {
lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), SEEK_SET);
if (!quiet) {
if (read(fd, (char *)&ll, sizeof(ll)) == sizeof(ll) &&

View File

@ -0,0 +1,11 @@
diff -up util-linux-2.21-rc1/login-utils/login.c.kzak util-linux-2.21-rc1/login-utils/login.c
--- util-linux-2.21-rc1/login-utils/login.c.kzak 2012-01-19 13:19:54.886299587 +0100
+++ util-linux-2.21-rc1/login-utils/login.c 2012-01-19 13:20:40.853451212 +0100
@@ -499,7 +499,7 @@ static void log_lastlog(struct login_con
if (!cxt->pwd)
return;
- fd = open(_PATH_LASTLOG, O_RDWR, 0);
+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
if (fd < 0)
return;

View File

@ -1,22 +1,13 @@
### Header
Summary: A collection of basic system utilities
Name: util-linux
Version: 2.20.1
Release: 5%{?dist}
Version: 2.21
Release: 0.1%{?dist}
License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
Group: System Environment/Base
URL: http://kernel.org/~kzak/util-linux/
%define upstream_version %{version}
### Features
%if 0%{?rhel}
%define include_raw 1
%else
%define include_raw 0
%endif
%define mtab_symlink 1
%define upstream_version %{version}-rc2
### Macros
%define floppyver 0.18
@ -31,11 +22,10 @@ BuildRequires: pam-devel
BuildRequires: zlib-devel
BuildRequires: popt-devel
BuildRequires: libutempter-devel
BuildRequires: libudev-devel
### Sources
#Source0: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.19/util-linux-%{upstream_version}.tar.bz2
#
Source0: ftp://ftp.infradead.org/pub/util-linux/v2.20/util-linux-%{upstream_version}.tar.bz2
Source0: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.21/util-linux-%{upstream_version}.tar.xz
Source1: util-linux-login.pamd
Source2: util-linux-remote.pamd
Source3: util-linux-chsh-chfn.pamd
@ -69,10 +59,7 @@ Requires: audit-libs >= 1.0.6
Requires: libuuid = %{version}-%{release}
Requires: libblkid = %{version}-%{release}
Requires: libmount = %{version}-%{release}
%if %{include_raw}
Requires: udev >= 176
%endif
### Floppy patches (Fedora/RHEL specific)
###
@ -83,19 +70,12 @@ Patch1: util-linux-2.20-fdformat-man-ide.patch
# 169628 - /usr/bin/floppy doesn't work with /dev/fd0
Patch2: util-linux-2.19-floppy-generic.patch
### Fedora/RHEL specific patches -- need to die!
###
# 199745 - Non-existant simpleinit(8) mentioned in ctrlaltdel(8)
Patch4: util-linux-ng-2.13-ctrlaltdel-man.patch
# /etc/blkid.tab --> /etc/blkid/blkid.tab
Patch5: util-linux-2.20-blkid-cachefile.patch
### Ready for upstream?
###
# 151635 - makeing /var/log/lastlog
Patch7: util-linux-ng-2.13-login-lastlog.patch
Patch3: util-linux-ng-2.21-login-lastlog.patch
# 231192 - ipcs is not printing correct values on pLinux
Patch8: util-linux-2.20-ipcs-32bit.patch
Patch4: util-linux-2.21-ipcs-32bit.patch
%description
The util-linux package contains a large variety of low-level system
@ -209,10 +189,8 @@ cp %{SOURCE8} %{SOURCE9} .
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
%build
unset LINGUAS || :
@ -227,12 +205,9 @@ export SUID_LDFLAGS="-pie"
--enable-login-utils \
--enable-kill \
--enable-write \
%if %{include_raw}
--enable-raw \
%endif
%if %{mtab_symlink}
--enable-libmount-mount \
%endif
--enable-new-mount \
--with-udev \
--with-selinux \
--with-audit \
--with-utempter \
@ -255,7 +230,7 @@ rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,6,8,5}
mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/{pam.d,security/console.apps,blkid}
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/{pam.d,security/console.apps}
mkdir -p ${RPM_BUILD_ROOT}/var/log
touch ${RPM_BUILD_ROOT}/var/log/lastlog
chmod 0644 ${RPM_BUILD_ROOT}/var/log/lastlog
@ -272,7 +247,7 @@ popd
install -m 755 nologin ${RPM_BUILD_ROOT}%{_sbindir}
install -m 644 nologin.8 ${RPM_BUILD_ROOT}%{_mandir}/man8
%if %{include_raw}
# raw
echo '.so man8/raw.8' > $RPM_BUILD_ROOT%{_mandir}/man8/rawdevices.8
{
# see RH bugzilla #216664
@ -281,7 +256,9 @@ echo '.so man8/raw.8' > $RPM_BUILD_ROOT%{_mandir}/man8/rawdevices.8
install -m 644 %{SOURCE4} ./60-raw.rules
popd
}
%endif
# sbin -> bin
mv ${RPM_BUILD_ROOT}%{_sbindir}/raw ${RPM_BUILD_ROOT}%{_bindir}/raw
# Our own initscript for uuidd
install -D -m 755 %{SOURCE10} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/uuidd
@ -342,7 +319,7 @@ done
%ifarch %{sparc}
for I in /sbin/sfdisk \
%{_mandir}/man8/sfdisk.8* \
%doc fdisk/sfdisk.examples \
%doc Documentation/sfdisk.txt \
/sbin/cfdisk \
%{_mandir}/man8/cfdisk.8*; do
@ -351,7 +328,7 @@ done
%endif
# deprecated commands
for I in /usr/sbin/fsck.minix /usr/sbin/mkfs.{bfs,minix} /usr/sbin/sln \
for I in /usr/sbin/mkfs.bfs /usr/sbin/sln \
/usr/bin/chkdupexe %{_bindir}/line %{_bindir}/pg %{_bindir}/newgrp \
/usr/sbin/shutdown /usr/sbin/vipw /usr/sbin/vigr; do
rm -f $RPM_BUILD_ROOT$I
@ -359,13 +336,12 @@ done
# deprecated man pages
for I in man1/chkdupexe.1 man1/line.1 man1/pg.1 man1/newgrp.1 \
man8/fsck.minix.8 man8/mkfs.minix.8 man8/mkfs.bfs.8 \
man8/vipw.8 man8/vigr; do
man8/mkfs.bfs.8 man8/vipw.8 man8/vigr; do
rm -rf $RPM_BUILD_ROOT%{_mandir}/${I}*
done
# deprecated docs
for I in text-utils/README.pg misc-utils/README.reset floppy-%{floppyver}/README.html; do
for I in floppy-%{floppyver}/README.html; do
rm -rf $I
done
@ -377,18 +353,8 @@ chmod 644 getopt/getopt-*.{bash,tcsh}
rm -f ${RPM_BUILD_ROOT}%{_datadir}/getopt/*
rmdir ${RPM_BUILD_ROOT}%{_datadir}/getopt
%if %{mtab_symlink}
ln -s /proc/mounts %{buildroot}/etc/mtab
%else
touch %{buildroot}/etc/mtab
%endif
ln -s /proc/mounts %{buildroot}/etc/mtab
# /sbin -> /bin
for I in raw; do
if [ -e $RPM_BUILD_ROOT/sbin/$I ]; then
mv $RPM_BUILD_ROOT/sbin/$I $RPM_BUILD_ROOT/bin/$I
fi
done
# remove static libs
rm -f $RPM_BUILD_ROOT%{_libdir}/lib{uuid,blkid,mount}.a
@ -425,20 +391,22 @@ if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
/usr/bin/chcon "$SECXT" /var/log/lastlog >/dev/null 2>&1 || :
fi
fi
%if %{mtab_symlink}
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
%else
touch /etc/mtab
/bin/chown root:root /etc/mtab
/bin/chmod 0644 /etc/mtab
%endif
%post -n libblkid
/sbin/ldconfig
[ -e /etc/blkid.tab ] && mv /etc/blkid.tab /etc/blkid/blkid.tab || :
[ -e /etc/blkid.tab.old ] && mv /etc/blkid.tab.old /etc/blkid/blkid.tab.old || :
### Move blkid cache to /run
# deprecated upstream default
[ -e /etc/blkid.tab ] && mv /etc/blkid.tab /run/blkid/blkid.tab || :
[ -e /etc/blkid.tab.old ] && mv /etc/blkid.tab.old /run/blkid/blkid.tab.old || :
# deprecated Fedora default
[ -e /etc/blkid/blkid.tab ] && mv /etc/blkid/blkid.tab /run/blkid/blkid.tab || :
[ -e /etc/blkid/blkid.tab.old ] && mv /etc/blkid/blkid.tab.old /run/blkid/blkid.tab.old || :
%postun -n libblkid -p /sbin/ldconfig
@ -467,7 +435,8 @@ fi
%files -f %{name}.files
%defattr(-,root,root)
%doc */README.* NEWS AUTHORS licenses/* README*
%doc README */README.* NEWS AUTHORS
%doc Documentation/deprecated.txt Documentation/licenses/*
%doc getopt/getopt-*.{bash,tcsh}
%config(noreplace) %{_sysconfdir}/pam.d/chfn
@ -496,17 +465,20 @@ fi
%{_sbindir}/agetty
%{_sbindir}/blkid
%{_sbindir}/blockdev
%{_sbindir}/chcpu
%{_sbindir}/ctrlaltdel
%{_sbindir}/delpart
%{_sbindir}/fdisk
%{_sbindir}/findfs
%{_sbindir}/fsck
%{_sbindir}/fsck.cramfs
%{_sbindir}/fsck.minix
%{_sbindir}/fsfreeze
%{_sbindir}/fstrim
%{_sbindir}/losetup
%{_sbindir}/mkfs
%{_sbindir}/mkfs.cramfs
%{_sbindir}/mkfs.minix
%{_sbindir}/mkswap
%{_sbindir}/nologin
%{_sbindir}/partx
@ -538,6 +510,7 @@ fi
%{_bindir}/lscpu
%{_bindir}/mcookie
%{_bindir}/namei
%{_bindir}/prlimit
%{_bindir}/rename
%{_bindir}/renice
%{_bindir}/rev
@ -582,7 +555,7 @@ fi
%{_mandir}/man1/more.1*
%{_mandir}/man1/mountpoint.1*
%{_mandir}/man1/namei.1*
%{_mandir}/man1/readprofile.1*
%{_mandir}/man1/prlimit.1*
%{_mandir}/man1/rename.1*
%{_mandir}/man1/renice.1*
%{_mandir}/man1/rev.1*
@ -604,12 +577,14 @@ fi
%{_mandir}/man8/agetty.8*
%{_mandir}/man8/blkid.8*
%{_mandir}/man8/blockdev.8*
%{_mandir}/man8/chcpu.8*
%{_mandir}/man8/ctrlaltdel.8*
%{_mandir}/man8/delpart.8*
%{_mandir}/man8/fdisk.8*
%{_mandir}/man8/findfs.8*
%{_mandir}/man8/findmnt.8*
%{_mandir}/man8/fsck.8*
%{_mandir}/man8/fsck.minix.8*
%{_mandir}/man8/fsfreeze.8*
%{_mandir}/man8/fstrim.8*
%{_mandir}/man8/isosize.8*
@ -617,11 +592,13 @@ fi
%{_mandir}/man8/losetup.8*
%{_mandir}/man8/lsblk.8*
%{_mandir}/man8/mkfs.8*
%{_mandir}/man8/mkfs.minix.8*
%{_mandir}/man8/mkswap.8*
%{_mandir}/man8/mount.8*
%{_mandir}/man8/nologin.8*
%{_mandir}/man8/partx.8*
%{_mandir}/man8/pivot_root.8*
%{_mandir}/man8/readprofile.8*
%{_mandir}/man8/rtcwake.8*
%{_mandir}/man8/setarch.8*
%{_mandir}/man8/swaplabel.8*
@ -631,12 +608,10 @@ fi
%{_mandir}/man8/umount.8*
%{_mandir}/man8/wipefs.8*
%if %{include_raw}
%{_bindir}/raw
%config(noreplace) %{_sysconfdir}/udev/rules.d/60-raw.rules
%config(noreplace) %{_prefix}/lib/udev/rules.d
%{_mandir}/man8/raw.8*
%{_mandir}/man8/rawdevices.8*
%endif
%ifnarch s390 s390x
%{_sbindir}/clock
@ -652,7 +627,7 @@ fi
%endif
%ifnarch %{sparc}
%doc fdisk/sfdisk.examples
%doc Documentation/sfdisk.txt
%{_sbindir}/cfdisk
%{_sbindir}/sfdisk
%{_mandir}/man8/cfdisk.8*
@ -671,7 +646,7 @@ fi
%files -n uuidd
%defattr(-,root,root)
%doc licenses/COPYING.GPL
%doc Documentation/licenses/COPYING.GPLv2
/etc/rc.d/init.d/uuidd
%{_mandir}/man8/uuidd.8*
%attr(-, uuidd, uuidd) %{_sbindir}/uuidd
@ -681,12 +656,12 @@ fi
%files -n libmount
%defattr(-,root,root)
%doc libmount/COPYING.libmount
%doc libmount/COPYING
%{_libdir}/libmount.so.*
%files -n libmount-devel
%defattr(-,root,root)
%doc libmount/COPYING.libmount
%doc libmount/COPYING
%{_libdir}/libmount.so
%{_includedir}/libmount
%{_libdir}/pkgconfig/mount.pc
@ -694,13 +669,12 @@ fi
%files -n libblkid
%defattr(-,root,root)
%doc libblkid/COPYING.libblkid
%dir /etc/blkid
%doc libblkid/COPYING
%{_libdir}/libblkid.so.*
%files -n libblkid-devel
%defattr(-,root,root)
%doc libblkid/COPYING.libblkid
%doc libblkid/COPYING
%{_libdir}/libblkid.so
%{_includedir}/blkid
%{_mandir}/man3/libblkid.3*
@ -709,12 +683,12 @@ fi
%files -n libuuid
%defattr(-,root,root)
%doc libuuid/COPYING.libuuid
%doc libuuid/COPYING
%{_libdir}/libuuid.so.*
%files -n libuuid-devel
%defattr(-,root,root)
%doc libuuid/COPYING.libuuid
%doc libuuid/COPYING
%{_libdir}/libuuid.so
%{_includedir}/uuid
%{_mandir}/man3/uuid.3*
@ -733,6 +707,16 @@ fi
%changelog
* Thu Feb 07 2012 Karel Zak <kzak@redhat.com> 2.21-0.1
- upgrade to the release 2.21-rc2
ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.21/v2.21-ReleaseNotes
- add {fsck,mkfs}.minix
- add new command chcpu(8)
- add new command prlimit(1)
- enable raw(8) command
- move 60-raw.rules from /etc from /usr/lib/udev/rules.d
- move blkid cache from etc to /run/blkid
* Wed Jan 25 2012 Harald Hoyer <harald@redhat.com> 2.20.1-5
- install everything in /usr
https://fedoraproject.org/wiki/Features/UsrMove