diff --git a/.gitignore b/.gitignore index 0d27901..df32d4a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ /util-linux-2.22-rc2.tar.xz /util-linux-2.22.tar.xz /util-linux-2.22.1.tar.xz +/util-linux-2.22.2.tar.xz diff --git a/0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch b/0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch deleted file mode 100644 index 952c5e1..0000000 --- a/0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 6eeca6c7170295f325b814ee0cd1576da885cd30 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 15 Oct 2012 11:10:50 +0200 -Subject: [PATCH 01/11] libmount: don't use umount optimization for -l or -f - -The options -l (lazy) and -f (force) means that the mountpoint may be -unreadable (for example because NFS server is unreadable). So we -should not try to be smart in this case and we should try to minimize -number of situations when stat() or readlink() is used for the -mountpoint. - -Signed-off-by: Karel Zak ---- - libmount/src/context_umount.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c -index ce095bf..2c2e64c 100644 ---- a/libmount/src/context_umount.c -+++ b/libmount/src/context_umount.c -@@ -83,7 +83,9 @@ static int lookup_umount_fs(struct libmnt_context *cxt) - * where LABEL, UUID or symlinks are to canonicalized. It means that - * it's usable only for canonicalized stuff (e.g. kernel mountinfo). - */ -- if (!cxt->mtab_writable && *tgt == '/') { -+ if (!cxt->mtab_writable && *tgt == '/' && -+ !mnt_context_is_force(cxt) && !mnt_context_is_lazy(cxt)) { -+ - struct stat st; - - if (stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)) { --- -1.7.11.7 - diff --git a/0002-wipefs-use-O_EXCL.patch b/0002-wipefs-use-O_EXCL.patch deleted file mode 100644 index 66a6476..0000000 --- a/0002-wipefs-use-O_EXCL.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 9faf9c8494cf37fdcf68b1dfe10fd7900e93ec00 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 15 Oct 2012 12:38:09 +0200 -Subject: [PATCH 02/11] wipefs: use O_EXCL - -Address: https://bugzilla.redhat.com/show_bug.cgi?id=865961 -Signed-off-by: Karel Zak ---- - misc-utils/wipefs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c -index cddad8a..0ddc148 100644 ---- a/misc-utils/wipefs.c -+++ b/misc-utils/wipefs.c -@@ -309,7 +309,7 @@ static void do_wipe_real(blkid_probe pr, const char *devname, struct wipe_desc * - static struct wipe_desc * - do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet) - { -- blkid_probe pr = new_probe(devname, O_RDWR); -+ blkid_probe pr = new_probe(devname, O_RDWR | O_EXCL); - struct wipe_desc *w, *wp0 = clone_offset(wp); - int zap = all ? 1 : wp->zap; - --- -1.7.11.7 - diff --git a/0003-swapon-remove-loop-declaration-smatch-scan.patch b/0003-swapon-remove-loop-declaration-smatch-scan.patch deleted file mode 100644 index d5b90fe..0000000 --- a/0003-swapon-remove-loop-declaration-smatch-scan.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 10a9cbcf36d43c0d4a13bf5e91315b4ffd29e636 Mon Sep 17 00:00:00 2001 -From: Sami Kerola -Date: Mon, 8 Oct 2012 08:08:20 +0100 -Subject: [PATCH 03/11] swapon: remove loop declaration [smatch scan] - -sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are -only allowed in C99 mode - -Signed-off-by: Sami Kerola ---- - sys-utils/swapon.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c -index c9cabc1..0e1ab66 100644 ---- a/sys-utils/swapon.c -+++ b/sys-utils/swapon.c -@@ -642,6 +642,7 @@ static int swapon_all(void) - - static void __attribute__ ((__noreturn__)) usage(FILE * out) - { -+ size_t i; - fputs(USAGE_HEADER, out); - - fprintf(out, _(" %s [options] []\n"), program_invocation_short_name); -@@ -674,7 +675,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) - " name of file to be used\n"), out); - - fputs(_("\nAvailable columns (for --show):\n"), out); -- for (size_t i = 0; i < NCOLS; i++) -+ for (i = 0; i < NCOLS; i++) - fprintf(out, " %4s %s\n", infos[i].name, _(infos[i].help)); - - fprintf(out, USAGE_MAN_TAIL("swapon(8)")); --- -1.7.11.7 - diff --git a/0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch b/0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch deleted file mode 100644 index af08118..0000000 --- a/0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 9f6c8591eeffb6591dc6a18512e618f0acf09890 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 15 Oct 2012 17:01:30 +0200 -Subject: [PATCH 04/11] libblkid: fix compiler warning [-Wstrict-aliasing] - -libblkid/src/superblocks/befs.c: In function 'get_uuid': -libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] - -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/befs.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/libblkid/src/superblocks/befs.c b/libblkid/src/superblocks/befs.c -index a7f4317..452da1e 100644 ---- a/libblkid/src/superblocks/befs.c -+++ b/libblkid/src/superblocks/befs.c -@@ -348,9 +348,11 @@ static int get_uuid(blkid_probe pr, const struct befs_super_block *bs, - && FS16_TO_CPU(sd->name_size, fs_le) == strlen(KEY_NAME) - && FS16_TO_CPU(sd->data_size, fs_le) == KEY_SIZE - && strcmp(sd->name, KEY_NAME) == 0) { -- *uuid = *(uint64_t *) ((uint8_t *) sd->name -- + FS16_TO_CPU(sd->name_size, fs_le) -- + 3); -+ -+ memcpy(uuid, -+ sd->name + FS16_TO_CPU(sd->name_size, fs_le) + 3, -+ sizeof(uint64_t)); -+ - break; - } else if (FS32_TO_CPU(sd->type, fs_le) == 0 - && FS16_TO_CPU(sd->name_size, fs_le) == 0 --- -1.7.11.7 - diff --git a/0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch b/0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch deleted file mode 100644 index dedadd2..0000000 --- a/0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 532116d4dd16632806ed4a036c2e89b966221031 Mon Sep 17 00:00:00 2001 -From: Bill Pemberton -Date: Wed, 10 Oct 2012 16:54:01 -0400 -Subject: [PATCH 05/11] mount: add -c abbreviation for --no-canonicalize to - man page - -The --no-canonicalize option can also be set using -c. The --help for -mount shows this option but the man page did not. Add -c to the man -page. - -Signed-off-by: Bill Pemberton ---- - sys-utils/mount.8 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 -index dce4b8c..83a4518 100644 ---- a/sys-utils/mount.8 -+++ b/sys-utils/mount.8 -@@ -552,7 +552,7 @@ Mount without writing in - This is necessary for example when - .I /etc - is on a read-only filesystem. --.IP "\fB\-\-no\-canonicalize\fP" -+.IP "\fB\-c, \-\-no\-canonicalize\fP" - Don't canonicalize paths. The mount command canonicalizes all paths - (from command line or fstab) and stores canonicalized paths to the - .IR /etc/mtab --- -1.7.11.7 - diff --git a/0006-mount-add-long-options-for-L-and-U-to-man-page.patch b/0006-mount-add-long-options-for-L-and-U-to-man-page.patch deleted file mode 100644 index feb4c39..0000000 --- a/0006-mount-add-long-options-for-L-and-U-to-man-page.patch +++ /dev/null @@ -1,33 +0,0 @@ -From b426209c5ba2126a9038363a269fec884af470fb Mon Sep 17 00:00:00 2001 -From: Bill Pemberton -Date: Wed, 10 Oct 2012 16:54:02 -0400 -Subject: [PATCH 06/11] mount: add long options for -L and -U to man page - -The -L and -U flags both have long options too (--label and --uuid). -The usage() function will show them but the man page didn't list them. - -Signed-off-by: Bill Pemberton ---- - sys-utils/mount.8 | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 -index 83a4518..0b40bf7 100644 ---- a/sys-utils/mount.8 -+++ b/sys-utils/mount.8 -@@ -586,10 +586,10 @@ set the block device to read-only mode, see command - .IP "\fB\-w, \-\-rw\fP" - Mount the filesystem read/write. This is the default. A synonym is - .BR "\-o rw" . --.IP "\fB\-L \fIlabel\fP" -+.IP "\fB\-L, \-\-label \fIlabel\fP" - Mount the partition that has the specified - .IR label . --.IP "\fB\-U \fIuuid\fP" -+.IP "\fB\-U, \-\-uuid \fIuuid\fP" - Mount the partition that has the specified - .IR uuid . - These two options require the file --- -1.7.11.7 - diff --git a/0007-lib-loopdev-improve-debug-messages.patch b/0007-lib-loopdev-improve-debug-messages.patch deleted file mode 100644 index 0db04da..0000000 --- a/0007-lib-loopdev-improve-debug-messages.patch +++ /dev/null @@ -1,107 +0,0 @@ -From deb0e659451d4ade29df3dbb842607edd6080c0d Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 17 Oct 2012 11:42:21 +0200 -Subject: [PATCH 07/11] lib/loopdev: improve debug messages - -Signed-off-by: Karel Zak ---- - lib/loopdev.c | 22 ++++++++++++++++++---- - sys-utils/losetup.c | 2 -- - 2 files changed, 18 insertions(+), 6 deletions(-) - -diff --git a/lib/loopdev.c b/lib/loopdev.c -index a9f6df2..0e6033a 100644 ---- a/lib/loopdev.c -+++ b/lib/loopdev.c -@@ -87,8 +87,10 @@ int loopcxt_set_device(struct loopdev_cxt *lc, const char *device) - if (!lc) - return -EINVAL; - -- if (lc->fd >= 0) -+ if (lc->fd >= 0) { - close(lc->fd); -+ DBG(lc, loopdev_debug("closing old open fd")); -+ } - lc->fd = -1; - lc->mode = 0; - lc->has_info = 0; -@@ -158,19 +160,26 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags) - memcpy(lc, &dummy, sizeof(dummy)); - lc->flags = flags; - -+ if (getenv("LOOPDEV_DEBUG")) -+ loopcxt_enable_debug(lc, TRUE); -+ - rc = loopcxt_set_device(lc, NULL); - if (rc) - return rc; - - if (!(lc->flags & LOOPDEV_FL_NOSYSFS) && -- get_linux_version() >= KERNEL_VERSION(2,6,37)) -+ get_linux_version() >= KERNEL_VERSION(2,6,37)) { - /* - * Use only sysfs for basic information about loop devices - */ - lc->flags |= LOOPDEV_FL_NOIOCTL; -+ DBG(lc, loopdev_debug("init: ignore ioctls")); -+ } - -- if (!(lc->flags & LOOPDEV_FL_CONTROL) && !stat(_PATH_DEV_LOOPCTL, &st)) -+ if (!(lc->flags & LOOPDEV_FL_CONTROL) && !stat(_PATH_DEV_LOOPCTL, &st)) { - lc->flags |= LOOPDEV_FL_CONTROL; -+ DBG(lc, loopdev_debug("init: loop-control detected ")); -+ } - - return 0; - } -@@ -272,7 +281,9 @@ int loopcxt_get_fd(struct loopdev_cxt *lc) - if (lc->fd < 0) { - lc->mode = lc->flags & LOOPDEV_FL_RDWR ? O_RDWR : O_RDONLY; - lc->fd = open(lc->device, lc->mode); -- DBG(lc, loopdev_debug("open %s", lc->fd < 0 ? "failed" : "ok")); -+ DBG(lc, loopdev_debug("open %s [%s]: %s", lc->device, -+ lc->flags & LOOPDEV_FL_RDWR ? "rw" : "ro", -+ lc->fd < 0 ? "failed" : "ok")); - } - return lc->fd; - } -@@ -576,6 +587,7 @@ int loopcxt_next(struct loopdev_cxt *lc) - * of loop devices). This is enough for 99% of all cases. - */ - if (iter->default_check) { -+ DBG(lc, loopdev_debug("iter: next: default check")); - for (++iter->ncur; iter->ncur < LOOPDEV_DEFAULT_NNODES; - iter->ncur++) { - char name[16]; -@@ -590,6 +602,7 @@ int loopcxt_next(struct loopdev_cxt *lc) - /* C) the worst possibility, scan whole /dev or /dev/loop/ - */ - if (!iter->minors) { -+ DBG(lc, loopdev_debug("iter: next: scan /dev")); - iter->nminors = (lc->flags & LOOPDEV_FL_DEVSUBDIR) ? - loop_scandir(_PATH_DEV_LOOP, &iter->minors, 0) : - loop_scandir(_PATH_DEV, &iter->minors, 1); -@@ -1150,6 +1163,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) - DBG(lc, loopdev_debug("setup: backing file open: OK")); - - if (lc->fd != -1 && lc->mode != mode) { -+ DBG(lc, loopdev_debug("closing already open device (mode mismatch)")); - close(lc->fd); - lc->fd = -1; - lc->mode = 0; -diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c -index fdcc0be..a8381a8 100644 ---- a/sys-utils/losetup.c -+++ b/sys-utils/losetup.c -@@ -250,8 +250,6 @@ int main(int argc, char **argv) - if (loopcxt_init(&lc, 0)) - err(EXIT_FAILURE, _("failed to initialize loopcxt")); - -- loopcxt_enable_debug(&lc, getenv("LOOPDEV_DEBUG") ? TRUE : FALSE); -- - while ((c = getopt_long(argc, argv, "ac:d:De:E:fhj:o:p:PrvV", - longopts, NULL)) != -1) { - --- -1.7.11.7 - diff --git a/0008-lib-loopdev-check-for-sys.patch b/0008-lib-loopdev-check-for-sys.patch deleted file mode 100644 index ba50416..0000000 --- a/0008-lib-loopdev-check-for-sys.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 939636dd664cc608232c272de77be96e6f089235 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 17 Oct 2012 11:43:39 +0200 -Subject: [PATCH 08/11] lib/loopdev: check for /sys - -The current loopdev code prefers /sys to get information about -loop devices. The old methods like scan /dev are fallback solution -only. Unfortunately, the code does not check if /sys is mounted. - -Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad -Signed-off-by: Karel Zak ---- - lib/loopdev.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/lib/loopdev.c b/lib/loopdev.c -index 0e6033a..f62af83 100644 ---- a/lib/loopdev.c -+++ b/lib/loopdev.c -@@ -167,6 +167,12 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags) - if (rc) - return rc; - -+ if (stat(_PATH_SYS_BLOCK, &st) || !S_ISDIR(st.st_mode)) { -+ lc->flags |= LOOPDEV_FL_NOSYSFS; -+ lc->flags &= ~LOOPDEV_FL_NOIOCTL; -+ DBG(lc, loopdev_debug("init: disable /sys usage")); -+ } -+ - if (!(lc->flags & LOOPDEV_FL_NOSYSFS) && - get_linux_version() >= KERNEL_VERSION(2,6,37)) { - /* --- -1.7.11.7 - diff --git a/0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch b/0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch deleted file mode 100644 index dc4f7b7..0000000 --- a/0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 75f03f036011003c2a9e8e634ca3ce7930873318 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 22 Oct 2012 10:10:55 +0200 -Subject: [PATCH 09/11] fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make - check - - make check - sudo su - - cd tests - ./run.sh cramfs - -Signed-off-by: Karel Zak ---- - disk-utils/Makemodule.am | 5 +++++ - tests/commands.sh | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/disk-utils/Makemodule.am b/disk-utils/Makemodule.am -index f2360bf..b329a99 100644 ---- a/disk-utils/Makemodule.am -+++ b/disk-utils/Makemodule.am -@@ -97,6 +97,11 @@ fsck_cramfs_LDADD = $(LDADD) -lz libcommon.la - sbin_PROGRAMS += mkfs.cramfs - mkfs_cramfs_SOURCES = disk-utils/mkfs.cramfs.c $(cramfs_common_sources) - mkfs_cramfs_LDADD = $(LDADD) -lz libcommon.la -+ -+check_PROGRAMS += test_fsck.cramfs -+test_fsck_cramfs_SOURCES = $(fsck_cramfs_SOURCES) -+test_fsck_cramfs_LDADD = $(fsck_cramfs_LDADD) -+test_fsck_cramfs_CFLAGS = $(AM_CFLAGS) -DINCLUDE_FS_TESTS - endif - - -diff --git a/tests/commands.sh b/tests/commands.sh -index 8a1577e..db1d4ac 100644 ---- a/tests/commands.sh -+++ b/tests/commands.sh -@@ -37,7 +37,7 @@ TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"$top_builddir/losetup"} - TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"$top_builddir/mkswap"} - TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"$top_builddir/mkfs.cramfs"} - TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"$top_builddir/mkfs.minix"} --TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/fsck.cramfs"} -+TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/test_fsck.cramfs"} - TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"$top_builddir/fsck.minix"} - - TS_CMD_IPCS=${TS_CMD_IPCS:-"$top_builddir/ipcs"} --- -1.7.11.7 - diff --git a/0010-login-fix-compiler-warning-Wunused-result.patch b/0010-login-fix-compiler-warning-Wunused-result.patch deleted file mode 100644 index 2d50045..0000000 --- a/0010-login-fix-compiler-warning-Wunused-result.patch +++ /dev/null @@ -1,44 +0,0 @@ -From ed68f1e2f5609a3f42492df407d62b8fc006ea17 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Mon, 22 Oct 2012 13:13:02 +0200 -Subject: [PATCH 10/11] login: fix compiler warning [-Wunused-result] - -It's probably unnecessary paranoia, but let's check if we're able to -restore the original IDs after ~/.hushlogin file check. - -Signed-off-by: Karel Zak ---- - login-utils/login.c | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - -diff --git a/login-utils/login.c b/login-utils/login.c -index 8ae5266..f5896da 100644 ---- a/login-utils/login.c -+++ b/login-utils/login.c -@@ -1031,13 +1031,17 @@ static int get_hushlogin_status(struct passwd *pwd) - gid_t egid = getegid(); - - sprintf(buf, "%s/%s", pwd->pw_dir, file); -- setregid(-1, pwd->pw_gid); -- setreuid(0, pwd->pw_uid); -- ok = effective_access(buf, O_RDONLY) == 0; -- setuid(0); /* setreuid doesn't do it alone! */ -- setreuid(ruid, 0); -- setregid(-1, egid); - -+ if (setregid(-1, pwd->pw_gid) == 0 && -+ setreuid(0, pwd->pw_uid) == 0) -+ ok = effective_access(buf, O_RDONLY) == 0; -+ -+ if (setuid(0) != 0 || -+ setreuid(ruid, 0) != 0 || -+ setregid(-1, egid) != 0) { -+ syslog(LOG_ALERT, _("hush login status: restore original IDs failed")); -+ exit(EXIT_FAILURE); -+ } - if (ok) - return 1; /* enabled by user */ - } --- -1.7.11.7 - diff --git a/0011-misc-make-readlink-usage-more-robust.patch b/0011-misc-make-readlink-usage-more-robust.patch deleted file mode 100644 index ce4e754..0000000 --- a/0011-misc-make-readlink-usage-more-robust.patch +++ /dev/null @@ -1,63 +0,0 @@ -From a3528342bc716ecdabdd86609ae5a3198f560870 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 23 Oct 2012 12:40:39 +0200 -Subject: [PATCH 11/11] misc: make readlink() usage more robust - -Signed-off-by: Karel Zak ---- - misc-utils/lsblk.c | 4 ++-- - misc-utils/lslocks.c | 2 +- - sys-utils/eject.c | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c -index cc97c05..9c25dd0 100644 ---- a/misc-utils/lsblk.c -+++ b/misc-utils/lsblk.c -@@ -962,7 +962,7 @@ static int get_wholedisk_from_partition_dirent(DIR *dir, const char *dirname, - int len; - - if ((len = readlink_at(dirfd(dir), dirname, -- d->d_name, path, sizeof(path))) < 0) -+ d->d_name, path, sizeof(path) - 1)) < 0) - return 0; - - path[len] = '\0'; -@@ -1075,7 +1075,7 @@ static char *devno_to_sysfs_name(dev_t devno, char *devname, char *buf, size_t b - return NULL; - } - -- len = readlink(path, buf, buf_size); -+ len = readlink(path, buf, buf_size - 1); - if (len < 0) { - warn(_("%s: failed to read link"), path); - return NULL; -diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c -index 45fb6de..495eb80 100644 ---- a/misc-utils/lslocks.c -+++ b/misc-utils/lslocks.c -@@ -196,7 +196,7 @@ static char *get_filename_sz(ino_t inode, pid_t pid, size_t *size) - continue; - - if ((len = readlink_at(fd, path, dp->d_name, -- sym, sizeof(path))) < 1) -+ sym, sizeof(sym) - 1)) < 1) - goto out; - - *size = sb.st_size; -diff --git a/sys-utils/eject.c b/sys-utils/eject.c -index 1a5b834..6d0da18 100644 ---- a/sys-utils/eject.c -+++ b/sys-utils/eject.c -@@ -837,7 +837,7 @@ static char *get_subsystem(char *chain, char *buf, size_t bufsz) - memcpy(chain + len, SUBSYSTEM_LINKNAME, sizeof(SUBSYSTEM_LINKNAME)); - - /* try if subsystem symlink exists */ -- sz = readlink(chain, buf, bufsz); -+ sz = readlink(chain, buf, bufsz - 1); - - /* remove last subsystem from chain */ - chain[len] = '\0'; --- -1.7.11.7 - diff --git a/agetty-replace-perms-660-to-620.patch b/agetty-replace-perms-660-to-620.patch new file mode 100644 index 0000000..ebf59b7 --- /dev/null +++ b/agetty-replace-perms-660-to-620.patch @@ -0,0 +1,45 @@ +From 7afbf6f20e1de62fb5595411d998703c95af8965 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 2 Jan 2013 08:23:00 +0100 +Subject: [PATCH 1/3] agetty: replace perms 660 to 620 + + ... the default is root:tty 620 + +Signed-off-by: Karel Zak +--- + login-utils/login.1 | 5 ++++- + term-utils/agetty.c | 2 +- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/login-utils/login.1 b/login-utils/login.1 +index 092213d..e37e5e6 100644 +--- a/login-utils/login.1 ++++ b/login-utils/login.1 +@@ -184,7 +184,10 @@ login failure. The default value is + (string) + .RS 4 + The terminal permissions. The default value is +-.IR 0600 . ++.IR 0600 ++or ++.IR 0620 ++if tty group is used. + .RE + .PP + .B TTYGROUP +diff --git a/term-utils/agetty.c b/term-utils/agetty.c +index 7ee252d..17ebfba 100644 +--- a/term-utils/agetty.c ++++ b/term-utils/agetty.c +@@ -894,7 +894,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) + * Linux login(1) will change tty permissions. Use root owner and group + * with permission -rw------- for the period between getty and login. + */ +- if (chown(buf, 0, gid) || chmod(buf, (gid ? 0660 : 0600))) { ++ if (chown(buf, 0, gid) || chmod(buf, (gid ? 0620 : 0600))) { + if (errno == EROFS) + log_warn("%s: %m", buf); + else +-- +1.8.1 + diff --git a/cal-don-t-mix-ncurses-output-functions-and-printf.patch b/cal-don-t-mix-ncurses-output-functions-and-printf.patch new file mode 100644 index 0000000..1641068 --- /dev/null +++ b/cal-don-t-mix-ncurses-output-functions-and-printf.patch @@ -0,0 +1,139 @@ +From c265cc40a8ece740084fbfb3ebd4c1894b3b29b7 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 17 Jan 2013 18:48:16 +0100 +Subject: [PATCH 3/3] cal: don't mix ncurses output functions and printf() + +Fedora 18 (ncurses-libs-5.9-7.20121017, glibc-2.16-28): + +$ cal | cat +Actual results: + January 2013 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 +9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 31 + +Not sure where is the problem, but it's too fragile to mix two +output methods in one code. + +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=896447 +Signed-off-by: Karel Zak +--- + misc-utils/cal.c | 43 +++++++++++++++++++++++++++---------------- + 1 file changed, 27 insertions(+), 16 deletions(-) + +diff --git a/misc-utils/cal.c b/misc-utils/cal.c +index 60e85df..0e204b9 100644 +--- a/misc-utils/cal.c ++++ b/misc-utils/cal.c +@@ -498,7 +498,7 @@ monthly(int day, int month, int year) { + do_monthly(day, month, year, &out); + for (i = 0; i < FMT_ST_LINES; i++) { + my_putstring(out.s[i]); +- putchar('\n'); ++ my_putstring("\n"); + } + } + +@@ -533,8 +533,11 @@ monthly3(int day, int month, int year) { + do_monthly(day, next_month, next_year, &out_next); + + width = (julian ? J_WEEK_LEN : WEEK_LEN) -1; +- for (i = 0; i < 2; i++) +- printf("%s %s %s\n", out_prev.s[i], out_curm.s[i], out_next.s[i]); ++ for (i = 0; i < 2; i++) { ++ snprintf(lineout, sizeof(lineout), ++ "%s %s %s\n", out_prev.s[i], out_curm.s[i], out_next.s[i]); ++ my_putstring(lineout); ++ } + for (i = 2; i < FMT_ST_LINES; i++) { + int w1, w2, w3; + w1 = w2 = w3 = width; +@@ -562,7 +565,7 @@ j_yearly(int day, int year) { + + snprintf(lineout, sizeof(lineout), "%d", year); + center(lineout, J_WEEK_LEN*2 + J_HEAD_SEP - 1, 0); +- printf("\n\n"); ++ my_putstring("\n\n"); + + for (i = 0; i < 12; i++) + day_array(day, i + 1, year, days[i]); +@@ -571,8 +574,10 @@ j_yearly(int day, int year) { + for (month = 0; month < 12; month += 2) { + center(full_month[month], J_WEEK_LEN-1, J_HEAD_SEP+1); + center(full_month[month + 1], J_WEEK_LEN-1, 0); +- printf("\n%s%*s %s\n", j_day_headings, J_HEAD_SEP, "", +- j_day_headings); ++ snprintf(lineout, sizeof(lineout), ++ "\n%s%*s %s\n", j_day_headings, J_HEAD_SEP, "", ++ j_day_headings); ++ my_putstring(lineout); + for (row = 0; row < 6; row++) { + p = lineout; + for (which_cal = 0; which_cal < 2; which_cal++) { +@@ -584,10 +589,10 @@ j_yearly(int day, int year) { + *p = '\0'; + trim_trailing_spaces(lineout); + my_putstring(lineout); +- putchar('\n'); ++ my_putstring("\n"); + } + } +- printf("\n"); ++ my_putstring("\n"); + } + + void +@@ -598,7 +603,7 @@ yearly(int day, int year) { + + snprintf(lineout, sizeof(lineout), "%d", year); + center(lineout, WEEK_LEN*3 + HEAD_SEP*2 - 1, 0); +- printf("\n\n"); ++ my_putstring("\n\n"); + + for (i = 0; i < 12; i++) + day_array(day, i + 1, year, days[i]); +@@ -608,8 +613,10 @@ yearly(int day, int year) { + center(full_month[month], WEEK_LEN-1, HEAD_SEP+1); + center(full_month[month + 1], WEEK_LEN-1, HEAD_SEP+1); + center(full_month[month + 2], WEEK_LEN-1, 0); +- printf("\n%s%*s %s%*s %s\n", day_headings, HEAD_SEP, +- "", day_headings, HEAD_SEP, "", day_headings); ++ snprintf(lineout, sizeof(lineout), ++ "\n%s%*s %s%*s %s\n", day_headings, HEAD_SEP, ++ "", day_headings, HEAD_SEP, "", day_headings); ++ my_putstring(lineout); + for (row = 0; row < 6; row++) { + p = lineout; + for (which_cal = 0; which_cal < 3; which_cal++) { +@@ -621,10 +628,10 @@ yearly(int day, int year) { + *p = '\0'; + trim_trailing_spaces(lineout); + my_putstring(lineout); +- putchar('\n'); ++ my_putstring("\n"); + } + } +- putchar('\n'); ++ my_putstring("\n"); + } + + /* +@@ -773,10 +780,14 @@ void + center(const char *str, size_t len, int separate) + { + char lineout[FMT_ST_CHARS]; ++ + center_str(str, lineout, ARRAY_SIZE(lineout), len); +- fputs(lineout, stdout); +- if (separate) +- printf("%*s", separate, ""); ++ my_putstring(lineout); ++ ++ if (separate) { ++ snprintf(lineout, sizeof(lineout), "%*s", separate, ""); ++ my_putstring(lineout); ++ } + } + + static void __attribute__ ((__noreturn__)) usage(FILE * out) +-- +1.8.1 + diff --git a/hexdump-do-not-segfault-when-iterating-over-an-empty.patch b/hexdump-do-not-segfault-when-iterating-over-an-empty.patch new file mode 100644 index 0000000..c9472bd --- /dev/null +++ b/hexdump-do-not-segfault-when-iterating-over-an-empty.patch @@ -0,0 +1,95 @@ +From 85c24fe2b11cd136d43bbffd983014a3f967c25e Mon Sep 17 00:00:00 2001 +From: Ondrej Oprala +Date: Fri, 21 Dec 2012 13:04:04 +0100 +Subject: [PATCH 2/3] hexdump: do not segfault when iterating over an empty + format string + +Signed-off-by: Ondrej Oprala +--- + tests/commands.sh | 1 + + tests/expected/hexdump/empty-format | 1 + + tests/ts/hexdump/empty-format | 26 ++++++++++++++++++++++++++ + text-utils/parse.c | 16 +++++++++------- + 4 files changed, 37 insertions(+), 7 deletions(-) + create mode 100644 tests/expected/hexdump/empty-format + create mode 100755 tests/ts/hexdump/empty-format + +diff --git a/tests/commands.sh b/tests/commands.sh +index db1d4ac..3672095 100644 +--- a/tests/commands.sh ++++ b/tests/commands.sh +@@ -62,3 +62,4 @@ TS_CMD_FINDMNT=${TS_CMD_FINDMNT-"$top_builddir/findmnt"} + + TS_CMD_FDISK=${TS_CMD_FDISK-"$top_builddir/fdisk"} + ++TS_CMD_HEXDUMP=${TS_CMD_HEXDUMP-"$top_builddir/hexdump"} +diff --git a/tests/expected/hexdump/empty-format b/tests/expected/hexdump/empty-format +new file mode 100644 +index 0000000..9d60796 +--- /dev/null ++++ b/tests/expected/hexdump/empty-format +@@ -0,0 +1 @@ ++11 +\ No newline at end of file +diff --git a/tests/ts/hexdump/empty-format b/tests/ts/hexdump/empty-format +new file mode 100755 +index 0000000..4a3e528 +--- /dev/null ++++ b/tests/ts/hexdump/empty-format +@@ -0,0 +1,26 @@ ++#!/bin/bash ++ ++# This file is part of util-linux. ++# ++# This file is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This file is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++TS_TOPDIR="$(dirname $0)/../.." ++TS_DESC="format-strings" ++ ++. $TS_TOPDIR/functions.sh ++ts_init "$*" ++ ++INPUT=$(printf \\1) ++$TS_CMD_HEXDUMP -n1 -ve '2 "" "%x"' <<< $INPUT 2>&1 >> $TS_OUTPUT ++ ++$TS_CMD_HEXDUMP -n1 -ve '4 "%x"' -e '2 ""' <<< $INPUT 2>&1 >> $TS_OUTPUT ++ ++ts_finalize +diff --git a/text-utils/parse.c b/text-utils/parse.c +index 5f1e2bd..bd96961 100644 +--- a/text-utils/parse.c ++++ b/text-utils/parse.c +@@ -421,13 +421,15 @@ isint2: switch(fu->bcnt) { + !(fu->flags&F_SETREP) && fu->bcnt) + fu->reps += (blocksize - fs->bcnt) / fu->bcnt; + if (fu->reps > 1) { +- for (pr = fu->nextpr;; pr = pr->nextpr) +- if (!pr->nextpr) +- break; +- for (p1 = pr->fmt, p2 = NULL; *p1; ++p1) +- p2 = isspace((unsigned char)*p1) ? p1 : NULL; +- if (p2) +- pr->nospace = p2; ++ if (fu->nextpr) { ++ for (pr = fu->nextpr; ; pr = pr->nextpr) ++ if (!pr->nextpr) ++ break; ++ for (p1 = pr->fmt, p2 = NULL; *p1; ++p1) ++ p2 = isspace((unsigned char)*p1) ? p1 : NULL; ++ if (p2) ++ pr->nospace = p2; ++ } + } + } + } +-- +1.8.1 + diff --git a/libblkid-add-support-for-btrfs-backup-superblock.patch b/libblkid-add-support-for-btrfs-backup-superblock.patch new file mode 100644 index 0000000..e8a3ea8 --- /dev/null +++ b/libblkid-add-support-for-btrfs-backup-superblock.patch @@ -0,0 +1,46 @@ +From d4a276491269b6502c15e0089fba6b616f5c5df8 Mon Sep 17 00:00:00 2001 +From: Goffredo Baroncelli +Date: Wed, 9 Jan 2013 22:14:43 +0100 +Subject: [PATCH] libblkid: add support for btrfs backup superblock + +Btrfs has three superblock. The first one is placed at 64KB, the second one at +64MB, the third one at 256GB. + +If the first superblock is valid except that the "magic field" is zeroed, btrfs +skips the check of the other superblocks. If the first superblock is fully +invalid, btrfs checks for the other superblock. + +So zeroing the first superblock "magic field" at the beginning seems that the +filesystem is wiped. But when the first superblock is overwritten (eg by +another filesystem), then the other two superblock may be considered valid, and +the filesystem may resurrect. + +This patch allow to find and wipe the other btrfs superblocks signature. + +Signed-off-by: Karel Zak +--- + libblkid/src/superblocks/btrfs.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/libblkid/src/superblocks/btrfs.c b/libblkid/src/superblocks/btrfs.c +index 039be42..1bd1df9 100644 +--- a/libblkid/src/superblocks/btrfs.c ++++ b/libblkid/src/superblocks/btrfs.c +@@ -87,6 +87,14 @@ const struct blkid_idinfo btrfs_idinfo = + .magics = + { + { .magic = "_BHRfS_M", .len = 8, .kboff = 64, .sboff = 0x40 }, ++ { .magic = "_BHRfS_M", ++ .len = 8, ++ .kboff = 64 * 1024, ++ .sboff = 0x40 }, ++ { .magic = "_BHRfS_M", ++ .len = 8, ++ .kboff = 256 * 1024 * 1024, ++ .sboff = 0x40 }, + { NULL } + } + }; +-- +1.7.11.7 + diff --git a/libblkid-make-backup-superblock-visible-for-wipefs-8.patch b/libblkid-make-backup-superblock-visible-for-wipefs-8.patch new file mode 100644 index 0000000..df06674 --- /dev/null +++ b/libblkid-make-backup-superblock-visible-for-wipefs-8.patch @@ -0,0 +1,64 @@ +diff -up util-linux-2.22.2/libblkid/src/blkidP.h.kzak util-linux-2.22.2/libblkid/src/blkidP.h +--- util-linux-2.22.2/libblkid/src/blkidP.h.kzak 2012-12-12 21:04:47.902355093 +0100 ++++ util-linux-2.22.2/libblkid/src/blkidP.h 2013-02-20 10:54:33.885606609 +0100 +@@ -224,6 +224,9 @@ struct blkid_struct_probe + + /* private per-probing flags */ + #define BLKID_PROBE_FL_IGNORE_PT (1 << 1) /* ignore partition table */ ++#define BLKID_PROBE_FL_IGNORE_BACKUP (1 << 2) /* ignore backup superblocks or PT */ ++ ++extern int blkid_probe_ignore_backup(blkid_probe pr); + + extern blkid_probe blkid_clone_probe(blkid_probe parent); + extern blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr); +diff -up util-linux-2.22.2/libblkid/src/probe.c.kzak util-linux-2.22.2/libblkid/src/probe.c +--- util-linux-2.22.2/libblkid/src/probe.c.kzak 2012-12-12 21:04:47.903355101 +0100 ++++ util-linux-2.22.2/libblkid/src/probe.c 2013-02-20 11:02:48.525255696 +0100 +@@ -810,6 +810,7 @@ int blkid_probe_get_idmag(blkid_probe pr + static inline void blkid_probe_start(blkid_probe pr) + { + if (pr) { ++ DBG(DEBUG_LOWPROBE, printf("%p: start probe\n", pr)); + pr->cur_chain = NULL; + pr->prob_flags = 0; + blkid_probe_set_wiper(pr, 0, 0); +@@ -819,6 +820,7 @@ static inline void blkid_probe_start(blk + static inline void blkid_probe_end(blkid_probe pr) + { + if (pr) { ++ DBG(DEBUG_LOWPROBE, printf("%p: end probe\n", pr)); + pr->cur_chain = NULL; + pr->prob_flags = 0; + blkid_probe_set_wiper(pr, 0, 0); +@@ -1057,6 +1059,8 @@ int blkid_do_safeprobe(blkid_probe pr) + + blkid_probe_start(pr); + ++ pr->prob_flags |= BLKID_PROBE_FL_IGNORE_BACKUP; ++ + for (i = 0; i < BLKID_NCHAINS; i++) { + struct blkid_chain *chn; + +@@ -1679,3 +1683,7 @@ void blkid_probe_use_wiper(blkid_probe p + } + } + ++int blkid_probe_ignore_backup(blkid_probe pr) ++{ ++ return pr && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_BACKUP); ++} +diff -up util-linux-2.22.2/libblkid/src/superblocks/btrfs.c.kzak util-linux-2.22.2/libblkid/src/superblocks/btrfs.c +--- util-linux-2.22.2/libblkid/src/superblocks/btrfs.c.kzak 2013-02-20 10:54:03.422381876 +0100 ++++ util-linux-2.22.2/libblkid/src/superblocks/btrfs.c 2013-02-20 10:54:33.886606616 +0100 +@@ -63,6 +63,11 @@ static int probe_btrfs(blkid_probe pr, c + { + struct btrfs_super_block *bfs; + ++ if (mag->kboff > 64 && blkid_probe_ignore_backup(pr)) { ++ DBG(DEBUG_LOWPROBE, printf("btrfs: found backup superblock, ignore\n")); ++ return 1; ++ } ++ + bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block); + if (!bfs) + return -1; diff --git a/libblkid-remove-optimization-from-verify-function.patch b/libblkid-remove-optimization-from-verify-function.patch new file mode 100644 index 0000000..7d40835 --- /dev/null +++ b/libblkid-remove-optimization-from-verify-function.patch @@ -0,0 +1,165 @@ +From 2270b1ad90b394950f4fe215eb2fc1042020cef0 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 1 Feb 2013 15:59:58 +0100 +Subject: [PATCH] libblkid: remove optimization from verify( funrtion + +Now libblkid (the cache based part) tries to probe for the cached +filesystem firstly. This optimization is broken, because: + + * new another superblock could be on the device and the original + is already obsolete + * we still need to probe for partitions and raids + * the code was too fragile + +The patch also suggests lsblk --fs in blkid.8 for end users. lsblk +read information from used db. + +Reported-by: Andreas Hofmeister +Signed-off-by: Karel Zak +--- + libblkid/src/verify.c | 76 ++++++++------------------------------------------- + misc-utils/blkid.8 | 11 ++++++++ + 2 files changed, 22 insertions(+), 65 deletions(-) + +diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c +index 4bab4de..0f48c48 100644 +--- a/libblkid/src/verify.c ++++ b/libblkid/src/verify.c +@@ -43,26 +43,6 @@ static void blkid_probe_to_tags(blkid_probe pr, blkid_dev dev) + blkid_set_tag(dev, name, data, len); + } + } +- +- /* +- * remove obsolete tags +- */ +- if (!nvals || !blkid_probe_has_value(pr, "LABEL")) +- blkid_set_tag(dev, "LABEL", NULL, 0); +- if (!nvals || !blkid_probe_has_value(pr, "UUID")) +- blkid_set_tag(dev, "UUID", NULL, 0); +- if (!nvals || !blkid_probe_has_value(pr, "PART_ENTRY_UUID")) +- blkid_set_tag(dev, "PARTUUID", NULL, 0); +- if (!nvals || !blkid_probe_has_value(pr, "PART_ENTRY_NAME")) +- blkid_set_tag(dev, "PARTLABEL", NULL, 0); +- if (!nvals || !blkid_probe_has_value(pr, "TYPE")) +- blkid_set_tag(dev, "TYPE", NULL, 0); +- if (!nvals || !blkid_probe_has_value(pr, "SEC_TYPE")) +- blkid_set_tag(dev, "SEC_TYPE", NULL, 0); +- if (!nvals || !blkid_probe_has_value(pr, "EXT_JOURNAL")) /* extN */ +- blkid_set_tag(dev, "EXT_JOURNAL", NULL, 0); +- if (!nvals || !blkid_probe_has_value(pr, "MOUNT")) /* ocfs */ +- blkid_set_tag(dev, "MOUNT", NULL, 0); + } + + /* +@@ -76,9 +56,10 @@ static void blkid_probe_to_tags(blkid_probe pr, blkid_dev dev) + */ + blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) + { ++ blkid_tag_iterate iter; ++ const char *type, *value; + struct stat st; + time_t diff, now; +- char *fltr[2]; + int fd; + + if (!dev) +@@ -155,64 +136,29 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) + return NULL; + } + +- blkid_probe_enable_superblocks(cache->probe, TRUE); ++ /* remove old cache info */ ++ iter = blkid_tag_iterate_begin(dev); ++ while (blkid_tag_next(iter, &type, &value) == 0) ++ blkid_set_tag(dev, type, NULL, 0); ++ blkid_tag_iterate_end(iter); + ++ /* enable superblocks probing */ ++ blkid_probe_enable_superblocks(cache->probe, TRUE); + blkid_probe_set_superblocks_flags(cache->probe, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | + BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE); + +- /* +- * If we already know the type, then try that first. +- */ +- if (dev->bid_type) { +- blkid_tag_iterate iter; +- const char *type, *value; +- +- fltr[0] = dev->bid_type; +- fltr[1] = NULL; +- +- blkid_probe_filter_superblocks_type(cache->probe, +- BLKID_FLTR_ONLYIN, fltr); +- +- if (blkid_do_probe(cache->probe) == 0) { +- /* +- * Cool, we found FS type, let's also read PART{UUID,LABEL} +- */ +- blkid_probe_enable_superblocks(cache->probe, FALSE); +- blkid_probe_enable_partitions(cache->probe, TRUE); +- blkid_probe_set_partitions_flags(cache->probe, BLKID_PARTS_ENTRY_DETAILS); +- if (blkid_do_probe(cache->probe) == 0) +- goto found_type; +- } +- +- blkid_probe_enable_superblocks(cache->probe, TRUE); +- blkid_probe_invert_superblocks_filter(cache->probe); +- +- /* +- * Zap the device filesystem information and try again +- */ +- DBG(DEBUG_PROBE, +- printf("previous fs type %s not valid, " +- "trying full probe\n", dev->bid_type)); +- iter = blkid_tag_iterate_begin(dev); +- while (blkid_tag_next(iter, &type, &value) == 0) +- blkid_set_tag(dev, type, 0, 0); +- blkid_tag_iterate_end(iter); +- } +- ++ /* enable partitions probing */ + blkid_probe_enable_partitions(cache->probe, TRUE); + blkid_probe_set_partitions_flags(cache->probe, BLKID_PARTS_ENTRY_DETAILS); + +- /* +- * Probe for all types. +- */ ++ /* probe */ + if (blkid_do_safeprobe(cache->probe)) { + /* found nothing or error */ + blkid_free_dev(dev); + dev = NULL; + } + +-found_type: + if (dev) { + #ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC + struct timeval tv; +diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8 +index 2ba1ab4..eb8d716 100644 +--- a/misc-utils/blkid.8 ++++ b/misc-utils/blkid.8 +@@ -64,6 +64,17 @@ library. It can determine the type of content (e.g. filesystem or swap) + that a block device holds, and also attributes (tokens, NAME=value pairs) + from the content metadata (e.g. LABEL or UUID fields). + .PP ++Note that ++.B blkid ++reads information directly from devices and for non-root users ++it returns cached unverified information. It's better to use ++.B lsblk --fs ++to get user-friendly overview about filesystems and devices. ++.BR lsblk (8) ++is also easy to use in scripts. ++.B blkid ++is mostly designed for system services and to test libblkid functionality. ++.PP + .B blkid + has two main forms of operation: either searching for a device with a + specific NAME=value pair, or displaying NAME=value pairs for one or +-- +1.8.1 + diff --git a/sources b/sources index 7d69556..e03cca9 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -c6c15a1afc04d8a69d5b99db1c39623f util-linux-2.22.1.tar.xz +eeacbfdd2556acd899a2d0ffdb446185 util-linux-2.22.2.tar.xz a02aac97c74259ca1b24972c89147ca4 floppy-0.18.tar.bz2 diff --git a/util-linux-2.20-fdformat-man-ide.patch b/util-linux-2.22-fdformat-man-ide.patch similarity index 61% rename from util-linux-2.20-fdformat-man-ide.patch rename to util-linux-2.22-fdformat-man-ide.patch index de3618b..d742d5f 100644 --- a/util-linux-2.20-fdformat-man-ide.patch +++ b/util-linux-2.22-fdformat-man-ide.patch @@ -1,6 +1,6 @@ -diff -up util-linux-2.20-rc1/disk-utils/fdformat.8.orig util-linux-2.20-rc1/disk-utils/fdformat.8 ---- util-linux-2.20-rc1/disk-utils/fdformat.8.orig 2011-07-20 21:55:23.000000000 +0200 -+++ util-linux-2.20-rc1/disk-utils/fdformat.8 2011-07-29 21:08:57.558601033 +0200 +diff -up util-linux-2.22.2/disk-utils/fdformat.8.kzak util-linux-2.22.2/disk-utils/fdformat.8 +--- util-linux-2.22.2/disk-utils/fdformat.8.kzak 2012-06-11 12:06:53.620195844 +0200 ++++ util-linux-2.22.2/disk-utils/fdformat.8 2013-02-19 16:16:27.130214023 +0100 @@ -43,6 +43,11 @@ when a non-standard format is being used autodetected earlier. In this case, use .BR setfdprm (8) @@ -13,7 +13,7 @@ diff -up util-linux-2.20-rc1/disk-utils/fdformat.8.orig util-linux-2.20-rc1/disk .SH OPTIONS .TP \fB\-n\fR, \fB\-\-no\-verify\fR -@@ -58,7 +63,8 @@ Display help and exit. +@@ -57,7 +62,8 @@ Display help and exit. .BR fd (4), .BR setfdprm (8), .BR mkfs (8), diff --git a/util-linux-2.21-ipcs-32bit.patch b/util-linux-2.22-ipcs-32bit.patch similarity index 57% rename from util-linux-2.21-ipcs-32bit.patch rename to util-linux-2.22-ipcs-32bit.patch index 4685153..b6d5149 100644 --- a/util-linux-2.21-ipcs-32bit.patch +++ b/util-linux-2.22-ipcs-32bit.patch @@ -1,10 +1,10 @@ -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); +diff -up util-linux-2.22.2/sys-utils/ipcs.c.kzak util-linux-2.22.2/sys-utils/ipcs.c +--- util-linux-2.22.2/sys-utils/ipcs.c.kzak 2012-12-12 21:04:47.976355744 +0100 ++++ util-linux-2.22.2/sys-utils/ipcs.c 2013-02-19 16:12:54.712551108 +0100 +@@ -264,6 +264,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) +{ @@ -28,11 +28,11 @@ diff -up util-linux-2.21-rc1/sys-utils/ipcs.c.kzak util-linux-2.21-rc1/sys-utils + void do_shm (char format) { - 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 - */ + int maxid, shmid, id; +@@ -288,12 +309,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"), @@ -41,9 +41,9 @@ diff -up util-linux-2.21-rc1/sys-utils/ipcs.c.kzak util-linux-2.21-rc1/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; diff --git a/util-linux-ng-2.21-login-lastlog.patch b/util-linux-ng-2.21-login-lastlog.patch deleted file mode 100644 index 947a0e5..0000000 --- a/util-linux-ng-2.21-login-lastlog.patch +++ /dev/null @@ -1,11 +0,0 @@ -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; diff --git a/util-linux-ng-2.22-login-TCSANOW.patch b/util-linux-ng-2.22-login-TCSANOW.patch new file mode 100644 index 0000000..c7c58d8 --- /dev/null +++ b/util-linux-ng-2.22-login-TCSANOW.patch @@ -0,0 +1,64 @@ + +Based on upstream patch: + + From 8998ad001fdb58ceba4147f8aa4c72203117db25 Mon Sep 17 00:00:00 2001 + From: Karel Zak + Date: Wed, 5 Jun 2013 14:31:00 +0200 + Subject: [PATCH] login: use TCSANOW to remove HUPCL + + login(1) code: + + ttt.c_cflag &= ~HUPCL; + tcsetattr(0, TCSAFLUSH, &ttt); + + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + + signal(SIGHUP, SIG_IGN); /* so vhangup() wont kill us */ + vhangup(); + signal(SIGHUP, SIG_DFL); + + strace : + + ioctl(0, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF, {B9600 opost isig icanon echo ...}) = 0 + close(0) = 0 + close(1) = 0 + close(2) = 0 + --- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} --- + --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1, si_uid=0} --- + +++ killed by SIGTERM +++ + + It seems we get SIGHUP (and SIGTERM from systemd) before vhangup(). + The problem occur sometimes. + + I guess it's because TCSAFLUSH is not applied immediately, so it would + be probably better to use TCSANOW to make the code more robust. + + References: https://bugzilla.redhat.com/show_bug.cgi?id=962145 + Signed-off-by: Karel Zak + +diff -up util-linux-2.22.2/login-utils/login.c.kzak util-linux-2.22.2/login-utils/login.c +--- util-linux-2.22.2/login-utils/login.c.kzak 2013-08-01 14:03:39.189156123 +0200 ++++ util-linux-2.22.2/login-utils/login.c 2013-08-01 14:06:16.942580758 +0200 +@@ -407,7 +407,7 @@ static void init_tty(struct login_contex + } + + /* Kill processes left on this tty */ +- tcsetattr(0, TCSAFLUSH, &ttt); ++ tcsetattr(0, TCSANOW, &ttt); + + /* + * Let's close file decriptors before vhangup +@@ -1323,10 +1323,10 @@ int main(int argc, char **argv) + close(cnt); + + setpgrp(); /* set pgid to pid this means that setsid() will fail */ ++ init_tty(&cxt); + + openlog("login", LOG_ODELAY, LOG_AUTHPRIV); + +- init_tty(&cxt); + init_loginpam(&cxt); + + /* login -f, then the user has already been authenticated */ diff --git a/util-linux-ng-2.22-login-lastlog.patch b/util-linux-ng-2.22-login-lastlog.patch new file mode 100644 index 0000000..73085d7 --- /dev/null +++ b/util-linux-ng-2.22-login-lastlog.patch @@ -0,0 +1,12 @@ +diff -up util-linux-2.22.2/login-utils/login.c.kzak util-linux-2.22.2/login-utils/login.c +--- util-linux-2.22.2/login-utils/login.c.kzak 2012-12-12 21:04:47.906355128 +0100 ++++ util-linux-2.22.2/login-utils/login.c 2013-02-19 16:14:33.224339106 +0100 +@@ -514,7 +514,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; + diff --git a/util-linux.spec b/util-linux.spec index aa6dab8..5344c45 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,8 +1,8 @@ ### Header Summary: A collection of basic system utilities Name: util-linux -Version: 2.22.1 -Release: 2%{?dist} +Version: 2.22.2 +Release: 7%{?dist} License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -72,33 +72,33 @@ Requires(preun): systemd-units # add a missing header Patch0: util-linux-2.19-floppy-locale.patch # add note about ATAPI IDE floppy to fdformat.8 -Patch1: util-linux-2.20-fdformat-man-ide.patch +Patch1: util-linux-2.22-fdformat-man-ide.patch # 169628 - /usr/bin/floppy doesn't work with /dev/fd0 Patch2: util-linux-2.19-floppy-generic.patch ### Ready for upstream? ### # 151635 - makeing /var/log/lastlog -Patch3: util-linux-ng-2.21-login-lastlog.patch +Patch3: util-linux-ng-2.22-login-lastlog.patch # 231192 - ipcs is not printing correct values on pLinux -Patch4: util-linux-2.21-ipcs-32bit.patch +Patch4: util-linux-2.22-ipcs-32bit.patch - -### Upstream patches from proposed stable/v2.22.2 branch -### (remove after update to the final 2.22.2) ### -Patch101: 0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch -Patch102: 0002-wipefs-use-O_EXCL.patch -Patch103: 0003-swapon-remove-loop-declaration-smatch-scan.patch -Patch104: 0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch -Patch105: 0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch -Patch106: 0006-mount-add-long-options-for-L-and-U-to-man-page.patch -Patch107: 0007-lib-loopdev-improve-debug-messages.patch -Patch108: 0008-lib-loopdev-check-for-sys.patch -Patch109: 0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch -Patch110: 0010-login-fix-compiler-warning-Wunused-result.patch -Patch111: 0011-misc-make-readlink-usage-more-robust.patch - +### Upstream patches (2.23 or 2.22.x) +# 889888 - wipefs does not completely wipe btrfs volume +Patch100: libblkid-add-support-for-btrfs-backup-superblock.patch +# 882305 - agetty: unstable /dev/tty* permissions +Patch101: agetty-replace-perms-660-to-620.patch +# 885314 - hexdump segfault +Patch102: hexdump-do-not-segfault-when-iterating-over-an-empty.patch +# 896447 - No newlines in piped "cal" command +Patch103: cal-don-t-mix-ncurses-output-functions-and-printf.patch +# upstream patch +Patch104: libblkid-remove-optimization-from-verify-function.patch +# 902512 - No boot : Dependency failed for /home (and blkid fails to tell UUID) +Patch105: libblkid-make-backup-superblock-visible-for-wipefs-8.patch +# 928104 - telnet-server will not accept connections from Linux telnet client +Patch106: util-linux-ng-2.22-login-TCSANOW.patch %description The util-linux package contains a large variety of low-level system @@ -112,6 +112,7 @@ Summary: Device mounting library Group: Development/Libraries License: LGPLv2+ Requires: libblkid = %{version}-%{release} +Requires: libuuid = %{version}-%{release} Conflicts: filesystem < 3 %description -n libmount @@ -210,23 +211,9 @@ SMP systems. %setup -q -a 11 -n %{name}-%{upstream_version} cp %{SOURCE8} %{SOURCE9} . -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 - -%patch101 -p1 -%patch102 -p1 -%patch103 -p1 -%patch104 -p1 -%patch105 -p1 -%patch106 -p1 -%patch107 -p1 -%patch108 -p1 -%patch109 -p1 -%patch110 -p1 -%patch111 -p1 +for p in %{patches}; do + %{__patch} -p1 -F%{_default_patch_fuzz} -i "$p" +done %build unset LINGUAS || : @@ -387,7 +374,7 @@ chmod 644 misc-utils/getopt-*.{bash,tcsh} rm -f ${RPM_BUILD_ROOT}%{_datadir}/getopt/* rmdir ${RPM_BUILD_ROOT}%{_datadir}/getopt -ln -s /proc/mounts %{buildroot}/etc/mtab +ln -sf /proc/mounts %{buildroot}/etc/mtab # remove static libs @@ -425,8 +412,9 @@ if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then /usr/bin/chcon "$SECXT" /var/log/lastlog >/dev/null 2>&1 || : fi fi -rm -f /etc/mtab -ln -s /proc/mounts /etc/mtab +if [ ! -L /etc/mtab ]; then + ln -fs /proc/mounts /etc/mtab +fi %post -n libblkid /sbin/ldconfig @@ -695,7 +683,7 @@ fi %defattr(-,root,root) %doc Documentation/licenses/COPYING.GPLv2 %{_mandir}/man8/uuidd.8* -%attr(-, uuidd, uuidd) %{_sbindir}/uuidd +%{_sbindir}/uuidd %{_unitdir}/* %dir %attr(2775, uuidd, uuidd) /var/lib/libuuid %dir %attr(2775, uuidd, uuidd) /run/uuidd @@ -752,8 +740,45 @@ fi %{_mandir}/man3/uuid_unparse.3* %{_libdir}/pkgconfig/uuid.pc - %changelog +* Thu Aug 1 2013 Karel Zak 2.22.2-7 +- fix #928104 - telnet-server will not accept connections from Linux telnet client + +* Wed Feb 20 2013 Karel Zak 2.22.2-6 +- fix patch for #902512 + +* Tue Feb 19 2013 Karel Zak 2.22.2-5 +- fix #902512 - Dependency failed for /home (and blkid fails to tell UUID) +- refresh old patches + +* Wed Feb 6 2013 Karel Zak 2.22.2-4 +- improve convertion to mtab symlink in post script (#887763) + +* Sun Feb 3 2013 Karel Zak 2.22.2-3 +- fix #882305 - agetty: unstable /dev/tty* permissions +- fix #885314 - hexdump segfault +- fix #896447 - No newlines in piped "cal" command +- fix libblkid cache usage (upstream patch) +- fix #905008 - uuidd: /usr/sbin/uuidd has incorrect file permissions + +* Fri Jan 11 2013 Karel Zak 2.22.2-2 +- fix #889888 - wipefs does not completely wipe btrfs volume + +* Fri Jan 11 2013 Karel Zak 2.22.2-1 +- update tarball + +* Mon Dec 3 2012 Richard W.M. Jones 2.22.1-2.4 +- Include wipefs --force option (upstream patch) to fix virt-format program. + +* Mon Nov 19 2012 Karel Zak 2.22.1-2.3 +- use for() to apply patches, cleanup sources file + +* Mon Nov 19 2012 Karel Zak 2.22.1-2.2 +- update tarball + +* Thu Nov 1 2012 Karel Zak 2.22.1-2.1 +- remove fsck.cramfs -x patch, it's unnecessary for Fedora + * Thu Nov 1 2012 Karel Zak 2.22.1-2 - apply pathes from upstream stable/v2.22 branch - fix #865961 - wipefs -a should use O_EXCL