From b394b9eae4a21e566f3bd62a559095e09f013f0d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 03 2016 06:07:39 +0000 Subject: import util-linux-2.23.2-33.el7 --- diff --git a/SOURCES/0060-build-sys-add-CFLAGS-and-LDFLAGS-for-daemons-and-sha.patch b/SOURCES/0060-build-sys-add-CFLAGS-and-LDFLAGS-for-daemons-and-sha.patch new file mode 100644 index 0000000..cc9d680 --- /dev/null +++ b/SOURCES/0060-build-sys-add-CFLAGS-and-LDFLAGS-for-daemons-and-sha.patch @@ -0,0 +1,166 @@ +From 097c66ef2dd4779e01d13ad4a5f9733334fa9d1a Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 27 Aug 2013 10:02:04 +0200 +Subject: [PATCH 60/84] build-sys: add CFLAGS and LDFLAGS for daemons and + shared libs + +This is necessary for paranoid security guys who believe that things +like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the +world a safer place... + +[rhel7: add also SOLIB_* to libfdisk] + +Upstream: http://github.com/karelzak/util-linux/commit/03d00d495f3b505d9cae967c629fb38aca301e01 +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1092520 +Signed-off-by: Karel Zak +--- + Documentation/howto-compilation.txt | 10 +++++----- + configure.ac | 10 ++++++++++ + libblkid/src/Makemodule.am | 2 ++ + libfdisk/src/Makemodule.am | 3 +++ + libmount/src/Makemodule.am | 2 ++ + libuuid/src/Makemodule.am | 7 ++++++- + misc-utils/Makemodule.am | 3 ++- + 7 files changed, 30 insertions(+), 7 deletions(-) + +diff --git a/Documentation/howto-compilation.txt b/Documentation/howto-compilation.txt +index bebe0d2..4b39246 100644 +--- a/Documentation/howto-compilation.txt ++++ b/Documentation/howto-compilation.txt +@@ -27,12 +27,12 @@ Compiling + The SUID_* feature is currently supported for chfn, chsh, + newgrp, su, write, mount, and umount. + +- Preferred compilation options for developers, when +- using gcc, are: ++ Use DAEMON_CFLAGS and DAEMON_LDFLAGS when you want to define ++ special compiler options for daemons; supported for uuidd. + +- export CFLAGS="-Wmissing-parameter-type -Wsign-compare +- -Wtype-limits -Wuninitialized -Wunused-parameter +- -Wunused-but-set-parameter -fno-common" ++ Use SOLIB_CFLAGS and SOLIB_LDFLAGS when you want to define ++ special compiler options for shared libraries; supported for ++ libmount, libblkid and libuuid. + + FIXME: add notes about klib and uClib. + +diff --git a/configure.ac b/configure.ac +index f7c27cd..f3c7214 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1538,6 +1538,16 @@ AC_ARG_VAR([SUID_CFLAGS], + AC_ARG_VAR([SUID_LDFLAGS], + [LDFLAGS used for binaries which are usually with the suid bit]) + ++AC_ARG_VAR([DAEMON_CFLAGS], ++ [CFLAGS used for binaries which are usually executed as daemons]) ++AC_ARG_VAR([DAEMON_LDFLAGS], ++ [LDFLAGS used for binaries which are usually executed as daemons]) ++ ++AC_ARG_VAR([SOLIB_CFLAGS], ++ [CFLAGS used for shared libraries]) ++AC_ARG_VAR([SOLIB_LDFLAGS], ++ [LDFLAGS used for shared libraries]) ++ + LIBS="" + + +diff --git a/libblkid/src/Makemodule.am b/libblkid/src/Makemodule.am +index 04d8621..1563976 100644 +--- a/libblkid/src/Makemodule.am ++++ b/libblkid/src/Makemodule.am +@@ -113,6 +113,7 @@ libblkid_la_LIBADD = libcommon.la + + + libblkid_la_CFLAGS = \ ++ $(SOLIB_CFLAGS) \ + -I$(ul_libblkid_incdir) \ + -I$(top_srcdir)/libblkid/src + +@@ -128,6 +129,7 @@ libblkid_la_DEPENDENCIES = \ + libblkid/src/blkid.h.in + + libblkid_la_LDFLAGS = \ ++ $(SOLIB_LDFLAGS) \ + -Wl,--version-script=$(top_srcdir)/libblkid/src/blkid.sym \ + -version-info $(LIBBLKID_VERSION_INFO) + +diff --git a/libfdisk/src/Makemodule.am b/libfdisk/src/Makemodule.am +index fbfb1b4..5c50001 100644 +--- a/libfdisk/src/Makemodule.am ++++ b/libfdisk/src/Makemodule.am +@@ -25,6 +25,8 @@ nodist_libfdisk_la_SOURCES = libfdisk/src/fdiskP.h + libfdisk_la_LIBADD = libcommon.la + + libfdisk_la_CFLAGS = \ ++ $(AM_CFLAGS) \ ++ $(SOLIB_CFLAGS) \ + -I$(ul_libfdisk_incdir) \ + -I$(top_srcdir)/libfdisk/src + +@@ -39,6 +41,7 @@ libfdisk_la_CFLAGS += -I$(ul_libuuid_incdir) + endif + + libfdisk_la_DEPENDENCIES = $(libfdisk_la_LIBADD) ++libfdisk_la_LDFLAGS = $(SOLIB_LDFLAGS) + + + check_PROGRAMS += \ +diff --git a/libmount/src/Makemodule.am b/libmount/src/Makemodule.am +index 494e02a..8ef07e5 100644 +--- a/libmount/src/Makemodule.am ++++ b/libmount/src/Makemodule.am +@@ -33,6 +33,7 @@ nodist_libmount_la_SOURCES = libmount/src/mountP.h + libmount_la_LIBADD = libcommon.la libblkid.la $(SELINUX_LIBS) + + libmount_la_CFLAGS = \ ++ $(SOLIB_CFLAGS) \ + -I$(ul_libblkid_incdir) \ + -I$(ul_libmount_incdir) \ + -I$(top_srcdir)/libmount/src +@@ -43,6 +44,7 @@ libmount_la_DEPENDENCIES = \ + libmount/src/libmount.h.in + + libmount_la_LDFLAGS = \ ++ $(SOLIB_LDFLAGS) \ + -Wl,--version-script=$(top_srcdir)/libmount/src/libmount.sym \ + -version-info $(LIBMOUNT_VERSION_INFO) + +diff --git a/libuuid/src/Makemodule.am b/libuuid/src/Makemodule.am +index 73f1ba9..a20cb4c 100644 +--- a/libuuid/src/Makemodule.am ++++ b/libuuid/src/Makemodule.am +@@ -29,9 +29,14 @@ libuuid_la_SOURCES = \ + + libuuid_la_DEPENDENCIES = libuuid/src/uuid.sym + libuuid_la_LIBADD = $(SOCKET_LIBS) +-libuuid_la_CFLAGS = -I$(ul_libuuid_incdir) -Ilibuuid/src ++ ++libuuid_la_CFLAGS = \ ++ $(SOLIB_CFLAGS) \ ++ -I$(ul_libuuid_incdir) \ ++ -Ilibuuid/src + + libuuid_la_LDFLAGS = \ ++ $(SOLIB_LDFLAGS) \ + -Wl,--version-script=$(top_srcdir)/libuuid/src/uuid.sym \ + -version-info $(LIBUUID_VERSION_INFO) + +diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am +index a615047..70a78f2 100644 +--- a/misc-utils/Makemodule.am ++++ b/misc-utils/Makemodule.am +@@ -77,7 +77,8 @@ if BUILD_UUIDD + usrsbin_exec_PROGRAMS += uuidd + dist_man_MANS += misc-utils/uuidd.8 + uuidd_LDADD = $(LDADD) libuuid.la +-uuidd_CFLAGS = $(AM_CFLAGS) -I$(ul_libuuid_incdir) ++uuidd_CFLAGS = $(DAEMON_CFLAGS) $(AM_CFLAGS) -I$(ul_libuuid_incdir) ++uuidd_LDFLAGS = $(DAEMON_LDFLAGS) $(AM_LDFLAGS) + uuidd_SOURCES = misc-utils/uuidd.c + if USE_SOCKET_ACTIVATION + uuidd_SOURCES += misc-utils/sd-daemon.c misc-utils/sd-daemon.h +-- +2.7.4 + diff --git a/SOURCES/0060-fdisk-backport-DOS-logical-partitions-chain-reorder.patch b/SOURCES/0060-fdisk-backport-DOS-logical-partitions-chain-reorder.patch deleted file mode 100644 index 86e577c..0000000 --- a/SOURCES/0060-fdisk-backport-DOS-logical-partitions-chain-reorder.patch +++ /dev/null @@ -1,231 +0,0 @@ -From 81745b42a2722f11006c05de87ff90de08cf8cee Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 28 Jun 2016 11:30:21 +0200 -Subject: [PATCH] fdisk: backport DOS logical partitions chain reorder - -... from the current upstream. - -Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1304246 -Signed-off-by: Karel Zak ---- - fdisks/fdiskdoslabel.c | 170 +++++++++++++++++++++++++++++++++---------------- - include/c.h | 8 +++ - 2 files changed, 124 insertions(+), 54 deletions(-) - -diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c -index fe04ac7..b7eb35a 100644 ---- a/fdisks/fdiskdoslabel.c -+++ b/fdisks/fdiskdoslabel.c -@@ -55,6 +55,22 @@ static int MBRbuffer_changed; - #define cround(c, n) (fdisk_context_use_cylinders(c) ? \ - ((n) / fdisk_context_get_units_per_sector(c)) + 1 : (n)) - -+ -+static unsigned long long -+get_abs_partition_start(struct pte *pe) -+{ -+ return pe->offset + get_start_sect(pe->part_table); -+} -+ -+static unsigned long long -+get_abs_partition_end(struct pte *pe) -+{ -+ unsigned long long size; -+ -+ size = get_nr_sects(pe->part_table); -+ return get_abs_partition_start(pe) + size - (size ? 1 : 0); -+} -+ - static void warn_alignment(struct fdisk_context *cxt) - { - if (nowarn) -@@ -1254,67 +1270,113 @@ void dos_list_table_expert(struct fdisk_context *cxt, int extend) - } - } - --/* -- * Fix the chain of logicals. -- * extended_offset is unchanged, the set of sectors used is unchanged -- * The chain is sorted so that sectors increase, and so that -- * starting sectors increase. -- * -- * After this it may still be that cfdisk doesn't like the table. -- * (This is because cfdisk considers expanded parts, from link to -- * end of partition, and these may still overlap.) -- * Now -- * sfdisk /dev/hda > ohda; sfdisk /dev/hda < ohda -- * may help. -- */ -+ -+static void print_chain_of_logicals(struct fdisk_context *cxt) -+{ -+ size_t i; -+ -+ fputc('\n', stdout); -+ -+ for (i = 4; i < cxt->label->nparts_max; i++) { -+ struct pte *pe = &ptes[i]; -+ -+ fprintf(stderr, "#%02zu EBR [%10ju], " -+ "data[start=%10ju (%10ju), size=%10ju], " -+ "link[start=%10ju (%10ju), size=%10ju]\n", -+ i, (uintmax_t) pe->offset, -+ /* data */ -+ (uintmax_t) get_start_sect(pe->part_table), -+ (uintmax_t) get_abs_partition_start(pe), -+ (uintmax_t) get_nr_sects(pe->part_table), -+ /* link */ -+ (uintmax_t) get_start_sect(pe->ext_pointer), -+ (uintmax_t) (extended_offset + get_start_sect(pe->ext_pointer)), -+ (uintmax_t) get_nr_sects(pe->ext_pointer)); -+ } -+} -+ -+static int cmp_ebr_offsets(const void *a, const void *b) -+{ -+ struct pte *ae = (struct pte *) a, -+ *be = (struct pte *) b; -+ -+ if (ae->offset == 0 && be->offset == 0) -+ return 0; -+ if (ae->offset == 0) -+ return 1; -+ if (be->offset == 0) -+ return -1; -+ -+ return cmp_numbers(ae->offset, be->offset); -+} -+ - static void fix_chain_of_logicals(struct fdisk_context *cxt) - { -- size_t j, oj, ojj, sj, sjj; -- struct partition *pj,*pjj,tmp; -- -- /* Stage 1: sort sectors but leave sector of part 4 */ -- /* (Its sector is the global extended_offset.) */ -- stage1: -- for (j = 5; j < cxt->label->nparts_max - 1; j++) { -- oj = ptes[j].offset; -- ojj = ptes[j+1].offset; -- if (oj > ojj) { -- ptes[j].offset = ojj; -- ptes[j+1].offset = oj; -- pj = ptes[j].part_table; -- set_start_sect(pj, get_start_sect(pj)+oj-ojj); -- pjj = ptes[j+1].part_table; -- set_start_sect(pjj, get_start_sect(pjj)+ojj-oj); -- set_start_sect(ptes[j-1].ext_pointer, -- ojj-extended_offset); -- set_start_sect(ptes[j].ext_pointer, -- oj-extended_offset); -- goto stage1; -+ struct pte *last; -+ size_t i; -+ -+ DBG(CONTEXT, print_chain_of_logicals(cxt)); -+ -+ /* Sort chain by EBR offsets */ -+ qsort(&ptes[4], cxt->label->nparts_max - 4, sizeof(struct pte), -+ cmp_ebr_offsets); -+ -+again: -+ /* Sort data partitions by start */ -+ for (i = 4; i < cxt->label->nparts_max - 1; i++) { -+ struct pte *cur = &ptes[i], -+ *nxt = &ptes[i + 1]; -+ -+ if (get_abs_partition_start(cur) > -+ get_abs_partition_start(nxt)) { -+ -+ struct partition tmp = *cur->part_table; -+ sector_t cur_start = get_abs_partition_start(cur), -+ nxt_start = get_abs_partition_start(nxt); -+ -+ /* swap data partitions */ -+ *cur->part_table = *nxt->part_table; -+ *nxt->part_table = tmp; -+ -+ /* Recount starts according to EBR offsets, the absolute -+ * address still has to be the same! */ -+ set_start_sect(cur->part_table, nxt_start - cur->offset); -+ set_start_sect(nxt->part_table, cur_start - nxt->offset); -+ -+ cur->changed = 1; -+ nxt->changed = 1; -+ goto again; - } - } - -- /* Stage 2: sort starting sectors */ -- stage2: -- for (j = 4; j < cxt->label->nparts_max - 1; j++) { -- pj = ptes[j].part_table; -- pjj = ptes[j+1].part_table; -- sj = get_start_sect(pj); -- sjj = get_start_sect(pjj); -- oj = ptes[j].offset; -- ojj = ptes[j+1].offset; -- if (oj+sj > ojj+sjj) { -- tmp = *pj; -- *pj = *pjj; -- *pjj = tmp; -- set_start_sect(pj, ojj+sjj-oj); -- set_start_sect(pjj, oj+sj-ojj); -- goto stage2; -- } -+ /* Update EBR links */ -+ for (i = 4; i < cxt->label->nparts_max - 1; i++) { -+ struct pte *cur = &ptes[i], -+ *nxt = &ptes[i + 1]; -+ -+ sector_t noff = nxt->offset - extended_offset, -+ ooff = get_start_sect(cur->ext_pointer); -+ -+ if (noff == ooff) -+ continue; -+ -+ DBG(CONTEXT, dbgprint("DOS: fix EBR [%10ju] link %ju -> %ju", -+ (uintmax_t) cur->offset, -+ (uintmax_t) ooff, (uintmax_t) noff)); -+ -+ set_partition(cxt, i, 1, nxt->offset, -+ get_abs_partition_end(nxt), -+ EXTENDED); -+ } -+ -+ /* always terminate the chain ! */ -+ last = &ptes[cxt->label->nparts_max - 1]; -+ if (last) { -+ clear_partition(last->ext_pointer); -+ last->changed = 1; - } - -- /* Probably something was changed */ -- for (j = 4; j < cxt->label->nparts_max; j++) -- ptes[j].changed = 1; -+ DBG(CONTEXT, print_chain_of_logicals(cxt)); - } - - void dos_fix_partition_table_order(struct fdisk_context *cxt) -diff --git a/include/c.h b/include/c.h -index a50e8a5..ef2ea69 100644 ---- a/include/c.h -+++ b/include/c.h -@@ -110,6 +110,14 @@ - _max1 > _max2 ? _max1 : _max2; }) - #endif - -+#ifndef cmp_numbers -+# define cmp_numbers(x, y) __extension__ ({ \ -+ __typeof__(x) _a = (x); \ -+ __typeof__(y) _b = (y); \ -+ (void) (&_a == &_b); \ -+ _a == _b ? 0 : _a > _b ? 1 : -1; }) -+#endif -+ - #ifndef offsetof - #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - #endif --- -2.7.4 - diff --git a/SOURCES/0061-libmount-be-more-restrictive-about-valid-tag-names.patch b/SOURCES/0061-libmount-be-more-restrictive-about-valid-tag-names.patch new file mode 100644 index 0000000..7e5d394 --- /dev/null +++ b/SOURCES/0061-libmount-be-more-restrictive-about-valid-tag-names.patch @@ -0,0 +1,183 @@ +From f5ef29a5b5c51fe2039352dabcc4946fa2f55861 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 2 Jul 2013 10:46:10 +0200 +Subject: [PATCH 61/84] libmount: be more restrictive about valid tag names + + # mount DUMMY=filename.img /mnt + +The 'DUMMY=filename.img' is a filename and should not be +interpreted as tag name. The valid tag names are LABEL, UUID, +PARTLABEL and PARTUUID only. + +Upstream: http://github.com/karelzak/util-linux/commit/2c6b25f01802808b142d450af3352605720899da +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1248003 +Signed-off-by: Karel Zak +--- + libmount/src/cache.c | 29 ++++++++++++----------------- + libmount/src/fs.c | 9 ++++++--- + libmount/src/mountP.h | 2 ++ + libmount/src/tab.c | 20 ++++++++------------ + libmount/src/utils.c | 12 ++++++++++++ + 5 files changed, 40 insertions(+), 32 deletions(-) + +diff --git a/libmount/src/cache.c b/libmount/src/cache.c +index 7b65122..43a4daf 100644 +--- a/libmount/src/cache.c ++++ b/libmount/src/cache.c +@@ -583,22 +583,18 @@ error: + char *mnt_resolve_spec(const char *spec, struct libmnt_cache *cache) + { + char *cn = NULL; ++ char *t = NULL, *v = NULL; + + if (!spec) + return NULL; + +- if (strchr(spec, '=')) { +- char *tag, *val; +- +- if (!blkid_parse_tag_string(spec, &tag, &val)) { +- cn = mnt_resolve_tag(tag, val, cache); +- +- free(tag); +- free(val); +- } +- } else ++ if (blkid_parse_tag_string(spec, &t, &v) == 0 && mnt_valid_tagname(t)) ++ cn = mnt_resolve_tag(t, v, cache); ++ else + cn = mnt_resolve_path(spec, cache); + ++ free(t); ++ free(v); + return cn; + } + +@@ -663,6 +659,7 @@ int test_read_tags(struct libmnt_test *ts, int argc, char *argv[]) + + while(fgets(line, sizeof(line), stdin)) { + size_t sz = strlen(line); ++ char *t = NULL, *v = NULL; + + if (sz > 0 && line[sz - 1] == '\n') + line[sz - 1] = '\0'; +@@ -674,16 +671,14 @@ int test_read_tags(struct libmnt_test *ts, int argc, char *argv[]) + if (mnt_cache_read_tags(cache, line) < 0) + fprintf(stderr, "%s: read tags failed\n", line); + +- } else if (strchr(line, '=')) { +- char *tag, *val; ++ } else if (blkid_parse_tag_string(line, &t, &v) == 0) { + const char *cn = NULL; + +- if (!blkid_parse_tag_string(line, &tag, &val)) { +- cn = cache_find_tag(cache, tag, val); ++ if (mnt_valid_tagname(t)) ++ cn = cache_find_tag(cache, t, v); ++ free(t); ++ free(v); + +- free(tag); +- free(val); +- } + if (cn) + printf("%s: %s\n", line, cn); + else +diff --git a/libmount/src/fs.c b/libmount/src/fs.c +index c95cdc7..75e3bbb 100644 +--- a/libmount/src/fs.c ++++ b/libmount/src/fs.c +@@ -318,9 +318,12 @@ int __mnt_fs_set_source_ptr(struct libmnt_fs *fs, char *source) + + assert(fs); + +- if (source && *source != '/' && strchr(source, '=')) { +- if (blkid_parse_tag_string(source, &t, &v) != 0) +- return -1; ++ if (source && blkid_parse_tag_string(source, &t, &v) == 0 && ++ !mnt_valid_tagname(t)) { ++ /* parsable but unknown tag -- ignore */ ++ free(t); ++ free(v); ++ t = v = NULL; + } + + if (fs->source != source) +diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h +index e064a68..7b0848f 100644 +--- a/libmount/src/mountP.h ++++ b/libmount/src/mountP.h +@@ -136,6 +136,8 @@ extern int startswith(const char *s, const char *sx) + + extern char *stripoff_last_component(char *path); + ++extern int mnt_valid_tagname(const char *tagname); ++ + extern int is_file_empty(const char *name); + + extern int mkdir_p(const char *path, mode_t mode); +diff --git a/libmount/src/tab.c b/libmount/src/tab.c +index e3524a8..1ba1eec 100644 +--- a/libmount/src/tab.c ++++ b/libmount/src/tab.c +@@ -801,7 +801,8 @@ struct libmnt_fs *mnt_table_find_tag(struct libmnt_table *tb, const char *tag, + struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb, + const char *source, int direction) + { +- struct libmnt_fs *fs = NULL; ++ struct libmnt_fs *fs; ++ char *t = NULL, *v = NULL; + + assert(tb); + +@@ -812,18 +813,13 @@ struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb, + + DBG(TAB, mnt_debug_h(tb, "lookup SOURCE: '%s'", source)); + +- if (source && *source && strchr(source, '=')) { +- char *tag, *val; +- +- if (blkid_parse_tag_string(source, &tag, &val) == 0) { +- +- fs = mnt_table_find_tag(tb, tag, val, direction); +- +- free(tag); +- free(val); +- } +- } else ++ if (blkid_parse_tag_string(source, &t, &v) || !mnt_valid_tagname(t)) + fs = mnt_table_find_srcpath(tb, source, direction); ++ else ++ fs = mnt_table_find_tag(tb, t, v, direction); ++ ++ free(t); ++ free(v); + + return fs; + } +diff --git a/libmount/src/utils.c b/libmount/src/utils.c +index 6a444ad..9305bb8 100644 +--- a/libmount/src/utils.c ++++ b/libmount/src/utils.c +@@ -65,6 +65,18 @@ int is_file_empty(const char *name) + return (stat(name, &st) != 0 || st.st_size == 0); + } + ++int mnt_valid_tagname(const char *tagname) ++{ ++ if (tagname && *tagname && ( ++ strcmp("UUID", tagname) == 0 || ++ strcmp("LABEL", tagname) == 0 || ++ strcmp("PARTUUID", tagname) == 0 || ++ strcmp("PARTLABEL", tagname) == 0)) ++ return 1; ++ ++ return 0; ++} ++ + int mnt_parse_offset(const char *str, size_t len, uintmax_t *res) + { + char *p; +-- +2.7.4 + diff --git a/SOURCES/0062-mount-umount-swapon-fsck-lsblk-findmnt-ignore-malfor.patch b/SOURCES/0062-mount-umount-swapon-fsck-lsblk-findmnt-ignore-malfor.patch new file mode 100644 index 0000000..5bfb445 --- /dev/null +++ b/SOURCES/0062-mount-umount-swapon-fsck-lsblk-findmnt-ignore-malfor.patch @@ -0,0 +1,172 @@ +From 28663e752e125da99f8636ea0227d168f1e0e6aa Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 15 Oct 2015 11:53:44 +0200 +Subject: [PATCH 62/84] mount, umount, swapon, fsck, lsblk, findmnt: ignore + malformed lines + +The libmount provides way how to deal with parsing errors in fstab -- +on error callback function is executed and according to the return +libmount manipulate with the malformed line, possible are three +states: + + 1/ fatal error; all file ignored (callback rc < 0) + 2/ recoverable error; malformed line ignored (callback rc > 0) + 3/ ignore the error (callback rc == 0) + +The 2/ is the default if no callback specified. + +Unfortunately our utils uses 3/. The correct way is to use 2/. + +Upstream: http://github.com/karelzak/util-linux/commit/1cd9d0d7463850ef6b16a78b8a55e56dbf9a8db1 +Upstream: http://github.com/karelzak/util-linux/commit/1bb02a2da9f1bf7d80b352d540b29371099ab570 +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1271850 +Signed-off-by: Karel Zak +--- + disk-utils/fsck.c | 2 +- + libmount/src/tab_parse.c | 2 +- + misc-utils/findmnt.c | 2 +- + misc-utils/lsblk.c | 11 +++++++++++ + sys-utils/mount.c | 2 +- + sys-utils/swapon-common.c | 11 +++++++++++ + sys-utils/umount.c | 2 +- + 7 files changed, 27 insertions(+), 5 deletions(-) + +diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c +index 6e3a2c0..3ef8e5b 100644 +--- a/disk-utils/fsck.c ++++ b/disk-utils/fsck.c +@@ -421,7 +421,7 @@ static int parser_errcb(struct libmnt_table *tb __attribute__ ((__unused__)), + const char *filename, int line) + { + warnx(_("%s: parse error at line %d -- ignore"), filename, line); +- return 0; ++ return 1; + } + + /* +diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c +index e930fd8..987e671 100644 +--- a/libmount/src/tab_parse.c ++++ b/libmount/src/tab_parse.c +@@ -540,7 +540,7 @@ int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filenam + } + if (rc) { + mnt_free_fs(fs); +- if (rc == 1) ++ if (rc > 0) + continue; /* recoverable error */ + if (feof(f)) + break; +diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c +index 615ba08..f16da91 100644 +--- a/misc-utils/findmnt.c ++++ b/misc-utils/findmnt.c +@@ -752,7 +752,7 @@ static int parser_errcb(struct libmnt_table *tb __attribute__ ((__unused__)), + const char *filename, int line) + { + warnx(_("%s: parse error at line %d"), filename, line); +- return 0; ++ return 1; + } + + static char **append_tabfile(char **files, int *nfiles, char *filename) +diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c +index 9e12a90..cd28c1d 100644 +--- a/misc-utils/lsblk.c ++++ b/misc-utils/lsblk.c +@@ -337,6 +337,15 @@ static char *get_device_path(struct blkdev_cxt *cxt) + return xstrdup(path); + } + ++static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)), ++ const char *filename, int line) ++{ ++ if (filename) ++ warnx(_("%s: parse error: ignore entry at line %d."), ++ filename, line); ++ return 1; ++} ++ + static int is_active_swap(const char *filename) + { + if (!swaps) { +@@ -346,6 +355,7 @@ static int is_active_swap(const char *filename) + if (!mntcache) + mntcache = mnt_new_cache(); + ++ mnt_table_set_parser_errcb(swaps, table_parser_errcb); + mnt_table_set_cache(swaps, mntcache); + mnt_table_parse_swaps(swaps, NULL); + } +@@ -368,6 +378,7 @@ static char *get_device_mountpoint(struct blkdev_cxt *cxt) + if (!mntcache) + mntcache = mnt_new_cache(); + ++ mnt_table_set_parser_errcb(mtab, table_parser_errcb); + mnt_table_set_cache(mtab, mntcache); + mnt_table_parse_mtab(mtab, NULL); + } +diff --git a/sys-utils/mount.c b/sys-utils/mount.c +index 0998b01..f332070 100644 +--- a/sys-utils/mount.c ++++ b/sys-utils/mount.c +@@ -101,7 +101,7 @@ static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__) + if (filename) + warnx(_("%s: parse error: ignore entry at line %d."), + filename, line); +- return 0; ++ return 1; + } + + /* +diff --git a/sys-utils/swapon-common.c b/sys-utils/swapon-common.c +index 5c95ef3..5f14ddb 100644 +--- a/sys-utils/swapon-common.c ++++ b/sys-utils/swapon-common.c +@@ -11,12 +11,22 @@ static struct libmnt_table *swaps, *fstab; + + struct libmnt_cache *mntcache; + ++static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)), ++ const char *filename, int line) ++{ ++ if (filename) ++ warnx(_("%s: parse error: ignore entry at line %d."), ++ filename, line); ++ return 1; ++} ++ + struct libmnt_table *get_fstab(void) + { + if (!fstab) { + fstab = mnt_new_table(); + if (!fstab) + return NULL; ++ mnt_table_set_parser_errcb(fstab, table_parser_errcb); + mnt_table_set_cache(fstab, mntcache); + if (mnt_table_parse_fstab(fstab, NULL) != 0) + return NULL; +@@ -32,6 +42,7 @@ struct libmnt_table *get_swaps(void) + if (!swaps) + return NULL; + mnt_table_set_cache(swaps, mntcache); ++ mnt_table_set_parser_errcb(swaps, table_parser_errcb); + if (mnt_table_parse_swaps(swaps, NULL) != 0) + return NULL; + } +diff --git a/sys-utils/umount.c b/sys-utils/umount.c +index 1bd275f..9c47744 100644 +--- a/sys-utils/umount.c ++++ b/sys-utils/umount.c +@@ -45,7 +45,7 @@ static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__) + if (filename) + warnx(_("%s: parse error: ignore entry at line %d."), + filename, line); +- return 0; ++ return 1; + } + + +-- +2.7.4 + diff --git a/SOURCES/0063-login-mount-fix-__SC_GETPW_R_SIZE_MAX-usage.patch b/SOURCES/0063-login-mount-fix-__SC_GETPW_R_SIZE_MAX-usage.patch new file mode 100644 index 0000000..73f80e0 --- /dev/null +++ b/SOURCES/0063-login-mount-fix-__SC_GETPW_R_SIZE_MAX-usage.patch @@ -0,0 +1,146 @@ +From 3d1333293ef48117060cd4e285e9c49a6d061e83 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 15 Dec 2015 12:25:56 +0100 +Subject: [PATCH 63/84] login, mount: fix __SC_GETPW_R_SIZE_MAX usage + +sysconf(_SC_GETPW_R_SIZE_MAX) returns initial suggested size for pwd +buffer (see getpwnam_r man page or POSIX). This is not large enough in +some cases. + +Yes, this sysconf option is misnamed (should be _SC_GETPW_R_SIZE_MIN). + +Upstream: http://github.com/karelzak/util-linux/commit/f7ac9e71b18fa7314151f2ab65ee0bdd2ea89c07 +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1290689 +Signed-off-by: Karel Zak +--- + include/c.h | 7 +++++++ + libmount/src/utils.c | 25 ++++++------------------- + login-utils/login.c | 12 ++---------- + 3 files changed, 15 insertions(+), 29 deletions(-) + +diff --git a/include/c.h b/include/c.h +index a50e8a5..7b59ce8 100644 +--- a/include/c.h ++++ b/include/c.h +@@ -300,4 +300,11 @@ static inline int usleep(useconds_t usec) + # define SEEK_HOLE 4 + #endif + ++/* ++ * Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for ++ * pwd buffer and in some cases it is not large enough. See POSIX and ++ * getpwnam_r man page for more details. ++ */ ++#define UL_GETPW_BUFSIZ (16 * 1024) ++ + #endif /* UTIL_LINUX_C_H */ +diff --git a/libmount/src/utils.c b/libmount/src/utils.c +index 9305bb8..7c6f5b1 100644 +--- a/libmount/src/utils.c ++++ b/libmount/src/utils.c +@@ -538,16 +538,6 @@ int mnt_get_filesystems(char ***filesystems, const char *pattern) + return rc; + } + +-static size_t get_pw_record_size(void) +-{ +-#ifdef _SC_GETPW_R_SIZE_MAX +- long sz = sysconf(_SC_GETPW_R_SIZE_MAX); +- if (sz > 0) +- return sz; +-#endif +- return 16384; +-} +- + /* + * Returns allocated string with username or NULL. + */ +@@ -555,14 +545,13 @@ char *mnt_get_username(const uid_t uid) + { + struct passwd pwd; + struct passwd *res; +- size_t sz = get_pw_record_size(); + char *buf, *username = NULL; + +- buf = malloc(sz); ++ buf = malloc(UL_GETPW_BUFSIZ); + if (!buf) + return NULL; + +- if (!getpwuid_r(uid, &pwd, buf, sz, &res) && res) ++ if (!getpwuid_r(uid, &pwd, buf, UL_GETPW_BUFSIZ, &res) && res) + username = strdup(pwd.pw_name); + + free(buf); +@@ -574,17 +563,16 @@ int mnt_get_uid(const char *username, uid_t *uid) + int rc = -1; + struct passwd pwd; + struct passwd *pw; +- size_t sz = get_pw_record_size(); + char *buf; + + if (!username || !uid) + return -EINVAL; + +- buf = malloc(sz); ++ buf = malloc(UL_GETPW_BUFSIZ); + if (!buf) + return -ENOMEM; + +- if (!getpwnam_r(username, &pwd, buf, sz, &pw) && pw) { ++ if (!getpwnam_r(username, &pwd, buf, UL_GETPW_BUFSIZ, &pw) && pw) { + *uid= pw->pw_uid; + rc = 0; + } else { +@@ -602,17 +590,16 @@ int mnt_get_gid(const char *groupname, gid_t *gid) + int rc = -1; + struct group grp; + struct group *gr; +- size_t sz = get_pw_record_size(); + char *buf; + + if (!groupname || !gid) + return -EINVAL; + +- buf = malloc(sz); ++ buf = malloc(UL_GETPW_BUFSIZ); + if (!buf) + return -ENOMEM; + +- if (!getgrnam_r(groupname, &grp, buf, sz, &gr) && gr) { ++ if (!getgrnam_r(groupname, &grp, buf, UL_GETPW_BUFSIZ, &gr) && gr) { + *gid= gr->gr_gid; + rc = 0; + } else { +diff --git a/login-utils/login.c b/login-utils/login.c +index a59dd3a..e0e960f 100644 +--- a/login-utils/login.c ++++ b/login-utils/login.c +@@ -671,22 +671,14 @@ static struct passwd *get_passwd_entry(const char *username, + struct passwd *pwd) + { + struct passwd *res = NULL; +- size_t sz = 16384; + int x; + + if (!pwdbuf || !username) + return NULL; + +-#ifdef _SC_GETPW_R_SIZE_MAX +- { +- long xsz = sysconf(_SC_GETPW_R_SIZE_MAX); +- if (xsz > 0) +- sz = (size_t) xsz; +- } +-#endif +- *pwdbuf = xrealloc(*pwdbuf, sz); ++ *pwdbuf = xrealloc(*pwdbuf, UL_GETPW_BUFSIZ); + +- x = getpwnam_r(username, pwd, *pwdbuf, sz, &res); ++ x = getpwnam_r(username, pwd, *pwdbuf, UL_GETPW_BUFSIZ, &res); + if (!res) { + errno = x; + return NULL; +-- +2.7.4 + diff --git a/SOURCES/0064-bash-completion-use-n-as-IFS-when-ask-for-filenames.patch b/SOURCES/0064-bash-completion-use-n-as-IFS-when-ask-for-filenames.patch new file mode 100644 index 0000000..6e63208 --- /dev/null +++ b/SOURCES/0064-bash-completion-use-n-as-IFS-when-ask-for-filenames.patch @@ -0,0 +1,623 @@ +From 28907c1a50132c9a308b8d2c22bf4905041c446f Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 30 Sep 2013 15:49:00 +0200 +Subject: [PATCH 64/84] bash-completion: use '\n' as IFS when ask for filenames +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The bash completion for more(1) treats the space-separated pieces of +filenames as different files. + + $ touch foo\ bar + $ more foo + bar foo + +Upstream: http://github.com/karelzak/util-linux/commit/ce3e6b15e2c4478b2df9a7016c168b16325abfb0 +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1296366 +Reported-by: Ángel González +Signed-off-by: Karel Zak +--- + bash-completion/blkid | 1 + + bash-completion/colcrt | 1 + + bash-completion/column | 1 + + bash-completion/cytune | 1 + + bash-completion/dmesg | 1 + + bash-completion/fallocate | 1 + + bash-completion/findmnt | 1 + + bash-completion/flock | 1 + + bash-completion/fsck.cramfs | 1 + + bash-completion/hexdump | 1 + + bash-completion/hwclock | 1 + + bash-completion/ionice | 1 + + bash-completion/last | 1 + + bash-completion/ldattach | 1 + + bash-completion/logger | 1 + + bash-completion/look | 1 + + bash-completion/losetup | 1 + + bash-completion/lscpu | 1 + + bash-completion/lslocks | 1 + + bash-completion/mcookie | 1 + + bash-completion/mkfs.cramfs | 1 + + bash-completion/mkswap | 1 + + bash-completion/more | 2 ++ + bash-completion/mountpoint | 1 + + bash-completion/namei | 1 + + bash-completion/nsenter | 1 + + bash-completion/pg | 1 + + bash-completion/pivot_root | 1 + + bash-completion/readprofile | 1 + + bash-completion/rename | 1 + + bash-completion/rev | 1 + + bash-completion/script | 1 + + bash-completion/scriptreplay | 1 + + bash-completion/setterm | 1 + + bash-completion/sfdisk | 1 + + bash-completion/su | 1 + + bash-completion/swaplabel | 1 + + bash-completion/tailf | 1 + + bash-completion/tunelp | 1 + + bash-completion/ul | 1 + + bash-completion/utmpdump | 1 + + bash-completion/uuidd | 3 +++ + bash-completion/wall | 1 + + bash-completion/wdctl | 1 + + bash-completion/whereis | 1 + + 45 files changed, 48 insertions(+) + +diff --git a/bash-completion/blkid b/bash-completion/blkid +index b439328..9f97dd9 100644 +--- a/bash-completion/blkid ++++ b/bash-completion/blkid +@@ -6,6 +6,7 @@ _blkid_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-c') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/colcrt b/bash-completion/colcrt +index f9e4c33..c66d7e6 100644 +--- a/bash-completion/colcrt ++++ b/bash-completion/colcrt +@@ -19,6 +19,7 @@ _colcrt_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/column b/bash-completion/column +index f5cb86b..3af8e73 100644 +--- a/bash-completion/column ++++ b/bash-completion/column +@@ -30,6 +30,7 @@ _column_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/cytune b/bash-completion/cytune +index 4f42838..f685c88 100644 +--- a/bash-completion/cytune ++++ b/bash-completion/cytune +@@ -33,6 +33,7 @@ _cytune_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/dev/tty"}) ) + return 0 +diff --git a/bash-completion/dmesg b/bash-completion/dmesg +index 60ecc1a..eab41ba 100644 +--- a/bash-completion/dmesg ++++ b/bash-completion/dmesg +@@ -6,6 +6,7 @@ _dmesg_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-F'|'--file') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/fallocate b/bash-completion/fallocate +index 5007b60..2c6e4cb 100644 +--- a/bash-completion/fallocate ++++ b/bash-completion/fallocate +@@ -20,6 +20,7 @@ _fallocate_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/findmnt b/bash-completion/findmnt +index 9386d8f..3ed331a 100644 +--- a/bash-completion/findmnt ++++ b/bash-completion/findmnt +@@ -18,6 +18,7 @@ _findmnt_module() + return 0 + ;; + '-F'|'--tab-file') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/flock b/bash-completion/flock +index 8cd60d3..8e7f8b8 100644 +--- a/bash-completion/flock ++++ b/bash-completion/flock +@@ -38,6 +38,7 @@ _flock_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) + return 0 +diff --git a/bash-completion/fsck.cramfs b/bash-completion/fsck.cramfs +index 84f6f31..acf6564 100644 +--- a/bash-completion/fsck.cramfs ++++ b/bash-completion/fsck.cramfs +@@ -6,6 +6,7 @@ _fsck.cramfs_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-x'|'--destination') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + return 0 +diff --git a/bash-completion/hexdump b/bash-completion/hexdump +index 0c91187..c17bcae 100644 +--- a/bash-completion/hexdump ++++ b/bash-completion/hexdump +@@ -28,6 +28,7 @@ _hexdump_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/hwclock b/bash-completion/hwclock +index 0c4ebaf..de1ac20 100644 +--- a/bash-completion/hwclock ++++ b/bash-completion/hwclock +@@ -6,6 +6,7 @@ _hwclock_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--rtc'|'--adjfile') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/ionice b/bash-completion/ionice +index 3a01c51..1b1c5fe 100644 +--- a/bash-completion/ionice ++++ b/bash-completion/ionice +@@ -30,6 +30,7 @@ _ionice_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/last b/bash-completion/last +index 493051e..c93be3d 100644 +--- a/bash-completion/last ++++ b/bash-completion/last +@@ -6,6 +6,7 @@ _last_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/ldattach b/bash-completion/ldattach +index 830142d..0b9d260 100644 +--- a/bash-completion/ldattach ++++ b/bash-completion/ldattach +@@ -42,6 +42,7 @@ _ldattach_module() + return 0 + ;; + /*) ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/logger b/bash-completion/logger +index f46be8a..963abc7 100644 +--- a/bash-completion/logger ++++ b/bash-completion/logger +@@ -6,6 +6,7 @@ _logger_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--file') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/look b/bash-completion/look +index e8676ba..303a756 100644 +--- a/bash-completion/look ++++ b/bash-completion/look +@@ -20,6 +20,7 @@ _look_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/losetup b/bash-completion/losetup +index 75240b8..874c549 100644 +--- a/bash-completion/losetup ++++ b/bash-completion/losetup +@@ -60,6 +60,7 @@ _losetup_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/lscpu b/bash-completion/lscpu +index bce07c4..244b418 100644 +--- a/bash-completion/lscpu ++++ b/bash-completion/lscpu +@@ -41,6 +41,7 @@ _lscpu_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/lslocks b/bash-completion/lslocks +index 337d07e..c9cff2c 100644 +--- a/bash-completion/lslocks ++++ b/bash-completion/lslocks +@@ -38,6 +38,7 @@ _lslocks_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/mcookie b/bash-completion/mcookie +index eb3f54b..4345b6e 100644 +--- a/bash-completion/mcookie ++++ b/bash-completion/mcookie +@@ -6,6 +6,7 @@ _mcookie_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-f'|'--file') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/mkfs.cramfs b/bash-completion/mkfs.cramfs +index 38ab3b6..af74e12 100644 +--- a/bash-completion/mkfs.cramfs ++++ b/bash-completion/mkfs.cramfs +@@ -36,6 +36,7 @@ _mkfs.cramfs_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/mkswap b/bash-completion/mkswap +index c411b30..b72efaf 100644 +--- a/bash-completion/mkswap ++++ b/bash-completion/mkswap +@@ -28,6 +28,7 @@ _mkswap_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/more b/bash-completion/more +index 945c7b3..809cea2 100644 +--- a/bash-completion/more ++++ b/bash-completion/more +@@ -21,6 +21,8 @@ _more_module() + return 0 + ;; + esac ++ ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/mountpoint b/bash-completion/mountpoint +index 8fe27b8..f74efc9 100644 +--- a/bash-completion/mountpoint ++++ b/bash-completion/mountpoint +@@ -20,6 +20,7 @@ _mountpoint_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) + return 0 +diff --git a/bash-completion/namei b/bash-completion/namei +index 63fb37a..6402735 100644 +--- a/bash-completion/namei ++++ b/bash-completion/namei +@@ -16,6 +16,7 @@ _namei_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/nsenter b/bash-completion/nsenter +index 2970b8d..268f378 100644 +--- a/bash-completion/nsenter ++++ b/bash-completion/nsenter +@@ -40,6 +40,7 @@ _nsenter_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/pg b/bash-completion/pg +index 9b1bad9..8fce130 100644 +--- a/bash-completion/pg ++++ b/bash-completion/pg +@@ -25,6 +25,7 @@ _pg_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/pivot_root b/bash-completion/pivot_root +index 961c883..95df4b4 100644 +--- a/bash-completion/pivot_root ++++ b/bash-completion/pivot_root +@@ -11,6 +11,7 @@ _pivot_root_module() + esac + case $COMP_CWORD in + 1|2) ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + ;; +diff --git a/bash-completion/readprofile b/bash-completion/readprofile +index a5f45f5..bd265a6 100644 +--- a/bash-completion/readprofile ++++ b/bash-completion/readprofile +@@ -6,6 +6,7 @@ _readprofile_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-m'|'--mapfile'|'-p'|'--profile') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/rename b/bash-completion/rename +index 3842c4d..81365a5 100644 +--- a/bash-completion/rename ++++ b/bash-completion/rename +@@ -24,6 +24,7 @@ _rename_module() + COMPREPLY=( $(compgen -W "replacement" -- $cur) ) + ;; + *) ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + ;; +diff --git a/bash-completion/rev b/bash-completion/rev +index 619c5c4..e5397d5 100644 +--- a/bash-completion/rev ++++ b/bash-completion/rev +@@ -16,6 +16,7 @@ _rev_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/script b/bash-completion/script +index 329fc48..d7efd7e 100644 +--- a/bash-completion/script ++++ b/bash-completion/script +@@ -32,6 +32,7 @@ _script_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/scriptreplay b/bash-completion/scriptreplay +index 2ad7b11..a4aa8a0 100644 +--- a/bash-completion/scriptreplay ++++ b/bash-completion/scriptreplay +@@ -24,6 +24,7 @@ _scriptreplay_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/setterm b/bash-completion/setterm +index 7fa0a4e..a7ef6eb 100644 +--- a/bash-completion/setterm ++++ b/bash-completion/setterm +@@ -45,6 +45,7 @@ _setterm_module() + return 0 + ;; + '-file') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/sfdisk b/bash-completion/sfdisk +index 0226b04..609104c 100644 +--- a/bash-completion/sfdisk ++++ b/bash-completion/sfdisk +@@ -14,6 +14,7 @@ _sfdisk_module() + return 0 + ;; + '-O'|'-I') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/su b/bash-completion/su +index e739b56..dad1b5f 100644 +--- a/bash-completion/su ++++ b/bash-completion/su +@@ -38,6 +38,7 @@ _su_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/swaplabel b/bash-completion/swaplabel +index 093169e..08aa9cd 100644 +--- a/bash-completion/swaplabel ++++ b/bash-completion/swaplabel +@@ -24,6 +24,7 @@ _swaplabel_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/tailf b/bash-completion/tailf +index e3dd295..0d4c869 100644 +--- a/bash-completion/tailf ++++ b/bash-completion/tailf +@@ -20,6 +20,7 @@ _tailf_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/tunelp b/bash-completion/tunelp +index 614b235..bd2cce2 100644 +--- a/bash-completion/tunelp ++++ b/bash-completion/tunelp +@@ -44,6 +44,7 @@ _tunelp_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/dev/lp"}) ) + return 0 +diff --git a/bash-completion/ul b/bash-completion/ul +index c00e510..449cbe0 100644 +--- a/bash-completion/ul ++++ b/bash-completion/ul +@@ -25,6 +25,7 @@ _ul_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/utmpdump b/bash-completion/utmpdump +index 3b868ce..7e4fd5a 100644 +--- a/bash-completion/utmpdump ++++ b/bash-completion/utmpdump +@@ -16,6 +16,7 @@ _utmpdump_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/uuidd b/bash-completion/uuidd +index c45b067..c8f6697 100644 +--- a/bash-completion/uuidd ++++ b/bash-completion/uuidd +@@ -6,16 +6,19 @@ _uuidd_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-p'|'--pid'|'-s'|'--socket') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 + ;; + '-T'|'--timeout') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -W "timeout" -- $cur) ) + return 0 + ;; + '-n'|'--uuids') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -W "number" -- $cur) ) + return 0 +diff --git a/bash-completion/wall b/bash-completion/wall +index 55d9658..e3145ff 100644 +--- a/bash-completion/wall ++++ b/bash-completion/wall +@@ -20,6 +20,7 @@ _wall_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- $cur) ) + return 0 +diff --git a/bash-completion/wdctl b/bash-completion/wdctl +index 33b4e1f..4f16e76 100644 +--- a/bash-completion/wdctl ++++ b/bash-completion/wdctl +@@ -56,6 +56,7 @@ _wdctl_module() + return 0 + ;; + esac ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) ) + return 0 +diff --git a/bash-completion/whereis b/bash-completion/whereis +index 2273a07..0dcbac3 100644 +--- a/bash-completion/whereis ++++ b/bash-completion/whereis +@@ -6,6 +6,7 @@ _whereis_module() + prev="${COMP_WORDS[COMP_CWORD-1]}" + case $prev in + '-B'|'-M'|'-S') ++ local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) + return 0 +-- +2.7.4 + diff --git a/SOURCES/0065-hwclock-change-audit-message.patch b/SOURCES/0065-hwclock-change-audit-message.patch new file mode 100644 index 0000000..a50d8e2 --- /dev/null +++ b/SOURCES/0065-hwclock-change-audit-message.patch @@ -0,0 +1,31 @@ +From 19b9d9197374c5811e32777ca70a32eef37a1fb0 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 7 Jan 2016 13:23:24 +0100 +Subject: [PATCH 65/84] hwclock: change audit message + +The preferred layout is name=value for audit messages. + +Upstream: http://github.com/karelzak/util-linux/commit/fbed7e09f826e7804e99522cc1dd3cf54c9cdb67 +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1296521 +References: https://bugzilla.redhat.com/show_bug.cgi?id=1296278 +Signed-off-by: Karel Zak +--- + sys-utils/hwclock.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c +index c7789c8..ac9294b 100644 +--- a/sys-utils/hwclock.c ++++ b/sys-utils/hwclock.c +@@ -1939,7 +1939,7 @@ void __attribute__((__noreturn__)) hwaudit_exit(int status) + { + if (hwaudit_on) { + audit_log_user_message(hwaudit_fd, AUDIT_USYS_CONFIG, +- "changing system time", NULL, NULL, NULL, ++ "op=change-system-time", NULL, NULL, NULL, + status ? 0 : 1); + close(hwaudit_fd); + } +-- +2.7.4 + diff --git a/SOURCES/0066-su-clean-up-groups-initialization.patch b/SOURCES/0066-su-clean-up-groups-initialization.patch new file mode 100644 index 0000000..ebd0225 --- /dev/null +++ b/SOURCES/0066-su-clean-up-groups-initialization.patch @@ -0,0 +1,186 @@ +From b2a41801904c4b281a717dde7f5e146cbd4500b3 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 15 Feb 2016 13:55:37 +0100 +Subject: [PATCH 66/84] su: clean up groups initialization + +This patch does not change any su/runuser behaviour, code changes: + +* don't use huge groups[NGROUPS_MAX]; the array has 256k, but we need + it only occasionally when -G/-g specified. + +* the current code uses groups[0] for -g and the rest for -G, this patch adds + 'gid' to remember -g argument to avoid memmove() + +* add function add_supp_group() to simplify su_main() + +* add note about -G and -g relation to the man pages (undocumented now) + +Upstream: http://github.com/karelzak/util-linux/commit/c619d3d167115990e9228b27851e0cc2faa8f936 +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1304426 +Signed-off-by: Karel Zak +--- + login-utils/runuser.1 | 5 ++-- + login-utils/su-common.c | 68 +++++++++++++++++++++++++++---------------------- + login-utils/su.1 | 5 ++-- + 3 files changed, 44 insertions(+), 34 deletions(-) + +diff --git a/login-utils/runuser.1 b/login-utils/runuser.1 +index 7201ff0..d82dbb0 100644 +--- a/login-utils/runuser.1 ++++ b/login-utils/runuser.1 +@@ -75,8 +75,9 @@ shell. + \fB\-g\fR, \fB\-\-group\fR=\fIgroup\fR\fR + specify the primary group, this option is allowed for root user only + .TP +-\fB\-G\fR, \fB\-\-supp-group\fR=\fIgroup\fR\fR +-specify a supplemental group, this option is allowed for root user only ++.BR \-G , " \-\-supp\-group" = \fIgroup ++Specify a supplemental group. This option is available to the root user only. The first specified ++supplementary group is also used as a primary group if the option \fB\-\-group\fR is unspecified. + .TP + \fB\-\fR, \fB\-l\fR, \fB\-\-login\fR + Starts the shell as login shell with an environment similar to a real +diff --git a/login-utils/su-common.c b/login-utils/su-common.c +index dd87804..d53d690 100644 +--- a/login-utils/su-common.c ++++ b/login-utils/su-common.c +@@ -535,7 +535,7 @@ modify_environment (const struct passwd *pw, const char *shell) + /* Become the user and group(s) specified by PW. */ + + static void +-init_groups (const struct passwd *pw, gid_t *groups, int num_groups) ++init_groups (const struct passwd *pw, gid_t *groups, size_t num_groups) + { + int retval; + +@@ -707,6 +707,28 @@ evaluate_uid(void) + return (uid_t) 0 == ruid && ruid == euid ? 0 : 1; + } + ++static gid_t ++add_supp_group(const char *name, gid_t **groups, size_t *ngroups) ++{ ++ struct group *gr; ++ ++ if (*ngroups >= NGROUPS_MAX) ++ errx(EXIT_FAILURE, ++ P_("specifying more than %d supplemental group is not possible", ++ "specifying more than %d supplemental groups is not possible", ++ NGROUPS_MAX - 1), NGROUPS_MAX - 1); ++ ++ gr = getgrnam(name); ++ if (!gr) ++ errx(EXIT_FAILURE, _("group %s does not exist"), name); ++ ++ *groups = xrealloc(*groups, sizeof(gid_t) * (*ngroups + 1)); ++ (*groups)[*ngroups] = gr->gr_gid; ++ (*ngroups)++; ++ ++ return gr->gr_gid; ++} ++ + int + su_main (int argc, char **argv, int mode) + { +@@ -717,10 +739,12 @@ su_main (int argc, char **argv, int mode) + char *shell = NULL; + struct passwd *pw; + struct passwd pw_copy; +- struct group *gr; +- gid_t groups[NGROUPS_MAX]; +- int num_supp_groups = 0; +- int use_gid = 0; ++ ++ gid_t *groups = NULL; ++ size_t ngroups = 0; ++ bool use_supp = false; ++ bool use_gid = false; ++ gid_t gid = 0; + + static const struct option longopts[] = { + {"command", required_argument, NULL, 'c'}, +@@ -765,23 +789,13 @@ su_main (int argc, char **argv, int mode) + break; + + case 'g': +- gr = getgrnam(optarg); +- if (!gr) +- errx(EXIT_FAILURE, _("group %s does not exist"), optarg); +- use_gid = 1; +- groups[0] = gr->gr_gid; ++ use_gid = true; ++ gid = add_supp_group(optarg, &groups, &ngroups); + break; + + case 'G': +- num_supp_groups++; +- if (num_supp_groups >= NGROUPS_MAX) +- errx(EXIT_FAILURE, +- _("can't specify more than %d supplemental groups"), +- NGROUPS_MAX - 1); +- gr = getgrnam(optarg); +- if (!gr) +- errx(EXIT_FAILURE, _("group %s does not exist"), optarg); +- groups[num_supp_groups] = gr->gr_gid; ++ use_supp = true; ++ add_supp_group(optarg, &groups, &ngroups); + break; + + case 'l': +@@ -852,7 +866,7 @@ su_main (int argc, char **argv, int mode) + break; + } + +- if ((num_supp_groups || use_gid) && restricted) ++ if ((use_supp || use_gid) && restricted) + errx(EXIT_FAILURE, _("only root can specify alternative groups")); + + logindefs_load_defaults = load_config; +@@ -878,16 +892,10 @@ su_main (int argc, char **argv, int mode) + : DEFAULT_SHELL); + endpwent (); + +- if (num_supp_groups && !use_gid) +- { +- pw->pw_gid = groups[1]; +- memmove (groups, groups + 1, sizeof(gid_t) * num_supp_groups); +- } +- else if (use_gid) +- { ++ if (use_supp && !use_gid) + pw->pw_gid = groups[0]; +- num_supp_groups++; +- } ++ else if (use_gid) ++ pw->pw_gid = gid; + + authenticate (pw); + +@@ -912,7 +920,7 @@ su_main (int argc, char **argv, int mode) + shell = xstrdup (shell ? shell : pw->pw_shell); + } + +- init_groups (pw, groups, num_supp_groups); ++ init_groups (pw, groups, ngroups); + + if (!simulate_login || command) + suppress_pam_info = 1; /* don't print PAM info messages */ +diff --git a/login-utils/su.1 b/login-utils/su.1 +index eab1a6f..1f69868 100644 +--- a/login-utils/su.1 ++++ b/login-utils/su.1 +@@ -62,8 +62,9 @@ shell. + \fB\-g\fR, \fB\-\-group\fR=\fIgroup\fR\fR + specify the primary group, this option is allowed for root user only + .TP +-\fB\-G\fR, \fB\-\-supp-group\fR=\fIgroup\fR\fR +-specify a supplemental group, this option is allowed for root user only ++.BR \-G , " \-\-supp\-group" = \fIgroup ++Specify a supplemental group. This option is available to the root user only. The first specified ++supplementary group is also used as a primary group if the option \fB\-\-group\fR is unspecified. + .TP + \fB\-\fR, \fB\-l\fR, \fB\-\-login\fR + Starts the shell as login shell with an environment similar to a real +-- +2.7.4 + diff --git a/SOURCES/0067-lscpu-Fix-model-and-model-name-on-Power-Systems.patch b/SOURCES/0067-lscpu-Fix-model-and-model-name-on-Power-Systems.patch new file mode 100644 index 0000000..9bf633c --- /dev/null +++ b/SOURCES/0067-lscpu-Fix-model-and-model-name-on-Power-Systems.patch @@ -0,0 +1,83 @@ +From 246ab88515fca389c02602521fc765d3e597fd7a Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Mon, 14 Mar 2016 20:18:07 +0530 +Subject: [PATCH 67/84] lscpu: Fix model and model name on Power Systems + +On Power System, lspcu presently displays system model number instead of +processor model name. 'model' tag in cpuinfo contains system model name, +not processor model. Instead it uses 'cpu' tag for processor model name. +Also it uses 'revision' tag for processor model. + +Fix lspcu so that it displays processor model number. Also display processor +model name. + +cpuinfo output on Power System: + ... + ... + + processor : 127 + cpu : POWER8E (raw), altivec supported + clock : 4322.000000MHz + revision : 2.1 (pvr 004b 0201) + + timebase : 512000000 + platform : PowerNV + model : 8286-42A + machine : PowerNV 8286-42A + firmware : OPAL + +Output without this patch: + Architecture: ppc64le + Byte Order: Little Endian + CPU(s): 128 + On-line CPU(s) list: 0-127 + Thread(s) per core: 8 + Core(s) per socket: 4 + Socket(s): 4 + NUMA node(s): 4 + Model: 8286-42A + ... + ... + +Output with this patch: + Architecture: ppc64le + Byte Order: Little Endian + CPU(s): 128 + On-line CPU(s) list: 0-127 + Thread(s) per core: 8 + Core(s) per socket: 4 + Socket(s): 4 + NUMA node(s): 4 + Model: 2.1 (pvr 004b 0201) + Model name: POWER8E (raw), altivec supported + ... + ... + +Upstream: http://github.com/karelzak/util-linux/commit/3ac03fe4d20558b55635a048d7f2fb0f5e85ee2a +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1326615 +Signed-off-by: Vasant Hegde +--- + sys-utils/lscpu.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 4af8176..68b15af 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -355,8 +355,13 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod) + else if (lookup(buf, "vendor_id", &desc->vendor)) ; + else if (lookup(buf, "family", &desc->family)) ; + else if (lookup(buf, "cpu family", &desc->family)) ; ++#if defined(__powerpc__) || defined(__powerpc64__) ++ else if (lookup(buf, "revision", &desc->model)) ; ++ else if (lookup(buf, "cpu", &desc->modelname)) ; ++#else + else if (lookup(buf, "model", &desc->model)) ; + else if (lookup(buf, "model name", &desc->modelname)) ; ++#endif + else if (lookup(buf, "stepping", &desc->stepping)) ; + else if (lookup(buf, "cpu MHz", &desc->mhz)) ; + else if (lookup(buf, "flags", &desc->flags)) ; /* x86 */ +-- +2.7.4 + diff --git a/SOURCES/0068-lscpu-use-cpu-and-revision-tag-if-available.patch b/SOURCES/0068-lscpu-use-cpu-and-revision-tag-if-available.patch new file mode 100644 index 0000000..c1962e2 --- /dev/null +++ b/SOURCES/0068-lscpu-use-cpu-and-revision-tag-if-available.patch @@ -0,0 +1,105 @@ +From cd0d8ef86151d72a246d565844d4c0470feb6b20 Mon Sep 17 00:00:00 2001 +From: Ruediger Meier +Date: Wed, 16 Mar 2016 13:18:18 +0100 +Subject: [PATCH 68/84] lscpu: use cpu and revision tag if available + +Avoid ifdef which does not work with --sysroot. Our existing test +dumps produce even better output now for ppc and sparc. + +The logic moved to the printing section. + +Upstream: http://github.com/karelzak/util-linux/commit/641350fe822e7f1ac10873dad9a364bdeaba8083 +Upstream: http://github.com/karelzak/util-linux/commit/86c4817e0ea02656ddb62fe27757a9fd4f13b2d3 +Upstream: http://github.com/karelzak/util-linux/commit/c95e3889725389e9d7e24d29c2a71b015959575f +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1326615 +CC: Vasant Hegde +Signed-off-by: Ruediger Meier +Signed-off-by: Karel Zak +--- + sys-utils/lscpu.c | 17 ++++++++--------- + tests/expected/lscpu/lscpu-ppc64-POWER7 | 3 ++- + tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu | 3 ++- + 3 files changed, 12 insertions(+), 11 deletions(-) + +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 68b15af..7a00636 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -141,6 +141,8 @@ struct lscpu_desc { + char *family; + char *model; + char *modelname; ++ char *revision; /* alternative for model (ppc) */ ++ char *cpu; /* alternative for modelname (ppc, sparc) */ + char *virtflag; /* virtualization flag (vmx, svm) */ + char *hypervisor; /* hypervisor software */ + int hyper; /* hypervisor vendor ID */ +@@ -355,13 +357,8 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod) + else if (lookup(buf, "vendor_id", &desc->vendor)) ; + else if (lookup(buf, "family", &desc->family)) ; + else if (lookup(buf, "cpu family", &desc->family)) ; +-#if defined(__powerpc__) || defined(__powerpc64__) +- else if (lookup(buf, "revision", &desc->model)) ; +- else if (lookup(buf, "cpu", &desc->modelname)) ; +-#else + else if (lookup(buf, "model", &desc->model)) ; + else if (lookup(buf, "model name", &desc->modelname)) ; +-#endif + else if (lookup(buf, "stepping", &desc->stepping)) ; + else if (lookup(buf, "cpu MHz", &desc->mhz)) ; + else if (lookup(buf, "flags", &desc->flags)) ; /* x86 */ +@@ -369,6 +366,8 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod) + else if (lookup(buf, "type", &desc->flags)) ; /* sparc64 */ + else if (lookup(buf, "bogomips", &desc->bogomips)) ; + else if (lookup(buf, "bogomips per cpu", &desc->bogomips)) ; /* s390 */ ++ else if (lookup(buf, "cpu", &desc->cpu)) ; ++ else if (lookup(buf, "revision", &desc->revision)) ; + else + continue; + } +@@ -1264,10 +1263,10 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) + print_s(_("Vendor ID:"), desc->vendor); + if (desc->family) + print_s(_("CPU family:"), desc->family); +- if (desc->model) +- print_s(_("Model:"), desc->model); +- if (desc->modelname) +- print_s(_("Model name:"), desc->modelname); ++ if (desc->model || desc->revision) ++ print_s(_("Model:"), desc->revision ? desc->revision : desc->model); ++ if (desc->modelname || desc->cpu) ++ print_s(_("Model name:"), desc->cpu ? desc->cpu : desc->modelname); + if (desc->stepping) + print_s(_("Stepping:"), desc->stepping); + if (desc->mhz) +diff --git a/tests/expected/lscpu/lscpu-ppc64-POWER7 b/tests/expected/lscpu/lscpu-ppc64-POWER7 +index 0d6c5ba..9a3c0c9 100644 +--- a/tests/expected/lscpu/lscpu-ppc64-POWER7 ++++ b/tests/expected/lscpu/lscpu-ppc64-POWER7 +@@ -4,7 +4,8 @@ Thread(s) per core: 4 + Core(s) per socket: 1 + Socket(s): 4 + NUMA node(s): 1 +-Model: IBM,8233-E8B ++Model: 2.1 (pvr 003f 0201) ++Model name: POWER7 (architected), altivec supported + L1d cache: 32K + L1i cache: 32K + NUMA node0 CPU(s): 0-15 +diff --git a/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu b/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu +index 40e2736..d4ae6c1 100644 +--- a/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu ++++ b/tests/expected/lscpu/lscpu-ppc64-POWER7-64cpu +@@ -4,7 +4,8 @@ Thread(s) per core: 4 + Core(s) per socket: 1 + Socket(s): 16 + NUMA node(s): 2 +-Model: IBM,8231-E2B ++Model: 2.1 (pvr 003f 0201) ++Model name: POWER7 (architected), altivec supported + L1d cache: 32K + L1i cache: 32K + NUMA node0 CPU(s): 0-63 +-- +2.7.4 + diff --git a/SOURCES/0069-findfs-add-ability-to-work-with-PART-UUID-LABEL-too.patch b/SOURCES/0069-findfs-add-ability-to-work-with-PART-UUID-LABEL-too.patch new file mode 100644 index 0000000..48c3db4 --- /dev/null +++ b/SOURCES/0069-findfs-add-ability-to-work-with-PART-UUID-LABEL-too.patch @@ -0,0 +1,137 @@ +From 2555bd3bad9ea8e7ae40a727f59bb546d2aa2717 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 28 Mar 2014 10:36:05 +0100 +Subject: [PATCH 69/84] findfs: add ability to work with PART{UUID,LABEL}= too + +Upstream: http://github.com/karelzak/util-linux/commit/c48508c2faa356c48c26d7d0070a6f20ae4ba9a0 +Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1335671 +Signed-off-by: Karel Zak +--- + misc-utils/findfs.8 | 51 +++++++++++++++++++++++++++++++++++++++------------ + misc-utils/findfs.c | 17 +++++------------ + 2 files changed, 44 insertions(+), 24 deletions(-) + +diff --git a/misc-utils/findfs.8 b/misc-utils/findfs.8 +index 8a6bca1..b92cd45 100644 +--- a/misc-utils/findfs.8 ++++ b/misc-utils/findfs.8 +@@ -7,19 +7,45 @@ + findfs \- find a filesystem by label or UUID + .SH SYNOPSIS + .B findfs +-.BI LABEL= label +-.sp +-.B findfs +-.BI UUID= uuid ++.BI NAME= value + .SH DESCRIPTION + .B findfs +-will search the disks in the system looking for a filesystem which has +-a label matching +-.I label +-or a UUID equal to +-.IR uuid . +-If the filesystem is found, the device name for the filesystem will +-be printed on stdout. ++will search the block devices in the system looking for a filesystem or ++partition with specified tag. The currently supported tags are: ++.TP ++.B LABEL=