Browse Source

util-linux updates

- new patches from upstream
- new url location for download

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 6 years ago
parent
commit
fc619ebed4
  1. 87
      SOURCES/0060-build-sys-add-CFLAGS-and-LDFLAGS-for-daemons-and-sha.patch
  2. 95
      SOURCES/0061-libmount-be-more-restrictive-about-valid-tag-names.patch
  3. 105
      SOURCES/0062-mount-umount-swapon-fsck-lsblk-findmnt-ignore-malfor.patch
  4. 101
      SOURCES/0063-login-mount-fix-__SC_GETPW_R_SIZE_MAX-usage.patch
  5. 563
      SOURCES/0064-bash-completion-use-n-as-IFS-when-ask-for-filenames.patch
  6. 13
      SOURCES/0065-hwclock-change-audit-message.patch
  7. 45
      SOURCES/0066-su-clean-up-groups-initialization.patch
  8. 19
      SOURCES/0067-lscpu-Fix-model-and-model-name-on-Power-Systems.patch
  9. 55
      SOURCES/0068-lscpu-use-cpu-and-revision-tag-if-available.patch
  10. 49
      SOURCES/0069-findfs-add-ability-to-work-with-PART-UUID-LABEL-too.patch
  11. 21
      SOURCES/0070-libblkid-fix-memory-leak-in-blkid_parse_tag_string.patch
  12. 39
      SOURCES/0071-findmnt-don-t-rely-on-st_dev-for-target.patch
  13. 73
      SOURCES/0072-libmount-cleanup-fs-root-detection-code.patch
  14. 15
      SOURCES/0073-libmount-mark-overlay-as-pseudo-FS.patch
  15. 15
      SOURCES/0074-logger-be-more-precise-about-port-description.patch
  16. 195
      SOURCES/0075-libfdisk-gpt-be-more-careful-with-64bit-constants.patch
  17. 55
      SOURCES/0076-lsns-backport-new-command.patch
  18. 33
      SOURCES/0077-lib-strutils-make-strmode-more-generic.patch
  19. 321
      SOURCES/0078-lsipc-backport-new-command.patch
  20. 155
      SOURCES/0079-blkdiscard-backport-zeroout-support.patch
  21. 77
      SOURCES/0080-sulogin-and-agetty-virtual-consoles-support-xvc-and-.patch
  22. 201
      SOURCES/0081-chrt-backport-DEADLINE-scheduler-support.patch
  23. 25
      SOURCES/0082-fdisk-backport-DOS-logical-partitions-chain-reorder.patch
  24. 93
      SOURCES/0083-tests-cleanup-tests.patch
  25. 35
      SOURCES/0084-libmount-add-support-for-bind-ro.patch
  26. 103
      SOURCES/0085-libblkid-store-only-canonical-devnames-to-the-cache.patch
  27. 51
      SOURCES/0086-libblkid-avoid-recursion-in-EBR.patch
  28. 61
      SOURCES/0087-findmnt-fix-target-behaviour.patch
  29. 15
      SOURCES/0088-su-properly-clear-child-PID.patch
  30. 15
      SOURCES/0089-fdisk-fix-Blocks-column-calculation.patch
  31. 25
      SOURCES/0090-fdisk-fix-menu-for-GPT.patch
  32. 143
      SOURCES/0091-logger-backport-size.patch
  33. 21
      SOURCES/0092-fdisk-print-header-UUID-for-GPT.patch
  34. 55
      SOURCES/0093-fdisk-improve-l-error-handling.patch
  35. 3
      SOURCES/0094-losetup-improve-man-page-SYNOPSIS.patch
  36. 55
      SOURCES/0095-libblkid-fix-potential-bufer-overflows.patch
  37. 3
      SOURCES/0096-umount-fix-obsolete-info-about-loop-in-umount.8.patch
  38. 21
      SOURCES/0097-mount-fix-all-and-nofail-return-code.patch
  39. 15
      SOURCES/0098-umount-exclude-selinuxfs-from-all.patch
  40. 29
      SOURCES/0099-sfdisk-remove-useless-CDROM-detection-for-s.patch
  41. 25
      SOURCES/0100-more-fix-repeat-search-crash.patch
  42. 9
      SOURCES/0101-more-avoid-double-free-on-exit.patch
  43. 39
      SOURCES/0102-ipcs-show-gid-instead-of-uid.patch
  44. 7
      SOURCES/0103-ipcs-fix-JP-status-message.patch
  45. 37
      SOURCES/0104-swapon-fix-discard-option-parsing.patch
  46. 89
      SOURCES/0105-fallocate-Added-posix_fallocate-support.patch
  47. 91
      SOURCES/0106-zramctl-backport-from-v2.29.patch
  48. 15
      SOURCES/0107-libblkid-zfs-let-s-keep-compiler-happy.patch
  49. 65
      SOURCES/0108-blkid-make-zfs-detection-more-robust.patch
  50. 53
      SOURCES/0109-zfs-make-less-syscalls.patch
  51. 31
      SOURCES/0110-libblkid-zfs-keep-bufferes-read-only.patch
  52. 11
      SOURCES/0111-libblkid-don-t-mark-zfs-as-RAID.patch
  53. 3
      SOURCES/0112-tests-update-ZFS-test.patch
  54. 11
      SOURCES/0113-libblkid-zfs-add-cast-to-fix-UB-cppcheck.patch
  55. 21
      SOURCES/0114-libblkid-Avoid-OOB-access-on-illegal-ZFS-superblocks.patch
  56. 999
      SOURCES/0115-lscpu-backport-from-v2.29.patch
  57. 13
      SOURCES/0116-fdisk-use-sysfs_devno_is_wholedisk.patch
  58. 11
      SOURCES/0117-zramctl-add-bash-completion.patch
  59. 15
      SOURCES/0118-zramctl-make-mm_stat-parser-more-robust.patch
  60. 63
      SOURCES/0119-fdisk-improve-menu-and-u-for-GPT.patch
  61. 49
      SOURCES/0120-tests-update-for-RHEL7.4-changes.patch
  62. 3
      SOURCES/0121-zramctl-be-more-specific-about-default-output.patch
  63. 23
      SOURCES/0122-libfdisk-gpt-fix-UUID-printing.patch
  64. 39
      SOURCES/0123-libblkid-Add-metadata-signature-check-for-IMSM-on-4K.patch
  65. 19
      SOURCES/0124-lscpu-use-sysfs-for-table-access-if-available.patch
  66. 35
      SOURCES/0125-lscpu-improve-for-offline-CPUs-on-AMD.patch
  67. 31
      SOURCES/0126-libmount-use-eacess-rather-than-open-to-check-mtab-u.patch
  68. 21
      SOURCES/0127-agetty-fix-etc-os-release-parsing.patch
  69. 5
      SOURCES/0128-fdisk-remove-obsolete-info-about-GPT-from-man-page.patch
  70. 55
      SOURCES/0129-libfdisk-gpt-sync-type-UUIDs-with-upstream.patch
  71. 61
      SOURCES/0130-lscpu-cleanup-DMI-detection-return-codes.patch
  72. 15
      SOURCES/0131-flock-zero-timeout-is-valid.patch
  73. 3
      SOURCES/0132-logger-add-man-page-note-about-the-default-tag.patch
  74. 45
      SOURCES/0133-script-use-all-io-to-write.patch
  75. 31
      SOURCES/0134-logger-do-not-rely-only-getlogin-3-telling-who-ran-t.patch
  76. 17
      SOURCES/0135-login-use-IPv4-on-IPv4-mapping-to-IPv6.patch
  77. 7
      SOURCES/0136-blkid-update-man-page-about-lsblk-and-ambivalent-pro.patch
  78. 59
      SOURCES/0137-wipefs-fix-t-filter.patch
  79. 19
      SOURCES/0138-tests-backport-new-ts_scsi_debug_init.patch
  80. 163
      SOURCES/0139-tests-ts_scsi_debug_init-must-not-run-in-a-subshell.patch
  81. 31
      SOURCES/0140-tests-cleanup-fdisk-outputs.patch
  82. 15
      SOURCES/0141-tests-check-for-mdadm.patch
  83. 75
      SOURCES/0142-lsmem-chmem-backport-new-commands.patch
  84. 39
      SOURCES/0143-lsmem-make-split-optional-follow-output-by-default.patch
  85. 173
      SOURCES/0144-libmount-fix-access-utab-write-test.patch
  86. 23
      SOURCES/0145-login-add-LOGIN_PLAIN_PROMPT-to-login.defs.patch
  87. 29
      SOURCES/0146-libblkid-Add-VDO-superblock-information-into-blkid.patch
  88. 255
      SOURCES/0147-include-debug-don-t-print-pointer-address-for-SUID-p.patch
  89. 15
      SOURCES/0148-mkswap-tolerate-ENOTSUP-when-failing-to-relabel.patch
  90. 13
      SOURCES/0149-libmount-fix-debug-message.patch
  91. 14
      SOURCES/2.17-kill-strtol.patch
  92. 11
      SOURCES/2.23-login-lastlog-create.patch
  93. 104
      SOURCES/2.24-agetty-clocal.patch
  94. 42
      SOURCES/2.24-agetty-etc-os-release.patch
  95. 15
      SOURCES/2.24-blockdev-setbsz-hint.patch
  96. 9
      SOURCES/2.24-fsck-fstab.patch
  97. 17
      SOURCES/2.24-libfdisk-fix-SIGFPE.patch
  98. 82
      SOURCES/2.24-libmount-3.14.patch
  99. 15
      SOURCES/2.24-libmount-canonicalize-for-conversion-from-loopdev.patch
  100. 24
      SOURCES/2.24-libmount-mem.patch
  101. Some files were not shown because too many files have changed in this diff Show More

87
SOURCES/0060-build-sys-add-CFLAGS-and-LDFLAGS-for-daemons-and-sha.patch

@ -28,31 +28,31 @@ index bebe0d2..4b39246 100644 @@ -28,31 +28,31 @@ 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.

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.

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])

[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],
@ -64,48 +64,48 @@ index f7c27cd..f3c7214 100644 @@ -64,48 +64,48 @@ index f7c27cd..f3c7214 100644
+ [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

-I$(ul_libblkid_incdir) \
-I$(top_srcdir)/libblkid/src
@@ -128,6 +129,7 @@ libblkid_la_DEPENDENCIES = \
libblkid/src/blkid.h.in

libblkid/src/blkid.h.in
libblkid_la_LDFLAGS = \
+ $(SOLIB_LDFLAGS) \
-Wl,--version-script=$(top_srcdir)/libblkid/src/blkid.sym \
-version-info $(LIBBLKID_VERSION_INFO)

-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

-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
@ -113,26 +113,26 @@ index 494e02a..8ef07e5 100644 @@ -113,26 +113,26 @@ index 494e02a..8ef07e5 100644
+++ 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
-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/src/libmount.h.in
libmount_la_LDFLAGS = \
+ $(SOLIB_LDFLAGS) \
-Wl,--version-script=$(top_srcdir)/libmount/src/libmount.sym \
-version-info $(LIBMOUNT_VERSION_INFO)

-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
@ -141,12 +141,12 @@ index 73f1ba9..a20cb4c 100644 @@ -141,12 +141,12 @@ index 73f1ba9..a20cb4c 100644
+ $(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)

-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
@ -161,5 +161,6 @@ index a615047..70a78f2 100644 @@ -161,5 +161,6 @@ index a615047..70a78f2 100644
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


95
SOURCES/0061-libmount-be-more-restrictive-about-valid-tag-names.patch

@ -27,12 +27,12 @@ index 7b65122..43a4daf 100644 @@ -27,12 +27,12 @@ index 7b65122..43a4daf 100644
@@ -583,22 +583,18 @@ error:
char *mnt_resolve_spec(const char *spec, struct libmnt_cache *cache)
{
char *cn = NULL;
char *cn = NULL;
+ char *t = NULL, *v = NULL;

if (!spec)
return NULL;

if (!spec)
return NULL;
- if (strchr(spec, '=')) {
- char *tag, *val;
-
@ -46,51 +46,51 @@ index 7b65122..43a4daf 100644 @@ -46,51 +46,51 @@ index 7b65122..43a4daf 100644
+ 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);

cn = mnt_resolve_path(spec, cache);
+ free(t);
+ free(v);
return cn;
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);
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';
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);

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;

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
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);

assert(fs);
- if (source && *source != '/' && strchr(source, '=')) {
- if (blkid_parse_tag_string(source, &t, &v) != 0)
- return -1;
@ -100,21 +100,21 @@ index c95cdc7..75e3bbb 100644 @@ -100,21 +100,21 @@ index c95cdc7..75e3bbb 100644
+ free(t);
+ free(v);
+ t = v = NULL;
}

if (fs->source != source)
}
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
@ -122,18 +122,18 @@ index e3524a8..1ba1eec 100644 @@ -122,18 +122,18 @@ index e3524a8..1ba1eec 100644
+++ 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)
const char *source, int direction)
{
- struct libmnt_fs *fs = NULL;
+ struct libmnt_fs *fs;
+ char *t = NULL, *v = NULL;

assert(tb);

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));

DBG(TAB, mnt_debug_h(tb, "lookup SOURCE: '%s'", source));
- if (source && *source && strchr(source, '=')) {
- char *tag, *val;
-
@ -146,23 +146,23 @@ index e3524a8..1ba1eec 100644 @@ -146,23 +146,23 @@ index e3524a8..1ba1eec 100644
- }
- } else
+ if (blkid_parse_tag_string(source, &t, &v) || !mnt_valid_tagname(t))
fs = mnt_table_find_srcpath(tb, source, direction);
fs = mnt_table_find_srcpath(tb, source, direction);
+ else
+ fs = mnt_table_find_tag(tb, t, v, direction);
+
+ free(t);
+ free(v);

return fs;
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);
return (stat(name, &st) != 0 || st.st_size == 0);
}

+int mnt_valid_tagname(const char *tagname)
+{
+ if (tagname && *tagname && (
@ -177,6 +177,7 @@ index 6a444ad..9305bb8 100644 @@ -177,6 +177,7 @@ index 6a444ad..9305bb8 100644
+
int mnt_parse_offset(const char *str, size_t len, uintmax_t *res)
{
char *p;
--
char *p;
--
2.7.4


105
SOURCES/0062-mount-umount-swapon-fsck-lsblk-findmnt-ignore-malfor.patch

@ -36,48 +36,48 @@ index 6e3a2c0..3ef8e5b 100644 @@ -36,48 +36,48 @@ 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)
const char *filename, int line)
{
warnx(_("%s: parse error at line %d -- ignore"), filename, 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) {
mnt_free_fs(fs);
- if (rc == 1)
+ if (rc > 0)
continue; /* recoverable error */
if (feof(f))
break;
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)
const char *filename, int line)
{
warnx(_("%s: parse error at line %d"), filename, 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);
return xstrdup(path);
}

+static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)),
+ const char *filename, int line)
+{
@ -89,44 +89,44 @@ index 9e12a90..cd28c1d 100644 @@ -89,44 +89,44 @@ index 9e12a90..cd28c1d 100644
+
static int is_active_swap(const char *filename)
{
if (!swaps) {
if (!swaps) {
@@ -346,6 +355,7 @@ static int is_active_swap(const char *filename)
if (!mntcache)
mntcache = mnt_new_cache();

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);
}
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();

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);
}
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);
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)
+{
@ -138,34 +138,35 @@ index 5c95ef3..5f14ddb 100644 @@ -138,34 +138,35 @@ index 5c95ef3..5f14ddb 100644
+
struct libmnt_table *get_fstab(void)
{
if (!fstab) {
fstab = mnt_new_table();
if (!fstab)
return NULL;
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;
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);
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;
}
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);
if (filename)
warnx(_("%s: parse error: ignore entry at line %d."),
filename, line);
- return 0;
+ return 1;
}


--
--
2.7.4


101
SOURCES/0063-login-mount-fix-__SC_GETPW_R_SIZE_MAX-usage.patch

@ -25,7 +25,7 @@ index a50e8a5..7b59ce8 100644 @@ -25,7 +25,7 @@ index a50e8a5..7b59ce8 100644
@@ -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
@ -39,9 +39,9 @@ index 9305bb8..7c6f5b1 100644 @@ -39,9 +39,9 @@ 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;
return rc;
}

-static size_t get_pw_record_size(void)
-{
-#ifdef _SC_GETPW_R_SIZE_MAX
@ -58,74 +58,74 @@ index 9305bb8..7c6f5b1 100644 @@ -58,74 +58,74 @@ index 9305bb8..7c6f5b1 100644
@@ -555,14 +545,13 @@ char *mnt_get_username(const uid_t uid)
{
struct passwd pwd;
struct passwd *res;
struct passwd *res;
- size_t sz = get_pw_record_size();
char *buf, *username = NULL;

char *buf, *username = NULL;
- buf = malloc(sz);
+ buf = malloc(UL_GETPW_BUFSIZ);
if (!buf)
return NULL;

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);
username = strdup(pwd.pw_name);
free(buf);
@@ -574,17 +563,16 @@ int mnt_get_uid(const char *username, uid_t *uid)
int rc = -1;
int rc = -1;
struct passwd pwd;
struct passwd *pw;
struct passwd *pw;
- size_t sz = get_pw_record_size();
char *buf;

if (!username || !uid)
return -EINVAL;

char *buf;
if (!username || !uid)
return -EINVAL;
- buf = malloc(sz);
+ buf = malloc(UL_GETPW_BUFSIZ);
if (!buf)
return -ENOMEM;

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 {
*uid= pw->pw_uid;
rc = 0;
} else {
@@ -602,17 +590,16 @@ int mnt_get_gid(const char *groupname, gid_t *gid)
int rc = -1;
int rc = -1;
struct group grp;
struct group *gr;
struct group *gr;
- size_t sz = get_pw_record_size();
char *buf;

if (!groupname || !gid)
return -EINVAL;

char *buf;
if (!groupname || !gid)
return -EINVAL;
- buf = malloc(sz);
+ buf = malloc(UL_GETPW_BUFSIZ);
if (!buf)
return -ENOMEM;

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 {
*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 *pwd)
{
struct passwd *res = NULL;
struct passwd *res = NULL;
- size_t sz = 16384;
int x;

if (!pwdbuf || !username)
return NULL;

int x;
if (!pwdbuf || !username)
return NULL;
-#ifdef _SC_GETPW_R_SIZE_MAX
- {
- long xsz = sysconf(_SC_GETPW_R_SIZE_MAX);
@ -135,11 +135,12 @@ index a59dd3a..e0e960f 100644 @@ -135,11 +135,12 @@ index a59dd3a..e0e960f 100644
-#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;
--
if (!res) {
errno = x;
return NULL;
--
2.7.4


563
SOURCES/0064-bash-completion-use-n-as-IFS-when-ask-for-filenames.patch

@ -70,553 +70,554 @@ index b439328..9f97dd9 100644 @@ -70,553 +70,554 @@ 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')
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-c')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/tty"}) )
return 0
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')
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-F'|'--file')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
return 0
;;
'-F'|'--tab-file')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
return 0
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')
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-x'|'--destination')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f'|'--rtc'|'--adjfile')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
;;
/*)
return 0
;;
/*)
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f'|'--file')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f'|'--file')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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)
esac
case $COMP_CWORD in
1|2)
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
;;
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')
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
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) )
;;
*)
COMPREPLY=( $(compgen -W "replacement" -- $cur) )
;;
*)
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
;;
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
return 0
;;
'-file')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
return 0
;;
'-O'|'-I')
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/lp"}) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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')
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')
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')
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
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
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
return 0
;;
esac
+ local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) )
return 0
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')
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
--
compopt -o filenames
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
return 0
--
2.7.4


13
SOURCES/0065-hwclock-change-audit-message.patch

@ -19,12 +19,13 @@ index c7789c8..ac9294b 100644 @@ -19,12 +19,13 @@ index c7789c8..ac9294b 100644
+++ 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,
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);
}
--
status ? 0 : 1);
close(hwaudit_fd);
}
--
2.7.4


45
SOURCES/0066-su-clean-up-groups-initialization.patch

@ -46,17 +46,17 @@ index dd87804..d53d690 100644 @@ -46,17 +46,17 @@ index dd87804..d53d690 100644
+++ 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)
+{
@ -96,13 +96,13 @@ index dd87804..d53d690 100644 @@ -96,13 +96,13 @@ index dd87804..d53d690 100644
+ 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':
break;
case 'g':
- gr = getgrnam(optarg);
- if (!gr)
- errx(EXIT_FAILURE, _("group %s does not exist"), optarg);
@ -110,9 +110,9 @@ index dd87804..d53d690 100644 @@ -110,9 +110,9 @@ index dd87804..d53d690 100644
- groups[0] = gr->gr_gid;
+ use_gid = true;
+ gid = add_supp_group(optarg, &groups, &ngroups);
break;

case 'G':
break;
case 'G':
- num_supp_groups++;
- if (num_supp_groups >= NGROUPS_MAX)
- errx(EXIT_FAILURE,
@ -124,22 +124,22 @@ index dd87804..d53d690 100644 @@ -124,22 +124,22 @@ index dd87804..d53d690 100644
- groups[num_supp_groups] = gr->gr_gid;
+ use_supp = true;
+ add_supp_group(optarg, &groups, &ngroups);
break;

case 'l':
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);
: DEFAULT_SHELL);
endpwent ();

- if (num_supp_groups && !use_gid)
- {
- pw->pw_gid = groups[1];
@ -153,16 +153,16 @@ index dd87804..d53d690 100644 @@ -153,16 +153,16 @@ index dd87804..d53d690 100644
- }
+ 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
@ -181,5 +181,6 @@ index eab1a6f..1f69868 100644 @@ -181,5 +181,6 @@ index eab1a6f..1f69868 100644
.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


19
SOURCES/0067-lscpu-Fix-model-and-model-name-on-Power-Systems.patch

@ -65,18 +65,19 @@ index 4af8176..68b15af 100644 @@ -65,18 +65,19 @@ 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)) ;
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)) ;
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 */
--
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


55
SOURCES/0068-lscpu-use-cpu-and-revision-tag-if-available.patch

@ -26,41 +26,41 @@ index 68b15af..7a00636 100644 @@ -26,41 +26,41 @@ 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 *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 */
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)) ;
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)) ;
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 */
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, "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;
}
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);
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)
@ -69,9 +69,9 @@ index 68b15af..7a00636 100644 @@ -69,9 +69,9 @@ index 68b15af..7a00636 100644
+ 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)
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
@ -100,5 +100,6 @@ index 40e2736..d4ae6c1 100644 @@ -100,5 +100,6 @@ index 40e2736..d4ae6c1 100644
L1d cache: 32K
L1i cache: 32K
NUMA node0 CPU(s): 0-63
--
--
2.7.4


49
SOURCES/0069-findfs-add-ability-to-work-with-PART-UUID-LABEL-too.patch

@ -88,27 +88,27 @@ index bc4a843..29ca1cb 100644 @@ -88,27 +88,27 @@ index bc4a843..29ca1cb 100644
+++ b/misc-utils/findfs.c
@@ -19,8 +19,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
{
FILE *out = rc ? stderr : stdout;
fputs(USAGE_HEADER, out);
FILE *out = rc ? stderr : stdout;
fputs(USAGE_HEADER, out);
- fprintf(out, _(" %1$s [options] LABEL=<label>\n"
- " %1$s [options] UUID=<uuid>\n"),
+ fprintf(out, _(" %s [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value>\n"),
program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(USAGE_HELP, out);
program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(USAGE_HELP, out);
@@ -31,7 +30,7 @@ static void __attribute__((__noreturn__)) usage(int rc)

int main(int argc, char **argv)
{
- char *dev, *tk, *vl;
+ char *dev;

setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -43,23 +42,17 @@ int main(int argc, char **argv)
* with version from e2fsprogs */
usage(2);

* with version from e2fsprogs */
usage(2);
- if (!strncmp(argv[1], "LABEL=", 6)) {
- tk = "LABEL";
- vl = argv[1] + 6;
@ -117,20 +117,21 @@ index bc4a843..29ca1cb 100644 @@ -117,20 +117,21 @@ index bc4a843..29ca1cb 100644
- vl = argv[1] + 5;
- } else if (strcmp(argv[1], "-V") == 0 ||
+ if (strcmp(argv[1], "-V") == 0 ||
strcmp(argv[1], "--version") == 0) {
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
} else if (strcmp(argv[1], "-h") == 0 ||
strcmp(argv[1], "--help") == 0) {
usage(EXIT_SUCCESS);
strcmp(argv[1], "--version") == 0) {
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
} else if (strcmp(argv[1], "-h") == 0 ||
strcmp(argv[1], "--help") == 0) {
usage(EXIT_SUCCESS);
- } else
+ } else if (argv[1][0] == '-')
usage(2);

usage(2);
- dev = blkid_evaluate_tag(tk, vl, NULL);
+ dev = blkid_evaluate_tag(argv[1], NULL, NULL);
if (!dev)
errx(EXIT_FAILURE, _("unable to resolve '%s'"), argv[1]);

--
if (!dev)
errx(EXIT_FAILURE, _("unable to resolve '%s'"), argv[1]);
--
2.7.4


21
SOURCES/0070-libblkid-fix-memory-leak-in-blkid_parse_tag_string.patch

@ -16,9 +16,9 @@ index 3a70950..3aede04 100644 @@ -16,9 +16,9 @@ index 3a70950..3aede04 100644
--- a/libblkid/src/tag.c
+++ b/libblkid/src/tag.c
@@ -237,14 +237,18 @@ int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val)
goto errout; /* missing closing quote */
*cp = '\0';
}
goto errout; /* missing closing quote */
*cp = '\0';
}
- value = value && *value ? strdup(value) : NULL;
- if (!value)
- goto errout;
@ -29,15 +29,16 @@ index 3a70950..3aede04 100644 @@ -29,15 +29,16 @@ index 3a70950..3aede04 100644
+ goto errout;
+ *ret_val = value;
+ }

if (ret_type)
*ret_type = name;
if (ret_type)
*ret_type = name;
- if (ret_val)
- *ret_val = value;
+ else
+ free(name);

return 0;

--
return 0;
--
2.7.4


39
SOURCES/0071-findmnt-don-t-rely-on-st_dev-for-target.patch

@ -51,7 +51,7 @@ index 407636e..54739b7 100644 @@ -51,7 +51,7 @@ index 407636e..54739b7 100644
+Explicitly define the mount target (mountpoint directory). If the \fIpath\fR
+is not a mountpoint file or directory than
+.B findmnt
+checks \fIpath\fR elements in reverse order for get the mountpoint (this feature is
+checks \fIpath\fR elements in reverse order for get the mountpoint (this feature is
+supported only if search in kernel files and unsupported for \fB\-\-fstab\fP).
.TP
.BR \-t , " \-\-types \fIlist\fP"
@ -61,9 +61,9 @@ index f16da91..fe899db 100644 @@ -61,9 +61,9 @@ index f16da91..fe899db 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -236,9 +236,12 @@ static void set_source_match(const char *data)
set_match(COL_SOURCE, data);
set_match(COL_SOURCE, data);
}

-static void enable_extra_target_match(void)
+/* @tb has to be from kernel (so no fstab or so)! */
+static void enable_extra_target_match(struct libmnt_table *tb)
@ -72,13 +72,13 @@ index f16da91..fe899db 100644 @@ -72,13 +72,13 @@ index f16da91..fe899db 100644
+ char *cn = NULL;
+ const char *tgt = NULL, *mnt = NULL;
+ struct libmnt_fs *fs;

/*
* Check if match pattern is mountpoint, if not use the
/*
* Check if match pattern is mountpoint, if not use the
@@ -248,9 +251,11 @@ static void enable_extra_target_match(void)
if (!cn)
return;

if (!cn)
return;
- mnt = mnt_get_mountpoint(cn);
- if (!mnt || strcmp(mnt, cn) == 0)
- return;
@ -87,17 +87,18 @@ index f16da91..fe899db 100644 @@ -87,17 +87,18 @@ index f16da91..fe899db 100644
+ mnt = mnt_fs_get_target(fs);
+ if (mnt && strcmp(mnt, tgt) != 0)
+ set_match(COL_TARGET, xstrdup(mnt)); /* replace the current setting */

/* replace the current setting with the real mountpoint */
set_match(COL_TARGET, mnt);
/* replace the current setting with the real mountpoint */
set_match(COL_TARGET, mnt);
@@ -1484,7 +1489,7 @@ int main(int argc, char *argv[])
* try it again with extra functionality for target
* match
*/
* try it again with extra functionality for target
* match
*/
- enable_extra_target_match();
+ enable_extra_target_match(tb);
rc = add_matching_lines(tb, tt, direction);
}
}
--
rc = add_matching_lines(tb, tt, direction);
}
}
--
2.7.4


73
SOURCES/0072-libmount-cleanup-fs-root-detection-code.patch

@ -28,13 +28,13 @@ index 1ba1eec..10ee7ce 100644 @@ -28,13 +28,13 @@ index 1ba1eec..10ee7ce 100644
#include "loopdev.h"
+#include "fileutils.h"
+#include "canonicalize.h"

static int is_mountinfo(struct libmnt_table *tb);

@@ -900,6 +902,20 @@ struct libmnt_fs *mnt_table_find_devno(struct libmnt_table *tb,
return NULL;
return NULL;
}

+static char *remove_mountpoint_from_path(const char *path, const char *mnt)
+{
+ char *res;
@ -53,19 +53,19 @@ index 1ba1eec..10ee7ce 100644 @@ -53,19 +53,19 @@ index 1ba1eec..10ee7ce 100644
* tb: /proc/self/mountinfo
* fs: filesystem
@@ -919,7 +935,8 @@ struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb,
unsigned long mountflags,
char **fsroot)
unsigned long mountflags,
char **fsroot)
{
- char *root = NULL, *mnt = NULL;
+ char *root = NULL;
+ const char *mnt = NULL;
const char *fstype;
struct libmnt_fs *src_fs = NULL;

const char *fstype;
struct libmnt_fs *src_fs = NULL;
@@ -937,10 +954,15 @@ struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb,
DBG(TAB, mnt_debug("fs-root for bind"));

src = xsrc = mnt_resolve_spec(mnt_fs_get_source(fs), tb->cache);
DBG(TAB, mnt_debug("fs-root for bind"));
src = xsrc = mnt_resolve_spec(mnt_fs_get_source(fs), tb->cache);
- if (src)
- mnt = mnt_get_mountpoint(src);
+ if (src) {
@ -75,32 +75,32 @@ index 1ba1eec..10ee7ce 100644 @@ -75,32 +75,32 @@ index 1ba1eec..10ee7ce 100644
+ mnt = mnt_fs_get_target(fs);
+ }
+
if (mnt)
if (mnt)
- root = mnt_get_fs_root(src, mnt);
+ root = remove_mountpoint_from_path(src, mnt);

if (xsrc && !tb->cache) {
free(xsrc);
if (xsrc && !tb->cache) {
free(xsrc);
@@ -1007,11 +1029,9 @@ dflt:

DBG(TAB, mnt_debug("FS root result: %s", root));

DBG(TAB, mnt_debug("FS root result: %s", root));
- free(mnt);
return src_fs;
return src_fs;
err:
free(root);
free(root);
- free(mnt);
return NULL;
return NULL;
}

diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index 5783d88..2151ff9 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -908,28 +908,6 @@ err:
return NULL;
return NULL;
}

-char *mnt_get_fs_root(const char *path, const char *mnt)
-{
- char *m = (char *) mnt, *res;
@ -127,9 +127,9 @@ index 5783d88..2151ff9 100644 @@ -127,9 +127,9 @@ index 5783d88..2151ff9 100644
* Search for @name kernel command parametr.
*
@@ -1085,17 +1063,6 @@ int test_mountpoint(struct libmnt_test *ts, int argc, char *argv[])
return 0;
return 0;
}

-int test_fsroot(struct libmnt_test *ts, int argc, char *argv[])
-{
- char *path = canonicalize_path(argv[1]),
@ -143,15 +143,15 @@ index 5783d88..2151ff9 100644 @@ -143,15 +143,15 @@ index 5783d88..2151ff9 100644
-
int test_filesystems(struct libmnt_test *ts, int argc, char *argv[])
{
char **filesystems = NULL;
char **filesystems = NULL;
@@ -1170,7 +1137,6 @@ int main(int argc, char *argv[])
{ "--starts-with", test_startswith, "<string> <prefix>" },
{ "--ends-with", test_endswith, "<string> <prefix>" },
{ "--mountpoint", test_mountpoint, "<path>" },
{ "--starts-with", test_startswith, "<string> <prefix>" },
{ "--ends-with", test_endswith, "<string> <prefix>" },
{ "--mountpoint", test_mountpoint, "<path>" },
- { "--fs-root", test_fsroot, "<path>" },
{ "--cd-parent", test_chdir, "<path>" },
{ "--kernel-cmdline",test_kernel_cmdline, "<option> | <option>=" },
{ "--mkdir", test_mkdir, "<path>" },
{ "--cd-parent", test_chdir, "<path>" },
{ "--kernel-cmdline",test_kernel_cmdline, "<option> | <option>=" },
{ "--mkdir", test_mkdir, "<path>" },
diff --git a/tests/expected/libmount/utils-fs-root b/tests/expected/libmount/utils-fs-root
deleted file mode 100644
index 7746b28..0000000
@ -180,7 +180,7 @@ index 6facaad..89ecf10 100755 @@ -180,7 +180,7 @@ index 6facaad..89ecf10 100755
@@ -64,18 +64,6 @@ ts_init_subtest "mountpoint-root"
ts_valgrind $TESTPROG --mountpoint / &> $TS_OUTPUT
ts_finalize_subtest

-ts_init_subtest "fs-root"
-ts_valgrind $TESTPROG --fs-root /proc &> $TS_OUTPUT
-ts_finalize_subtest
@ -196,5 +196,6 @@ index 6facaad..89ecf10 100755 @@ -196,5 +196,6 @@ index 6facaad..89ecf10 100755
ts_init_subtest "kernel-cmdline"
export LIBMOUNT_KERNEL_CMDLINE="$TS_SELF/files/kernel_cmdline"
ts_valgrind $TESTPROG --kernel-cmdline selinux= &>> $TS_OUTPUT
--
--
2.7.4


15
SOURCES/0073-libmount-mark-overlay-as-pseudo-FS.patch

@ -15,12 +15,13 @@ index 2151ff9..c13fb96 100644 @@ -15,12 +15,13 @@ index 2151ff9..c13fb96 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -269,6 +269,7 @@ int mnt_fstype_is_pseudofs(const char *type)
"mqueue",
"nfsd",
"none",
"mqueue",
"nfsd",
"none",
+ "overlay",
"pipefs",
"proc",
"pstore",
--
"pipefs",
"proc",
"pstore",
--
2.7.4


15
SOURCES/0074-logger-be-more-precise-about-port-description.patch

@ -28,13 +28,14 @@ index c83c0b8..a331869 100644 @@ -28,13 +28,14 @@ index c83c0b8..a331869 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -222,7 +222,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
" -f, --file <file> log the contents of this file\n"
" -h, --help display this help text and exit\n"), out);
fputs(_(" -n, --server <name> write to this remote syslog server\n"
" -f, --file <file> log the contents of this file\n"
" -h, --help display this help text and exit\n"), out);
fputs(_(" -n, --server <name> write to this remote syslog server\n"
- " -P, --port <number> use this UDP port\n"
+ " -P, --port <port> use this port for UDP or TCP connection\n"
" -p, --priority <prio> mark given message with this priority\n"
" -s, --stderr output message to standard error as well\n"), out);
fputs(_(" -t, --tag <tag> mark every line with this tag\n"
--
" -p, --priority <prio> mark given message with this priority\n"
" -s, --stderr output message to standard error as well\n"), out);
fputs(_(" -t, --tag <tag> mark every line with this tag\n"
--
2.7.4


195
SOURCES/0075-libfdisk-gpt-be-more-careful-with-64bit-constants.patch

@ -20,162 +20,163 @@ index 482d453..d3bdc2d 100644 @@ -20,162 +20,163 @@ index 482d453..d3bdc2d 100644
@@ -53,7 +53,7 @@
#define GPT_MBR_PROTECTIVE 1
#define GPT_MBR_HYBRID 2

-#define GPT_PRIMARY_PARTITION_TABLE_LBA 0x00000001
+#define GPT_PRIMARY_PARTITION_TABLE_LBA 0x00000001ULL

#define EFI_PMBR_OSTYPE 0xEE
#define MSDOS_MBR_SIGNATURE 0xAA55
@@ -364,7 +364,7 @@ static int gpt_mknew_pmbr(struct fdisk_context *cxt)
pmbr->partition_record[0].end_track = 0xFF;
pmbr->partition_record[0].starting_lba = cpu_to_le32(1);
pmbr->partition_record[0].size_in_lba =
pmbr->partition_record[0].end_track = 0xFF;
pmbr->partition_record[0].starting_lba = cpu_to_le32(1);
pmbr->partition_record[0].size_in_lba =
- cpu_to_le32(min((uint32_t) cxt->total_sectors - 1, 0xFFFFFFFF));
+ cpu_to_le32((uint32_t) min(cxt->total_sectors - 1ULL, 0xFFFFFFFFULL));

return 0;
return 0;
}
@@ -379,14 +379,14 @@ static void gpt_mknew_header_common(struct fdisk_context *cxt,
header->my_lba = cpu_to_le64(lba);

if (lba == GPT_PRIMARY_PARTITION_TABLE_LBA) { /* primary */
header->my_lba = cpu_to_le64(lba);
if (lba == GPT_PRIMARY_PARTITION_TABLE_LBA) { /* primary */
- header->alternative_lba = cpu_to_le64(cxt->total_sectors - 1);
- header->partition_entry_lba = cpu_to_le64(2);
+ header->alternative_lba = cpu_to_le64(cxt->total_sectors - 1ULL);
+ header->partition_entry_lba = cpu_to_le64(2ULL);
} else { /* backup */
uint64_t esz = le32_to_cpu(header->npartition_entries) * sizeof(struct gpt_entry);
uint64_t esects = (esz + cxt->sector_size - 1) / cxt->sector_size;

header->alternative_lba = cpu_to_le64(GPT_PRIMARY_PARTITION_TABLE_LBA);
} else { /* backup */
uint64_t esz = le32_to_cpu(header->npartition_entries) * sizeof(struct gpt_entry);
uint64_t esects = (esz + cxt->sector_size - 1) / cxt->sector_size;
header->alternative_lba = cpu_to_le64(GPT_PRIMARY_PARTITION_TABLE_LBA);
- header->partition_entry_lba = cpu_to_le64(cxt->total_sectors - 1 - esects);
+ header->partition_entry_lba = cpu_to_le64(cxt->total_sectors - 1ULL - esects);
}
}
}

@@ -451,8 +451,8 @@ static int gpt_mknew_header(struct fdisk_context *cxt,
header->npartition_entries = cpu_to_le32(GPT_NPARTITIONS);
header->sizeof_partition_entry = cpu_to_le32(sizeof(struct gpt_entry));

header->npartition_entries = cpu_to_le32(GPT_NPARTITIONS);
header->sizeof_partition_entry = cpu_to_le32(sizeof(struct gpt_entry));
- last = cxt->total_sectors - 2 - esz;
- first = esz + 2;
+ last = cxt->total_sectors - 2ULL - esz;
+ first = esz + 2ULL;

if (first < cxt->first_lba && cxt->first_lba < last)
/* Align according to topology */
if (first < cxt->first_lba && cxt->first_lba < last)
/* Align according to topology */
@@ -520,7 +520,7 @@ check_hybrid:
*/
if (ret == GPT_MBR_PROTECTIVE) {
if (le32_to_cpu(pmbr->partition_record[0].size_in_lba) !=
*/
if (ret == GPT_MBR_PROTECTIVE) {
if (le32_to_cpu(pmbr->partition_record[0].size_in_lba) !=
- min((uint32_t) cxt->total_sectors - 1, 0xFFFFFFFF))
+ (uint32_t) min(cxt->total_sectors - 1ULL, 0xFFFFFFFFULL))
ret = 0;
}
ret = 0;
}
done:
@@ -538,7 +538,7 @@ static uint64_t last_lba(struct fdisk_context *cxt)
}

if (S_ISBLK(s.st_mode))
}
if (S_ISBLK(s.st_mode))
- return cxt->total_sectors - 1;
+ return cxt->total_sectors - 1ULL;
else if (S_ISREG(s.st_mode)) {
uint64_t sectors = s.st_size >> cxt->sector_size;
return (sectors / cxt->sector_size) - 1ULL;
else if (S_ISREG(s.st_mode)) {
uint64_t sectors = s.st_size >> cxt->sector_size;
return (sectors / cxt->sector_size) - 1ULL;
@@ -554,7 +554,7 @@ static ssize_t read_lba(struct fdisk_context *cxt, uint64_t lba,

if (lseek(cxt->dev_fd, offset, SEEK_SET) == (off_t) -1)
return -1;
if (lseek(cxt->dev_fd, offset, SEEK_SET) == (off_t) -1)
return -1;
- return read(cxt->dev_fd, buffer, bytes) != bytes;
+ return read(cxt->dev_fd, buffer, bytes) != (ssize_t) bytes;
}


@@ -908,7 +908,7 @@ static uint64_t find_first_available(struct gpt_header *header,
if (first < gpt_partition_start(&e[i]))
continue;
if (first <= gpt_partition_end(&e[i])) {
if (first < gpt_partition_start(&e[i]))
continue;
if (first <= gpt_partition_end(&e[i])) {
- first = gpt_partition_end(&e[i]) + 1;
+ first = gpt_partition_end(&e[i]) + 1ULL;
first_moved = 1;
}
}
first_moved = 1;
}
}
@@ -937,7 +937,7 @@ static uint64_t find_last_free(struct gpt_header *header,
uint64_t ps = gpt_partition_start(&e[i]);

if (nearest_start > ps && ps > start)
uint64_t ps = gpt_partition_start(&e[i]);
if (nearest_start > ps && ps > start)
- nearest_start = ps - 1;
+ nearest_start = ps - 1ULL;
}

return nearest_start;
}
return nearest_start;
@@ -960,7 +960,7 @@ static uint64_t find_last_free_sector(struct gpt_header *header,
for (i = 0; i < le32_to_cpu(header->npartition_entries); i++) {
if ((last >= gpt_partition_start(&e[i])) &&
(last <= gpt_partition_end(&e[i]))) {
for (i = 0; i < le32_to_cpu(header->npartition_entries); i++) {
if ((last >= gpt_partition_start(&e[i])) &&
(last <= gpt_partition_end(&e[i]))) {
- last = gpt_partition_start(&e[i]) - 1;
+ last = gpt_partition_start(&e[i]) - 1ULL;
last_moved = 1;
}
}
last_moved = 1;
}
}
@@ -986,7 +986,7 @@ static uint64_t find_first_in_largest(struct gpt_header *header, struct gpt_entr
first_sect = find_first_available(header, e, start);
if (first_sect != 0) {
last_sect = find_last_free(header, e, first_sect);
first_sect = find_first_available(header, e, start);
if (first_sect != 0) {
last_sect = find_last_free(header, e, first_sect);
- segment_size = last_sect - first_sect + 1;
+ segment_size = last_sect - first_sect + 1ULL;

if (segment_size > selected_size) {
selected_size = segment_size;
if (segment_size > selected_size) {
selected_size = segment_size;
@@ -1026,7 +1026,7 @@ static uint64_t get_free_sectors(struct fdisk_context *cxt, struct gpt_header *h
largest_seg = segment_sz;
totfound += segment_sz;
num++;
largest_seg = segment_sz;
totfound += segment_sz;
num++;
- start = last_sect + 1;
+ start = last_sect + 1ULL;
}
} while (first_sect);

}
} while (first_sect);
@@ -1165,7 +1165,7 @@ void gpt_list_table(struct fdisk_context *cxt,
continue;

/* the partition has to inside usable range */
continue;
/* the partition has to inside usable range */
- if (start < fu || start + size - 1 > lu)
+ if (start < fu || start + size - 1ULL > lu)
continue;

name = encode_to_utf8((unsigned char *)gpt->ents[i].partition_name,
continue;
name = encode_to_utf8((unsigned char *)gpt->ents[i].partition_name,
@@ -1266,11 +1266,11 @@ static int gpt_write_pmbr(struct fdisk_context *cxt)
* Set size_in_lba to the size of the disk minus one. If the size of the disk
* is too large to be represented by a 32bit LBA (2Tb), set it to 0xFFFFFFFF.
*/
* Set size_in_lba to the size of the disk minus one. If the size of the disk
* is too large to be represented by a 32bit LBA (2Tb), set it to 0xFFFFFFFF.
*/
- if (cxt->total_sectors - 1 > 0xFFFFFFFFULL)
+ if (cxt->total_sectors - 1ULL > 0xFFFFFFFFULL)
pmbr->partition_record[0].size_in_lba = cpu_to_le32(0xFFFFFFFF);
else
pmbr->partition_record[0].size_in_lba =
pmbr->partition_record[0].size_in_lba = cpu_to_le32(0xFFFFFFFF);
else
pmbr->partition_record[0].size_in_lba =
- cpu_to_le32(cxt->total_sectors - 1UL);
+ cpu_to_le32((uint32_t) (cxt->total_sectors - 1ULL));

offset = GPT_PMBR_LBA * cxt->sector_size;
if (offset != lseek(cxt->dev_fd, offset, SEEK_SET))
offset = GPT_PMBR_LBA * cxt->sector_size;
if (offset != lseek(cxt->dev_fd, offset, SEEK_SET))
@@ -1308,7 +1308,7 @@ static int gpt_write_disklabel(struct fdisk_context *cxt)
goto err0;

/* check that the backup header is properly placed */
goto err0;
/* check that the backup header is properly placed */
- if (le64_to_cpu(gpt->pheader->alternative_lba) < cxt->total_sectors - 1)
+ if (le64_to_cpu(gpt->pheader->alternative_lba) < cxt->total_sectors - 1ULL)
/* TODO: correct this (with user authorization) and write */
goto err0;

/* TODO: correct this (with user authorization) and write */
goto err0;
@@ -1645,7 +1645,7 @@ static int gpt_add_partition(

user_l = fdisk_ask_number_get_result(ask);
if (fdisk_ask_number_is_relative(ask))
user_l = fdisk_ask_number_get_result(ask);
if (fdisk_ask_number_is_relative(ask))
- user_l = fdisk_align_lba_in_range(cxt, user_l, user_f, dflt_l) - 1;
+ user_l = fdisk_align_lba_in_range(cxt, user_l, user_f, dflt_l) - 1ULL;
if (user_l > user_f && user_l <= disk_l)
break;
}
--
if (user_l > user_f && user_l <= disk_l)
break;
}
--
2.7.4


55
SOURCES/0076-lsns-backport-new-command.patch

@ -93,8 +93,8 @@ index f3c7214..5d9ea39 100644 @@ -93,8 +93,8 @@ index f3c7214..5d9ea39 100644
+++ b/configure.ac
@@ -1032,6 +1032,12 @@ UL_REQUIRES_BUILD([lslogins], [libsmartcols])
AM_CONDITIONAL([BUILD_LSLOGINS], [test "x$build_lslogins" = xyes])


+UL_BUILD_INIT([lsns], [check])
+UL_REQUIRES_LINUX([lsns])
+UL_REQUIRES_BUILD([lsns], [libsmartcols])
@ -109,21 +109,21 @@ index 7b53244..757f317 100644 @@ -109,21 +109,21 @@ index 7b53244..757f317 100644
--- a/include/Makemodule.am
+++ b/include/Makemodule.am
@@ -15,6 +15,7 @@ dist_noinst_HEADERS += \
include/exec_shell.h \
include/exitcodes.h \
include/fileutils.h \
include/exec_shell.h \
include/exitcodes.h \
include/fileutils.h \
+ include/idcache.h \
include/ismounted.h \
include/linux_reboot.h \
include/linux_version.h \
include/ismounted.h \
include/linux_reboot.h \
include/linux_version.h \
diff --git a/include/c.h b/include/c.h
index 7b59ce8..a2779a5 100644
--- a/include/c.h
+++ b/include/c.h
@@ -110,6 +110,14 @@
_max1 > _max2 ? _max1 : _max2; })
_max1 > _max2 ? _max1 : _max2; })
#endif

+#ifndef cmp_numbers
+# define cmp_numbers(x, y) __extension__ ({ \
+ __typeof__(x) _a = (x); \
@ -140,12 +140,12 @@ index 25045aa..848e474 100644 @@ -140,12 +140,12 @@ index 25045aa..848e474 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -15,7 +15,7 @@ struct dbg_mask { char *mname; int val; };

#define UL_DEBUG_DEFINE_MASK(m) int m ## _debug_mask
#define UL_DEBUG_DECLARE_MASK(m) extern UL_DEBUG_DEFINE_MASK(m)
-#define UL_DEBUG_DEFINE_MASKANEMS(m) static const struct dbg_mask m ## _masknames[]
+#define UL_DEBUG_DEFINE_MASKNAMES(m) static const struct dbg_mask m ## _masknames[]

/* p - flag prefix, m - flag postfix */
#define UL_DEBUG_DEFINE_FLAG(p, m) p ## m
diff --git a/include/idcache.h b/include/idcache.h
@ -189,23 +189,23 @@ index 14b766c..9f8dd76 100644 @@ -189,23 +189,23 @@ index 14b766c..9f8dd76 100644
@@ -28,5 +28,7 @@ extern void proc_processes_filter_by_name(struct proc_processes *ps, const char
extern void proc_processes_filter_by_uid(struct proc_processes *ps, uid_t uid);
extern int proc_next_pid(struct proc_processes *ps, pid_t *pid);

+extern char *proc_get_command(pid_t pid);
+extern char *proc_get_command_name(pid_t pid);

#endif /* UTIL_LINUX_PROCUTILS */
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index eed31f1..73280f9 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -8,6 +8,7 @@ libcommon_la_SOURCES = \
lib/colors.c \
lib/crc32.c \
lib/env.c \
lib/colors.c \
lib/crc32.c \
lib/env.c \
+ lib/idcache.c \
lib/fileutils.c \
lib/ismounted.c \
lib/mangle.c \
lib/fileutils.c \
lib/ismounted.c \
lib/mangle.c \
diff --git a/lib/idcache.c b/lib/idcache.c
new file mode 100644
index 0000000..3c358b8
@ -338,13 +338,13 @@ index d633261..8dfdec9 100644 @@ -338,13 +338,13 @@ index d633261..8dfdec9 100644
#include "at.h"
#include "c.h"
+#include "all-io.h"

/*
* @pid: process ID for which we want to obtain the threads group
@@ -193,6 +194,48 @@ int proc_next_pid(struct proc_processes *ps, pid_t *pid)
return 0;
return 0;
}

+/* returns process command path, use free() for result */
+static char *proc_file_strdup(pid_t pid, const char *name)
+{
@ -388,7 +388,7 @@ index d633261..8dfdec9 100644 @@ -388,7 +388,7 @@ index d633261..8dfdec9 100644
+}
+
#ifdef TEST_PROGRAM

static int test_tasks(int argc, char *argv[])
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index c6c561c..9baf5a3 100644
@ -397,7 +397,7 @@ index c6c561c..9baf5a3 100644 @@ -397,7 +397,7 @@ index c6c561c..9baf5a3 100644
@@ -182,6 +182,13 @@ prlimit_SOURCES = sys-utils/prlimit.c
prlimit_LDADD = $(LDADD) libcommon.la
endif

+if BUILD_LSNS
+usrbin_exec_PROGRAMS += lsns
+dist_man_MANS += sys-utils/lsns.8
@ -405,7 +405,7 @@ index c6c561c..9baf5a3 100644 @@ -405,7 +405,7 @@ index c6c561c..9baf5a3 100644
+lsns_LDADD = $(LDADD) libcommon.la libsmartcols.la
+lsns_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
+endif

if BUILD_MOUNT
#
diff --git a/sys-utils/lsns.8 b/sys-utils/lsns.8
@ -1246,5 +1246,6 @@ index 0000000..5ee2981 @@ -1246,5 +1246,6 @@ index 0000000..5ee2981
+ free_idcache(uid_cache);
+ return r == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
--
--
2.7.4


33
SOURCES/0077-lib-strutils-make-strmode-more-generic.patch

@ -20,56 +20,57 @@ index c263b86..f9cdcbb 100644 @@ -20,56 +20,57 @@ index c263b86..f9cdcbb 100644
{
+ unsigned short i = 0;
+
if (S_ISDIR(mode))
if (S_ISDIR(mode))
- str[0] = 'd';
+ str[i++] = 'd';
else if (S_ISLNK(mode))
else if (S_ISLNK(mode))
- str[0] = 'l';
+ str[i++] = 'l';
else if (S_ISCHR(mode))
else if (S_ISCHR(mode))
- str[0] = 'c';
+ str[i++] = 'c';
else if (S_ISBLK(mode))
else if (S_ISBLK(mode))
- str[0] = 'b';
+ str[i++] = 'b';
else if (S_ISSOCK(mode))
else if (S_ISSOCK(mode))
- str[0] = 's';
+ str[i++] = 's';
else if (S_ISFIFO(mode))
else if (S_ISFIFO(mode))
- str[0] = 'p';
+ str[i++] = 'p';
else if (S_ISREG(mode))
else if (S_ISREG(mode))
- str[0] = '-';
+ str[i++] = '-';

- str[1] = mode & S_IRUSR ? 'r' : '-';
- str[2] = mode & S_IWUSR ? 'w' : '-';
- str[3] = (mode & S_ISUID
+ str[i++] = mode & S_IRUSR ? 'r' : '-';
+ str[i++] = mode & S_IWUSR ? 'w' : '-';
+ str[i++] = (mode & S_ISUID
? (mode & S_IXUSR ? 's' : 'S')
: (mode & S_IXUSR ? 'x' : '-'));
? (mode & S_IXUSR ? 's' : 'S')
: (mode & S_IXUSR ? 'x' : '-'));
- str[4] = mode & S_IRGRP ? 'r' : '-';
- str[5] = mode & S_IWGRP ? 'w' : '-';
- str[6] = (mode & S_ISGID
+ str[i++] = mode & S_IRGRP ? 'r' : '-';
+ str[i++] = mode & S_IWGRP ? 'w' : '-';
+ str[i++] = (mode & S_ISGID
? (mode & S_IXGRP ? 's' : 'S')
: (mode & S_IXGRP ? 'x' : '-'));
? (mode & S_IXGRP ? 's' : 'S')
: (mode & S_IXGRP ? 'x' : '-'));
- str[7] = mode & S_IROTH ? 'r' : '-';
- str[8] = mode & S_IWOTH ? 'w' : '-';
- str[9] = (mode & S_ISVTX
+ str[i++] = mode & S_IROTH ? 'r' : '-';
+ str[i++] = mode & S_IWOTH ? 'w' : '-';
+ str[i++] = (mode & S_ISVTX
? (mode & S_IXOTH ? 't' : 'T')
: (mode & S_IXOTH ? 'x' : '-'));
? (mode & S_IXOTH ? 't' : 'T')
: (mode & S_IXOTH ? 'x' : '-'));
- str[10] = '\0';
+ str[i] = '\0';
}

/*
--
--
2.7.4


321
SOURCES/0078-lsipc-backport-new-command.patch

@ -98,8 +98,8 @@ index 5d9ea39..fe0a011 100644 @@ -98,8 +98,8 @@ index 5d9ea39..fe0a011 100644
+++ b/configure.ac
@@ -1038,6 +1038,12 @@ UL_REQUIRES_BUILD([lsns], [libsmartcols])
AM_CONDITIONAL([BUILD_LSNS], [test "x$build_lsns" = xyes])


+UL_BUILD_INIT([lsipc], [check])
+UL_REQUIRES_LINUX([lsipc])
+UL_REQUIRES_BUILD([lsipc], [libsmartcols])
@ -116,7 +116,7 @@ index 6342793..1a1799a 100644 @@ -116,7 +116,7 @@ index 6342793..1a1799a 100644
@@ -19,6 +19,13 @@
# define XALLOC_EXIT_CODE EXIT_FAILURE
#endif

+static inline void __err_oom(const char *file, unsigned int line)
+{
+ err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line);
@ -133,8 +133,8 @@ index 9baf5a3..6badd17 100644 @@ -133,8 +133,8 @@ index 9baf5a3..6badd17 100644
+++ b/sys-utils/Makemodule.am
@@ -22,6 +22,16 @@ ipcs_SOURCES = sys-utils/ipcs.c \
ipcs_LDADD = $(LDADD) libcommon.la


+if BUILD_LSIPC
+usrbin_exec_PROGRAMS += lsipc
+dist_man_MANS += sys-utils/lsipc.1
@ -153,14 +153,14 @@ index 14f5f0b..1843cd5 100644 @@ -153,14 +153,14 @@ index 14f5f0b..1843cd5 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -201,7 +201,7 @@ static void do_shm (char format, int unit)
_("max seg size"), lim.shmmax, "\n", 0);
ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_KB : unit,
_("max total shared memory"),
_("max seg size"), lim.shmmax, "\n", 0);
ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_KB : unit,
_("max total shared memory"),
- lim.shmall * getpagesize(), "\n", 0);
+ (uint64_t) lim.shmall * getpagesize(), "\n", 0);
ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_BYTES : unit,
_("min seg size"), lim.shmmin, "\n", 0);
return;
ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_BYTES : unit,
_("min seg size"), lim.shmmin, "\n", 0);
return;
diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c
index 62d7428..51fce7b 100644
--- a/sys-utils/ipcutils.c
@ -168,58 +168,58 @@ index 62d7428..51fce7b 100644 @@ -168,58 +168,58 @@ index 62d7428..51fce7b 100644
@@ -1,4 +1,3 @@
-
#include <inttypes.h>

#include "c.h"
@@ -54,8 +53,8 @@ int ipc_sem_get_limits(struct ipc_limits *lim)

}

}
- if (rc == 4) {
- struct seminfo seminfo;
+ if (rc != 4) {
+ struct seminfo seminfo = { .semmni = 0 };
union semun arg = { .array = (ushort *) &seminfo };

if (semctl(0, 0, IPC_INFO, arg) < 0)
union semun arg = { .array = (ushort *) &seminfo };
if (semctl(0, 0, IPC_INFO, arg) < 0)
@@ -82,12 +81,15 @@ int ipc_shm_get_limits(struct ipc_limits *lim)
lim->shmmni = path_read_u64(_PATH_PROC_IPC_SHMMNI);

} else {
lim->shmmni = path_read_u64(_PATH_PROC_IPC_SHMMNI);
} else {
- struct shminfo shminfo;
+ struct shminfo *shminfo;
+ struct shmid_ds shmbuf;

- if (shmctl(0, IPC_INFO, (struct shmid_ds *) &shminfo) < 0)
+ if (shmctl(0, IPC_INFO, &shmbuf) < 0)
return 1;
return 1;
- lim->shmmni = shminfo.shmmni;
- lim->shmall = shminfo.shmall;
+ shminfo = (struct shminfo *) &shmbuf;
+ lim->shmmni = shminfo->shmmni;
+ lim->shmall = shminfo->shmall;
+ lim->shmmax = shminfo->shmmax;
}

return 0;
}
return 0;
@@ -97,20 +99,24 @@ int ipc_shm_get_info(int id, struct shm_data **shmds)
{
FILE *f;
int i = 0, maxid;
FILE *f;
int i = 0, maxid;
+ char buf[BUFSIZ];
struct shm_data *p;
struct shm_data *p;
- struct shm_info dummy;
+ struct shmid_ds dummy;

p = *shmds = xcalloc(1, sizeof(struct shm_data));
p->next = NULL;

f = path_fopen("r", 0, _PATH_PROC_SYSV_SHM);
if (!f)
p = *shmds = xcalloc(1, sizeof(struct shm_data));
p->next = NULL;
f = path_fopen("r", 0, _PATH_PROC_SYSV_SHM);
if (!f)
- goto fallback;
+ goto shm_fallback;

while (fgetc(f) != '\n'); /* skip header */

while (fgetc(f) != '\n'); /* skip header */
- while (feof(f) == 0) {
- if (fscanf(f,
+ while (fgets(buf, sizeof(buf), f) != NULL) {
@ -227,24 +227,24 @@ index 62d7428..51fce7b 100644 @@ -227,24 +227,24 @@ index 62d7428..51fce7b 100644
+ p->shm_rss = 0xdead;
+ p->shm_swp = 0xdead;
+ if (sscanf(buf,
"%d %d %o %"SCNu64 " %u %u "
"%"SCNu64 " %u %u %u %u %"SCNi64 " %"SCNi64 " %"SCNi64
" %"SCNu64 " %"SCNu64 "\n",
"%d %d %o %"SCNu64 " %u %u "
"%"SCNu64 " %u %u %u %u %"SCNi64 " %"SCNi64 " %"SCNi64
" %"SCNu64 " %"SCNu64 "\n",
@@ -129,8 +135,8 @@ int ipc_shm_get_info(int id, struct shm_data **shmds)
&p->shm_dtim,
&p->shm_ctim,
&p->shm_rss,
&p->shm_dtim,
&p->shm_ctim,
&p->shm_rss,
- &p->shm_swp) != 16)
- continue;
+ &p->shm_swp) < 14)
+ continue; /* invalid line, skipped */

if (id > -1) {
/* ID specified */
if (id > -1) {
/* ID specified */
@@ -153,28 +159,20 @@ int ipc_shm_get_info(int id, struct shm_data **shmds)
return i;

/* Fallback; /proc or /sys file(s) missing. */
return i;
/* Fallback; /proc or /sys file(s) missing. */
-fallback:
- i = id < 0 ? 0 : id;
-
@ -253,13 +253,13 @@ index 62d7428..51fce7b 100644 @@ -253,13 +253,13 @@ index 62d7428..51fce7b 100644
- return 0;
+shm_fallback:
+ maxid = shmctl(0, SHM_INFO, &dummy);

- while (i <= maxid) {
+ for (int j = 0; j <= maxid; j++) {
int shmid;
struct shmid_ds shmseg;
struct ipc_perm *ipcp = &shmseg.shm_perm;

int shmid;
struct shmid_ds shmseg;
struct ipc_perm *ipcp = &shmseg.shm_perm;
- shmid = shmctl(i, SHM_STAT, &shmseg);
- if (shmid < 0) {
- if (-1 < id) {
@ -269,48 +269,48 @@ index 62d7428..51fce7b 100644 @@ -269,48 +269,48 @@ index 62d7428..51fce7b 100644
- i++;
+ shmid = shmctl(j, SHM_STAT, &shmseg);
+ if (shmid < 0 || (id > -1 && shmid != id)) {
continue;
}

continue;
}
+ i++;
p->shm_perm.key = ipcp->KEY;
p->shm_perm.id = shmid;
p->shm_perm.mode = ipcp->mode;
p->shm_perm.key = ipcp->KEY;
p->shm_perm.id = shmid;
p->shm_perm.mode = ipcp->mode;
@@ -196,11 +194,12 @@ fallback:
p->next = xcalloc(1, sizeof(struct shm_data));
p = p->next;
p->next = NULL;
p->next = xcalloc(1, sizeof(struct shm_data));
p = p->next;
p->next = NULL;
- i++;
} else
} else
- return 1;
+ break;
}

}
+ if (i == 0)
+ free(*shmds);
return i;
return i;
}

@@ -299,30 +298,22 @@ int ipc_sem_get_info(int id, struct sem_data **semds)
return i;

/* Fallback; /proc or /sys file(s) missing. */
return i;
/* Fallback; /proc or /sys file(s) missing. */
- sem_fallback:
- i = id < 0 ? 0 : id;
-
+sem_fallback:
arg.array = (ushort *) (void *)&dummy;
maxid = semctl(0, 0, SEM_INFO, arg);
arg.array = (ushort *) (void *)&dummy;
maxid = semctl(0, 0, SEM_INFO, arg);
- if (maxid < 0)
- return 0;

- while (i <= maxid) {
+ for (int j = 0; j <= maxid; j++) {
int semid;
struct semid_ds semseg;
struct ipc_perm *ipcp = &semseg.sem_perm;
arg.buf = (struct semid_ds *)&semseg;

int semid;
struct semid_ds semseg;
struct ipc_perm *ipcp = &semseg.sem_perm;
arg.buf = (struct semid_ds *)&semseg;
- semid = semctl(i, 0, SEM_STAT, arg);
- if (semid < 0) {
- if (-1 < id) {
@ -320,42 +320,42 @@ index 62d7428..51fce7b 100644 @@ -320,42 +320,42 @@ index 62d7428..51fce7b 100644
- i++;
+ semid = semctl(j, 0, SEM_STAT, arg);
+ if (semid < 0 || (id > -1 && semid != id)) {
continue;
}

continue;
}
+ i++;
p->sem_perm.key = ipcp->KEY;
p->sem_perm.id = semid;
p->sem_perm.mode = ipcp->mode;
p->sem_perm.key = ipcp->KEY;
p->sem_perm.id = semid;
p->sem_perm.mode = ipcp->mode;
@@ -341,10 +332,12 @@ int ipc_sem_get_info(int id, struct sem_data **semds)
i++;
} else {
get_sem_elements(p);
i++;
} else {
get_sem_elements(p);
- return 1;
+ break;
}
}

}
}
+ if (i == 0)
+ free(*semds);
return i;
return i;
}

@@ -398,10 +391,6 @@ int ipc_msg_get_info(int id, struct msg_data **msgds)
if (id > -1) {
/* ID specified */
if (id == p->msg_perm.id) {
if (id > -1) {
/* ID specified */
if (id == p->msg_perm.id) {
- /*
- * FIXME: q_qbytes are not in /proc
- *
- */
if (msgctl(id, IPC_STAT, &msgseg) != -1)
p->q_qbytes = msgseg.msg_qbytes;
i = 1;
if (msgctl(id, IPC_STAT, &msgseg) != -1)
p->q_qbytes = msgseg.msg_qbytes;
i = 1;
@@ -422,27 +411,19 @@ int ipc_msg_get_info(int id, struct msg_data **msgds)
return i;

/* Fallback; /proc or /sys file(s) missing. */
return i;
/* Fallback; /proc or /sys file(s) missing. */
- msg_fallback:
- i = id < 0 ? 0 : id;
-
@ -364,12 +364,12 @@ index 62d7428..51fce7b 100644 @@ -364,12 +364,12 @@ index 62d7428..51fce7b 100644
- return 0;
+msg_fallback:
+ maxid = msgctl(0, MSG_INFO, &dummy);

- while (i <= maxid) {
+ for (int j = 0; j <= maxid; j++) {
int msgid;
struct ipc_perm *ipcp = &msgseg.msg_perm;

int msgid;
struct ipc_perm *ipcp = &msgseg.msg_perm;
- msgid = msgctl(i, MSG_STAT, &msgseg);
- if (msgid < 0) {
- if (-1 < id) {
@ -379,55 +379,55 @@ index 62d7428..51fce7b 100644 @@ -379,55 +379,55 @@ index 62d7428..51fce7b 100644
- i++;
+ msgid = msgctl(j, MSG_STAT, &msgseg);
+ if (msgid < 0 || (id > -1 && msgid != id)) {
continue;
}

continue;
}
+ i++;
p->msg_perm.key = ipcp->KEY;
p->msg_perm.id = msgid;
p->msg_perm.mode = ipcp->mode;
p->msg_perm.key = ipcp->KEY;
p->msg_perm.id = msgid;
p->msg_perm.mode = ipcp->mode;
@@ -463,11 +444,12 @@ int ipc_msg_get_info(int id, struct msg_data **msgds)
p->next = xcalloc(1, sizeof(struct msg_data));
p = p->next;
p->next = NULL;
p->next = xcalloc(1, sizeof(struct msg_data));
p = p->next;
p->next = NULL;
- i++;
} else
} else
- return 1;
+ break;
}

}
+ if (i == 0)
+ free(*msgds);
return i;
return i;
}

@@ -508,10 +490,10 @@ void ipc_print_perms(FILE *f, struct ipc_stat *is)
fprintf(f, " %-10u\n", is->gid);
fprintf(f, " %-10u\n", is->gid);
}

-void ipc_print_size(int unit, char *msg, size_t size, const char *end,
+void ipc_print_size(int unit, char *msg, uint64_t size, const char *end,
int width)
int width)
{
- char format[16];
+ char format[32];

if (!msg)
/* NULL */ ;
if (!msg)
/* NULL */ ;
@@ -527,11 +509,11 @@ void ipc_print_size(int unit, char *msg, size_t size, const char *end,
switch (unit) {
case IPC_UNIT_DEFAULT:
case IPC_UNIT_BYTES:
switch (unit) {
case IPC_UNIT_DEFAULT:
case IPC_UNIT_BYTES:
- sprintf(format, "%%%dzu", width);
+ sprintf(format, "%%%dju", width);
printf(format, size);
break;
case IPC_UNIT_KB:
printf(format, size);
break;
case IPC_UNIT_KB:
- sprintf(format, "%%%dzu", width);
+ sprintf(format, "%%%dju", width);
printf(format, size / 1024);
break;
case IPC_UNIT_HUMAN:
printf(format, size / 1024);
break;
case IPC_UNIT_HUMAN:
diff --git a/sys-utils/ipcutils.h b/sys-utils/ipcutils.h
index d2e5972..444065a 100644
--- a/sys-utils/ipcutils.h
@ -437,13 +437,13 @@ index d2e5972..444065a 100644 @@ -437,13 +437,13 @@ index d2e5972..444065a 100644
#include <grp.h>
#include <pwd.h>
+#include <stdint.h>

/*
* SHM_DEST and SHM_LOCKED are defined in kernel headers, but inside
@@ -34,11 +35,11 @@
# define SHM_INFO 14
struct shm_info {
int used_ids;
int used_ids;
- ulong shm_tot; /* total allocated shm */
- ulong shm_rss; /* total resident shm */
- ulong shm_swp; /* total swapped shm */
@ -456,14 +456,14 @@ index d2e5972..444065a 100644 @@ -456,14 +456,14 @@ index d2e5972..444065a 100644
+ unsigned long swap_successes;
};
#endif

@@ -118,7 +119,7 @@ struct ipc_stat {
};

extern void ipc_print_perms(FILE *f, struct ipc_stat *is);
-extern void ipc_print_size(int unit, char *msg, size_t size, const char *end, int width);
+extern void ipc_print_size(int unit, char *msg, uint64_t size, const char *end, int width);

/* See 'struct shmid_kernel' in kernel sources
*/
diff --git a/sys-utils/lsipc.1 b/sys-utils/lsipc.1
@ -1933,7 +1933,7 @@ index 123f6c3..b2d493c 100644 @@ -1933,7 +1933,7 @@ index 123f6c3..b2d493c 100644
+++ b/tests/functions.sh
@@ -50,16 +50,25 @@ function ts_skip_nonroot {
}

function ts_failed_subtest {
+ local msg="FAILED"
+ local ret=1
@ -1942,32 +1942,32 @@ index 123f6c3..b2d493c 100644 @@ -1942,32 +1942,32 @@ index 123f6c3..b2d493c 100644
+ ret=0
+ fi
+
if [ x"$1" == x"" ]; then
if [ x"$1" == x"" ]; then
- echo " FAILED ($TS_NS)"
+ echo " $msg ($TS_NS)"
else
else
- echo " FAILED ($1)"
+ echo " $msg ($1)"
fi
fi
+
+ return $ret
}

function ts_failed {
ts_failed_subtest "$1"
ts_failed_subtest "$1"
- exit 1
+ exit $?
}

function ts_ok_subtest {
@@ -150,6 +159,7 @@ function ts_init_env {
TS_SUBDIR=$(dirname $TS_SCRIPT)
TS_TESTNAME=$(basename $TS_SCRIPT)
TS_COMPONENT=$(basename $TS_SUBDIR)
TS_SUBDIR=$(dirname $TS_SCRIPT)
TS_TESTNAME=$(basename $TS_SCRIPT)
TS_COMPONENT=$(basename $TS_SUBDIR)
+ TS_KNOWN_FAIL="no"

TS_NSUBTESTS=0
TS_NSUBFAILED=0
TS_NSUBTESTS=0
TS_NSUBFAILED=0
diff --git a/tests/ts/ipcs/limits2 b/tests/ts/ipcs/limits2
index f99a354..63f834d 100755
--- a/tests/ts/ipcs/limits2
@ -1975,17 +1975,17 @@ index f99a354..63f834d 100755 @@ -1975,17 +1975,17 @@ index f99a354..63f834d 100755
@@ -16,15 +16,20 @@
# GNU General Public License for more details.
#

-TS_TOPDIR="$(dirname $0)/../.."
+TS_TOPDIR="${0%/*}/../.."
TS_DESC="basic limits"

. $TS_TOPDIR/functions.sh
ts_init "$*"
-type bc >/dev/null 2>&1 || ts_skip "cannot find bc command"

. $TS_SELF/functions.sh

+# TODO https://github.com/karelzak/util-linux/issues/51
+SHMALL=$(</proc/sys/kernel/shmall)
+if [ $(bc <<<"(2^64 / $PAGE_SIZE) <= $SHMALL") -eq 1 ]; then
@ -1994,6 +1994,7 @@ index f99a354..63f834d 100755 @@ -1994,6 +1994,7 @@ index f99a354..63f834d 100755
+
ts_log "check for difference between kernel and IPC"
ipcs_limits_check >> $TS_OUTPUT

--
--
2.7.4


155
SOURCES/0079-blkdiscard-backport-zeroout-support.patch

@ -22,14 +22,14 @@ index 310cdfb..fb3cb1e 100644 @@ -22,14 +22,14 @@ index 310cdfb..fb3cb1e 100644
--- a/bash-completion/blkdiscard
+++ b/bash-completion/blkdiscard
@@ -15,7 +15,7 @@ _blkdiscard_module()
esac
case $cur in
-*)
esac
case $cur in
-*)
- OPTS="--offset --length --secure --verbose --help --version"
+ OPTS="--offset --length --secure --zeroout --verbose --help --version"
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
return 0
;;
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
return 0
;;
diff --git a/sys-utils/blkdiscard.8 b/sys-utils/blkdiscard.8
index 5e094d4..71180e9 100644
--- a/sys-utils/blkdiscard.8
@ -67,17 +67,17 @@ index 92ca52a..0ba99ee 100644 @@ -67,17 +67,17 @@ index 92ca52a..0ba99ee 100644
+++ b/sys-utils/blkdiscard.c
@@ -44,43 +44,95 @@
#include "closestream.h"

#ifndef BLKDISCARD
-#define BLKDISCARD _IO(0x12,119)
+# define BLKDISCARD _IO(0x12,119)
#endif

#ifndef BLKSECDISCARD
-#define BLKSECDISCARD _IO(0x12,125)
+# define BLKSECDISCARD _IO(0x12,125)
#endif

-#define print_stats(path, stats) \
- printf(_("%s: Discarded %" PRIu64 " bytes from the " \
- "offset %" PRIu64"\n"), path, stats[1], stats[0]);
@ -128,17 +128,17 @@ index 92ca52a..0ba99ee 100644 @@ -128,17 +128,17 @@ index 92ca52a..0ba99ee 100644
+ break;
+ }
+}

static void __attribute__((__noreturn__)) usage(FILE *out)
{
fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <device>\n"), program_invocation_short_name);
fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <device>\n"), program_invocation_short_name);
+
+ fputs(USAGE_SEPARATOR, out);
+ fputs(_("Discard the content of sectors on a device.\n"), out);
+
fputs(USAGE_OPTIONS, out);
fputs(USAGE_OPTIONS, out);
- fputs(_(" -o, --offset <num> offset in bytes to discard from\n"
- " -l, --length <num> length of bytes to discard from the offset\n"
- " -p, --step <num> size of the discard iterations within the offset\n"
@ -152,82 +152,82 @@ index 92ca52a..0ba99ee 100644 @@ -152,82 +152,82 @@ index 92ca52a..0ba99ee 100644
+ fputs(_(" -z, --zeroout zero-fill rather than discard\n"), out);
+ fputs(_(" -v, --verbose print aligned length and offset\n"), out);
+
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
+
fprintf(out, USAGE_MAN_TAIL("blkdiscard(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
fprintf(out, USAGE_MAN_TAIL("blkdiscard(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}

+
int main(int argc, char **argv)
{
char *path;
char *path;
- int c, fd, verbose = 0, secure = 0, secsize;
+ int c, fd, verbose = 0, secsize;
uint64_t end, blksize, step, range[2], stats[2];
struct stat sb;
uint64_t end, blksize, step, range[2], stats[2];
struct stat sb;
- struct timespec now, last;
+ struct timeval now, last;
+ int act = ACT_DISCARD;

static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
static const struct option longopts[] = {
{ "help", 0, 0, 'h' },
@@ -90,6 +142,7 @@ int main(int argc, char **argv)
{ "step", 1, 0, 'p' },
{ "secure", 0, 0, 's' },
{ "verbose", 0, 0, 'v' },
{ "step", 1, 0, 'p' },
{ "secure", 0, 0, 's' },
{ "verbose", 0, 0, 'v' },
+ { "zeroout", 0, 0, 'z' },
{ NULL, 0, 0, 0 }
};

{ NULL, 0, 0, 0 }
};
@@ -102,7 +155,7 @@ int main(int argc, char **argv)
range[1] = ULLONG_MAX;
step = 0;

range[1] = ULLONG_MAX;
step = 0;
- while ((c = getopt_long(argc, argv, "hVsvo:l:p:", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "hVsvo:l:p:z", longopts, NULL)) != -1) {
switch(c) {
case 'h':
usage(stdout);
switch(c) {
case 'h':
usage(stdout);
@@ -123,11 +176,14 @@ int main(int argc, char **argv)
_("failed to parse step"));
break;
case 's':
_("failed to parse step"));
break;
case 's':
- secure = 1;
+ act = ACT_SECURE;
break;
case 'v':
verbose = 1;
break;
break;
case 'v':
verbose = 1;
break;
+ case 'z':
+ act = ACT_ZEROOUT;
+ break;
default:
usage(stderr);
break;
default:
usage(stderr);
break;
@@ -149,7 +205,7 @@ int main(int argc, char **argv)
err(EXIT_FAILURE, _("cannot open %s"), path);

if (fstat(fd, &sb) == -1)
err(EXIT_FAILURE, _("cannot open %s"), path);
if (fstat(fd, &sb) == -1)
- err(EXIT_FAILURE, _("stat failed %s"), path);
+ err(EXIT_FAILURE, _("stat of %s failed"), path);
if (!S_ISBLK(sb.st_mode))
errx(EXIT_FAILURE, _("%s: not a block device"), path);

if (!S_ISBLK(sb.st_mode))
errx(EXIT_FAILURE, _("%s: not a block device"), path);
@@ -178,35 +234,43 @@ int main(int argc, char **argv)
"to sector size %i"), path, range[1], secsize);

stats[0] = range[0], stats[1] = 0;
"to sector size %i"), path, range[1], secsize);
stats[0] = range[0], stats[1] = 0;
- clock_gettime(CLOCK_MONOTONIC, &last);
+ gettime_monotonic(&last);

- for (range[0] = range[0]; range[0] < end; range[0] += range[1]) {
+ for (/* nothing */; range[0] < end; range[0] += range[1]) {
if (range[0] + range[1] > end)
range[1] = end - range[0];

if (range[0] + range[1] > end)
range[1] = end - range[0];
- if (secure) {
+ switch (act) {
+ case ACT_ZEROOUT:
@ -235,21 +235,21 @@ index 92ca52a..0ba99ee 100644 @@ -235,21 +235,21 @@ index 92ca52a..0ba99ee 100644
+ err(EXIT_FAILURE, _("%s: BLKZEROOUT ioctl failed"), path);
+ break;
+ case ACT_SECURE:
if (ioctl(fd, BLKSECDISCARD, &range))
err(EXIT_FAILURE, _("%s: BLKSECDISCARD ioctl failed"), path);
if (ioctl(fd, BLKSECDISCARD, &range))
err(EXIT_FAILURE, _("%s: BLKSECDISCARD ioctl failed"), path);
- } else {
+ break;
+ case ACT_DISCARD:
if (ioctl(fd, BLKDISCARD, &range))
err(EXIT_FAILURE, _("%s: BLKDISCARD ioctl failed"), path);
if (ioctl(fd, BLKDISCARD, &range))
err(EXIT_FAILURE, _("%s: BLKDISCARD ioctl failed"), path);
+ break;
}

}
- /* reporting progress */
+ stats[1] += range[1];
+
+ /* reporting progress at most once per second */
if (verbose && step) {
if (verbose && step) {
- clock_gettime(CLOCK_MONOTONIC, &now);
- if (last.tv_sec < now.tv_sec) {
- print_stats(path, stats);
@ -259,19 +259,20 @@ index 92ca52a..0ba99ee 100644 @@ -259,19 +259,20 @@ index 92ca52a..0ba99ee 100644
+ (now.tv_usec >= last.tv_usec || now.tv_sec > last.tv_sec + 1)) {
+ print_stats(act, path, stats);
+ stats[0] += stats[1], stats[1] = 0;
last = now;
}
}
last = now;
}
}
-
- stats[1] += range[1];
}

}
- if (verbose)
- print_stats(path, stats);
+ if (verbose && stats[1])
+ print_stats(act, path, stats);

close(fd);
return EXIT_SUCCESS;
--
close(fd);
return EXIT_SUCCESS;
--
2.7.4


77
SOURCES/0080-sulogin-and-agetty-virtual-consoles-support-xvc-and-.patch

@ -24,7 +24,7 @@ index 32ae9a2..bbd67b3 100644 @@ -24,7 +24,7 @@ index 32ae9a2..bbd67b3 100644
@@ -49,6 +49,11 @@
# include <selinux/get_context_list.h>
#endif

+#ifdef __linux__
+# include <sys/kd.h>
+# include <sys/param.h>
@ -34,9 +34,9 @@ index 32ae9a2..bbd67b3 100644 @@ -34,9 +34,9 @@ index 32ae9a2..bbd67b3 100644
#include "closestream.h"
#include "nls.h"
@@ -93,10 +98,14 @@ static void tcinit(struct console *con)
return;
}

return;
}
- /* Handle serial lines here */
- if (ioctl(fd, TIOCMGET, (char *) &mode) == 0) {
+ /* Handle lines other than virtual consoles here */
@ -44,58 +44,58 @@ index 32ae9a2..bbd67b3 100644 @@ -44,58 +44,58 @@ index 32ae9a2..bbd67b3 100644
+ if (ioctl(fd, KDGKBMODE, &mode) < 0)
+#endif
+ {
speed_t ispeed, ospeed;
struct winsize ws;
speed_t ispeed, ospeed;
struct winsize ws;
+ errno = 0;

/* this is a modem line */
con->flags |= CON_SERIAL;
/* this is a modem line */
con->flags |= CON_SERIAL;
@@ -142,9 +151,7 @@ static void tcinit(struct console *con)
goto setattr;
}
goto setattr;
}
#if defined(IUTF8) && defined(KDGKBMODE)
- /* Detect mode of current keyboard setup, e.g. for UTF-8 */
- if (ioctl(fd, KDGKBMODE, &mode) < 0)
- mode = K_RAW;
+ /* Handle mode of current keyboard setup, e.g. for UTF-8 */
switch(mode) {
case K_UNICODE:
setlocale(LC_CTYPE, "C.UTF-8");
switch(mode) {
case K_UNICODE:
setlocale(LC_CTYPE, "C.UTF-8");
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index c7af154..5692126 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -134,6 +134,7 @@ struct options {
int nice; /* Run login with this priority */
int numspeed; /* number of baud rates to try */
int clocal; /* CLOCAL_MODE_* */
int nice; /* Run login with this priority */
int numspeed; /* number of baud rates to try */
int clocal; /* CLOCAL_MODE_* */
+ int kbmode; /* Keyboard mode if virtual console */
speed_t speeds[MAX_SPEED]; /* baud rates to be tried */
speed_t speeds[MAX_SPEED]; /* baud rates to be tried */
};

@@ -886,7 +887,7 @@ static void update_utmp(struct options *op)
static void open_tty(char *tty, struct termios *tp, struct options *op)
{
const pid_t pid = getpid();
const pid_t pid = getpid();
- int serial, closed = 0;
+ int closed = 0;

/* Set up new standard input, unless we are given an already opened port. */

/* Set up new standard input, unless we are given an already opened port. */
@@ -1016,15 +1017,18 @@ static void open_tty(char *tty, struct termios *tp, struct options *op)

/*
* Detect if this is a virtual console or serial/modem line.
/*
* Detect if this is a virtual console or serial/modem line.
- * In case of a virtual console the ioctl TIOCMGET fails and
- * the error number will be set to EINVAL.
+ * In case of a virtual console the ioctl KDGKBMODE succeeds
+ * whereas on other lines it will fails.
*/
*/
- if (ioctl(STDIN_FILENO, TIOCMGET, &serial) < 0 && (errno == EINVAL)) {
+ if (ioctl(STDIN_FILENO, KDGKBMODE, &op->kbmode) == 0) {
op->flags |= F_VCONSOLE;
if (!op->term)
op->term = DEFAULT_VCTERM;
op->flags |= F_VCONSOLE;
if (!op->term)
op->term = DEFAULT_VCTERM;
- } else if (!op->term)
- op->term = DEFAULT_STERM;
+ } else {
@ -103,12 +103,12 @@ index c7af154..5692126 100644 @@ -103,12 +103,12 @@ index c7af154..5692126 100644
+ if (!op->term)
+ op->term = DEFAULT_STERM;
+ }

setenv("TERM", op->term, 1);
setenv("TERM", op->term, 1);
}
@@ -1037,12 +1041,7 @@ static void termio_init(struct options *op, struct termios *tp)

if (op->flags & F_VCONSOLE) {
if (op->flags & F_VCONSOLE) {
#if defined(IUTF8) && defined(KDGKBMODE)
- int mode;
-
@ -117,8 +117,9 @@ index c7af154..5692126 100644 @@ -117,8 +117,9 @@ index c7af154..5692126 100644
- mode = K_RAW;
- switch(mode) {
+ switch(op->kbmode) {
case K_UNICODE:
setlocale(LC_CTYPE, "C.UTF-8");
op->flags |= F_UTF8;
--
case K_UNICODE:
setlocale(LC_CTYPE, "C.UTF-8");
op->flags |= F_UTF8;
--
2.7.4


201
SOURCES/0081-chrt-backport-DEADLINE-scheduler-support.patch

@ -45,18 +45,18 @@ index fe0a011..266ef08 100644 @@ -45,18 +45,18 @@ index fe0a011..266ef08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -338,6 +338,8 @@ AC_CHECK_FUNCS([ \
scandirat \
setresgid \
setresuid \
scandirat \
setresgid \
setresuid \
+ sched_setattr \
+ sched_setscheduler \
sigqueue \
srandom \
strnchr \
sigqueue \
srandom \
strnchr \
@@ -1383,6 +1385,20 @@ UL_REQUIRES_SYSCALL_CHECK([taskset],
AM_CONDITIONAL(BUILD_TASKSET, test "x$build_taskset" = xyes)


+have_schedsetter=no
+AS_IF([test "x$ac_cv_func_sched_setscheduler" = xyes], [have_schedsetter=yes],
+ [test "x$ac_cv_func_sched_setattr" = xyes], [have_schedsetter=yes])
@ -75,12 +75,12 @@ index fe0a011..266ef08 100644 @@ -75,12 +75,12 @@ index fe0a011..266ef08 100644
AS_HELP_STRING([--disable-wall], [do not build wall]),
[], enable_wall=yes
@@ -1562,7 +1578,6 @@ AC_ARG_VAR([SOLIB_LDFLAGS],

LIBS=""

-
AC_CONFIG_HEADERS(config.h)

#
diff --git a/m4/ul.m4 b/m4/ul.m4
index c0082d0..db44589 100644
@ -97,7 +97,7 @@ index c0082d0..db44589 100644 @@ -97,7 +97,7 @@ index c0082d0..db44589 100644
@@ -266,13 +265,6 @@ AC_DEFUN([UL_REQUIRES_SYSCALL_CHECK], [
m4_define([suffix], m4_default([$4],$1))
m4_define([callname], m4_default([$3],$1))

- dnl This is default, $3 will redefine the condition
- dnl
- dnl TODO: remove this junk, AM_CONDITIONAL should not be used for any HAVE_*
@ -115,7 +115,7 @@ index 20df6fa..edae0d9 100644 @@ -115,7 +115,7 @@ index 20df6fa..edae0d9 100644
@@ -1,13 +1,11 @@
/*
- * chrt.c - chrt
- * Command-line utility for manipulating a task's real-time attributes
- * Command-line utility for manipulating a task's real-time attributes
+ * chrt.c - manipulate a task's real-time attributes
*
- * Robert Love <rml@tech9.net>
@ -133,25 +133,25 @@ index 20df6fa..edae0d9 100644 @@ -133,25 +133,25 @@ index 20df6fa..edae0d9 100644
@@ -50,108 +48,260 @@
# define SCHED_IDLE 5
#endif

+/* flag by sched_getscheduler() */
#if defined(__linux__) && !defined(SCHED_RESET_ON_FORK)
-#define SCHED_RESET_ON_FORK 0x40000000
+# define SCHED_RESET_ON_FORK 0x40000000
#endif

+/* flag by sched_getattr() */
+#if defined(__linux__) && !defined(SCHED_FLAG_RESET_ON_FORK)
+# define SCHED_FLAG_RESET_ON_FORK 0x01
+#endif

-static void __attribute__((__noreturn__)) show_usage(int rc)
-{
- FILE *out = rc == EXIT_SUCCESS ? stdout : stderr;
+#if defined (__linux__) && !defined(HAVE_SCHED_SETATTR)
+# include <sys/syscall.h>
+#endif

- fprintf(out, _(
- "\nchrt - manipulate real-time attributes of a process\n"
- "\nSet policy:\n"
@ -170,7 +170,7 @@ index 20df6fa..edae0d9 100644 @@ -170,7 +170,7 @@ index 20df6fa..edae0d9 100644
+#if defined (__linux__) && !defined(SYS_sched_setattr) && defined(__NR_sched_setattr)
+# define SYS_sched_setattr __NR_sched_setattr
+#endif

-#ifdef SCHED_RESET_ON_FORK
- fprintf(out, _(
- "\nScheduling flags:\n"
@ -186,7 +186,7 @@ index 20df6fa..edae0d9 100644 @@ -186,7 +186,7 @@ index 20df6fa..edae0d9 100644
- " -p | --pid operate on existing given pid\n"
- " -v | --verbose display status information\n"
- " -V | --version output version information\n\n"));

- exit(rc);
+#if defined (__linux__) && !defined(HAVE_SCHED_SETATTR) && defined(SYS_sched_setattr)
+# define HAVE_SCHED_SETATTR
@ -212,7 +212,7 @@ index 20df6fa..edae0d9 100644 @@ -212,7 +212,7 @@ index 20df6fa..edae0d9 100644
+{
+ return syscall(SYS_sched_setattr, pid, attr, flags);
}

-static void show_rt_info(pid_t pid, int isnew)
+static int sched_getattr(pid_t pid, struct sched_attr *attr, unsigned int size, unsigned int flags)
{
@ -221,7 +221,7 @@ index 20df6fa..edae0d9 100644 @@ -221,7 +221,7 @@ index 20df6fa..edae0d9 100644
+ return syscall(SYS_sched_getattr, pid, attr, size, flags);
+}
+#endif

- /* don't display "pid 0" as that is confusing */
- if (!pid)
- pid = getpid();
@ -232,7 +232,7 @@ index 20df6fa..edae0d9 100644 @@ -232,7 +232,7 @@ index 20df6fa..edae0d9 100644
+#if defined (__linux__) && !defined(SCHED_DEADLINE) && defined(HAVE_SCHED_SETATTR)
+# define SCHED_DEADLINE 6
+#endif

- policy = sched_getscheduler(pid);
- if (policy == -1)
- err(EXIT_FAILURE, _("failed to get pid %d's policy"), pid);
@ -241,7 +241,7 @@ index 20df6fa..edae0d9 100644 @@ -241,7 +241,7 @@ index 20df6fa..edae0d9 100644
+ pid_t pid;
+ int policy; /* SCHED_* */
+ int priority;

- if (isnew)
- printf(_("pid %d's new scheduling policy: "), pid);
- else
@ -259,7 +259,7 @@ index 20df6fa..edae0d9 100644 @@ -259,7 +259,7 @@ index 20df6fa..edae0d9 100644
+static void __attribute__((__noreturn__)) show_usage(int rc)
+{
+ FILE *out = rc == EXIT_SUCCESS ? stdout : stderr;

+ fputs(_("Show or change the real-time scheduling attributes of a process.\n"), out);
+ fputs(USAGE_SEPARATOR, out);
+ fputs(_("Set policy:\n"
@ -302,37 +302,37 @@ index 20df6fa..edae0d9 100644 @@ -302,37 +302,37 @@ index 20df6fa..edae0d9 100644
+
+static const char *get_policy_name(int policy)
+{
switch (policy) {
case SCHED_OTHER:
switch (policy) {
case SCHED_OTHER:
- printf("SCHED_OTHER\n");
- break;
+ return "SCHED_OTHER";
case SCHED_FIFO:
case SCHED_FIFO:
- printf("SCHED_FIFO\n");
- break;
#ifdef SCHED_RESET_ON_FORK
case SCHED_FIFO | SCHED_RESET_ON_FORK:
case SCHED_FIFO | SCHED_RESET_ON_FORK:
- printf("SCHED_FIFO|SCHED_RESET_ON_FORK\n");
- break;
#endif
+ return "SCHED_FIFO";
#ifdef SCHED_IDLE
case SCHED_IDLE:
case SCHED_IDLE:
- printf("SCHED_IDLE\n");
- break;
+ return "SCHED_IDLE";
#endif
case SCHED_RR:
case SCHED_RR:
- printf("SCHED_RR\n");
- break;
#ifdef SCHED_RESET_ON_FORK
case SCHED_RR | SCHED_RESET_ON_FORK:
case SCHED_RR | SCHED_RESET_ON_FORK:
- printf("SCHED_RR|SCHED_RESET_ON_FORK\n");
- break;
#endif
+ return "SCHED_RR";
#ifdef SCHED_BATCH
case SCHED_BATCH:
case SCHED_BATCH:
- printf("SCHED_BATCH\n");
- break;
+ return "SCHED_BATCH";
@ -341,7 +341,7 @@ index 20df6fa..edae0d9 100644 @@ -341,7 +341,7 @@ index 20df6fa..edae0d9 100644
+ case SCHED_DEADLINE:
+ return "SCHED_DEADLINE";
#endif
default:
default:
- warnx(_("unknown scheduling policy"));
+ break;
+ }
@ -381,7 +381,7 @@ index 20df6fa..edae0d9 100644 @@ -381,7 +381,7 @@ index 20df6fa..edae0d9 100644
+ deadline = sa.sched_deadline;
+ runtime = sa.sched_runtime;
+ period = sa.sched_period;
}
}
+#endif
+
+ /*
@ -390,13 +390,13 @@ index 20df6fa..edae0d9 100644 @@ -390,13 +390,13 @@ index 20df6fa..edae0d9 100644
+fallback:
+ if (errno == ENOSYS) {
+ struct sched_param sp;

- if (sched_getparam(pid, &sp))
- err(EXIT_FAILURE, _("failed to get pid %d's attributes"), pid);
+ policy = sched_getscheduler(pid);
+ if (policy == -1)
+ err(EXIT_FAILURE, _("failed to get pid %d's policy"), pid);

- if (isnew)
- printf(_("pid %d's new scheduling priority: %d\n"),
- pid, sp.sched_priority);
@ -421,7 +421,7 @@ index 20df6fa..edae0d9 100644 @@ -421,7 +421,7 @@ index 20df6fa..edae0d9 100644
+
+ if (ctl->altered)
+ printf(_("pid %d's new scheduling priority: %d\n"), pid, prio);
else
else
- printf(_("pid %d's current scheduling priority: %d\n"),
- pid, sp.sched_priority);
+ printf(_("pid %d's current scheduling priority: %d\n"), pid, prio);
@ -455,11 +455,11 @@ index 20df6fa..edae0d9 100644 @@ -455,11 +455,11 @@ index 20df6fa..edae0d9 100644
+ } else
+ show_sched_pid_info(ctl, ctl->pid);
}

static void show_min_max(void)
@@ -167,52 +317,116 @@ static void show_min_max(void)
#ifdef SCHED_IDLE
SCHED_IDLE,
SCHED_IDLE,
#endif
- };
- const char *names[] = {
@ -474,26 +474,26 @@ index 20df6fa..edae0d9 100644 @@ -474,26 +474,26 @@ index 20df6fa..edae0d9 100644
+#ifdef SCHED_DEADLINE
+ SCHED_DEADLINE,
#endif
};

for (i = 0; i < ARRAY_SIZE(policies); i++) {
};
for (i = 0; i < ARRAY_SIZE(policies); i++) {
- int max = sched_get_priority_max(policies[i]);
- int min = sched_get_priority_min(policies[i]);
+ int plc = policies[i];
+ int max = sched_get_priority_max(plc);
+ int min = sched_get_priority_min(plc);

if (max >= 0 && min >= 0)
if (max >= 0 && min >= 0)
- printf(_("SCHED_%s min/max priority\t: %d/%d\n"),
- names[i], min, max);
+ printf(_("%s min/max priority\t: %d/%d\n"),
+ get_policy_name(plc), min, max);
else
else
- printf(_("SCHED_%s not supported?\n"), names[i]);
+ printf(_("%s not supported?\n"), get_policy_name(plc));
}
}
}

+static int set_sched_one_by_setscheduler(struct chrt_ctl *ctl, pid_t pid)
+{
+ struct sched_param sp = { .sched_priority = ctl->priority };
@ -571,8 +571,8 @@ index 20df6fa..edae0d9 100644 @@ -571,8 +571,8 @@ index 20df6fa..edae0d9 100644
- pid_t pid = -1;
+ struct chrt_ctl _ctl = { .pid = -1 }, *ctl = &_ctl;
+ int c;

static const struct option longopts[] = {
static const struct option longopts[] = {
- { "all-tasks", 0, NULL, 'a' },
- { "batch", 0, NULL, 'b' },
- { "fifo", 0, NULL, 'f' },
@ -603,25 +603,25 @@ index 20df6fa..edae0d9 100644 @@ -603,25 +603,25 @@ index 20df6fa..edae0d9 100644
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, no_argument, NULL, 0 }
};

setlocale(LC_ALL, "");
};
setlocale(LC_ALL, "");
@@ -220,51 +434,63 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);

textdomain(PACKAGE);
atexit(close_stdout);
- while((i = getopt_long(argc, argv, "+abfiphmoRrvV", longopts, NULL)) != -1)
+ while((c = getopt_long(argc, argv, "+abdD:fiphmoP:T:rRvV", longopts, NULL)) != -1)
{
int ret = EXIT_FAILURE;

{
int ret = EXIT_FAILURE;
- switch (i) {
+ switch (c) {
case 'a':
case 'a':
- all_tasks = 1;
+ ctl->all_tasks = 1;
break;
case 'b':
break;
case 'b':
#ifdef SCHED_BATCH
- policy = SCHED_BATCH;
+ ctl->policy = SCHED_BATCH;
@ -632,40 +632,40 @@ index 20df6fa..edae0d9 100644 @@ -632,40 +632,40 @@ index 20df6fa..edae0d9 100644
+#ifdef SCHED_DEADLINE
+ ctl->policy = SCHED_DEADLINE;
#endif
break;
case 'f':
break;
case 'f':
- policy = SCHED_FIFO;
+ ctl->policy = SCHED_FIFO;
break;
case 'R':
break;
case 'R':
-#ifdef SCHED_RESET_ON_FORK
- policy_flag |= SCHED_RESET_ON_FORK;
-#endif
+ ctl->reset_on_fork = 1;
break;
case 'i':
break;
case 'i':
#ifdef SCHED_IDLE
- policy = SCHED_IDLE;
+ ctl->policy = SCHED_IDLE;
#endif
break;
case 'm':
show_min_max();
return EXIT_SUCCESS;
case 'o':
break;
case 'm':
show_min_max();
return EXIT_SUCCESS;
case 'o':
- policy = SCHED_OTHER;
+ ctl->policy = SCHED_OTHER;
break;
case 'p':
errno = 0;
break;
case 'p':
errno = 0;
- pid = strtos32_or_err(argv[argc - 1], _("invalid PID argument"));
+ ctl->pid = strtos32_or_err(argv[argc - 1], _("invalid PID argument"));
break;
case 'r':
break;
case 'r':
- policy = SCHED_RR;
+ ctl->policy = SCHED_RR;
break;
case 'v':
break;
case 'v':
- verbose = 1;
+ ctl->verbose = 1;
+ break;
@ -677,24 +677,24 @@ index 20df6fa..edae0d9 100644 @@ -677,24 +677,24 @@ index 20df6fa..edae0d9 100644
+ break;
+ case 'D':
+ ctl->deadline = strtou64_or_err(optarg, _("invalid deadline argument"));
break;
case 'V':
break;
case 'V':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
+ printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
ret = EXIT_SUCCESS;
return EXIT_SUCCESS;
case 'h':
ret = EXIT_SUCCESS;
@@ -274,61 +500,56 @@ int main(int argc, char **argv)
}
}

}
}
- if (((pid > -1) && argc - optind < 1) ||
- ((pid == -1) && argc - optind < 2))
+ if (((ctl->pid > -1) && argc - optind < 1) ||
+ ((ctl->pid == -1) && argc - optind < 2))
show_usage(EXIT_FAILURE);

show_usage(EXIT_FAILURE);
- if ((pid > -1) && (verbose || argc - optind == 1)) {
- if (all_tasks) {
- pid_t tid;
@ -710,14 +710,14 @@ index 20df6fa..edae0d9 100644 @@ -710,14 +710,14 @@ index 20df6fa..edae0d9 100644
-
+ if ((ctl->pid > -1) && (ctl->verbose || argc - optind == 1)) {
+ show_sched_info(ctl);
if (argc - optind == 1)
return EXIT_SUCCESS;
}

errno = 0;
if (argc - optind == 1)
return EXIT_SUCCESS;
}
errno = 0;
- priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
+ ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));

#ifdef SCHED_RESET_ON_FORK
- /* sanity check */
- if ((policy_flag & SCHED_RESET_ON_FORK) &&
@ -725,7 +725,7 @@ index 20df6fa..edae0d9 100644 @@ -725,7 +725,7 @@ index 20df6fa..edae0d9 100644
- errx(EXIT_FAILURE, _("SCHED_RESET_ON_FORK flag is supported for "
+ if (ctl->reset_on_fork && ctl->policy != SCHED_FIFO && ctl->policy != SCHED_RR)
+ errx(EXIT_FAILURE, _("--reset-on-fork option is supported for "
"SCHED_FIFO and SCHED_RR policies only"));
"SCHED_FIFO and SCHED_RR policies only"));
#endif
-
- policy |= policy_flag;
@ -783,8 +783,9 @@ index 20df6fa..edae0d9 100644 @@ -783,8 +783,9 @@ index 20df6fa..edae0d9 100644
+ show_sched_info(ctl);
+
+ if (!ctl->pid) {
argv += optind + 1;
execvp(argv[0], argv);
err(EXIT_FAILURE, _("failed to execute %s"), argv[0]);
--
argv += optind + 1;
execvp(argv[0], argv);
err(EXIT_FAILURE, _("failed to execute %s"), argv[0]);
--
2.7.4


25
SOURCES/0082-fdisk-backport-DOS-logical-partitions-chain-reorder.patch

@ -17,8 +17,8 @@ index fe04ac7..b7eb35a 100644 @@ -17,8 +17,8 @@ index fe04ac7..b7eb35a 100644
+++ 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))

((n) / fdisk_context_get_units_per_sector(c)) + 1 : (n))
+
+static unsigned long long
+get_abs_partition_start(struct pte *pe)
@ -37,11 +37,11 @@ index fe04ac7..b7eb35a 100644 @@ -37,11 +37,11 @@ index fe04ac7..b7eb35a 100644
+
static void warn_alignment(struct fdisk_context *cxt)
{
if (nowarn)
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
@ -152,9 +152,9 @@ index fe04ac7..b7eb35a 100644 @@ -152,9 +152,9 @@ index fe04ac7..b7eb35a 100644
+ cur->changed = 1;
+ nxt->changed = 1;
+ goto again;
}
}

}
}
- /* Stage 2: sort starting sectors */
- stage2:
- for (j = 4; j < cxt->label->nparts_max - 1; j++) {
@ -197,14 +197,15 @@ index fe04ac7..b7eb35a 100644 @@ -197,14 +197,15 @@ index fe04ac7..b7eb35a 100644
+ 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)
--
--
2.7.4


93
SOURCES/0083-tests-cleanup-tests.patch

@ -44,8 +44,8 @@ index 37dabf3..30825de 100644 @@ -44,8 +44,8 @@ index 37dabf3..30825de 100644
-I/O size (minimum/optimal): 65536 bytes / 131072 bytes
+I/O size (minimum/optimal): 65536 bytes / <removed> bytes
Disk label type: dos


diff --git a/tests/expected/blkid/md-raid1-part b/tests/expected/blkid/md-raid1-part
index f409952..3d1b38c 100644
--- a/tests/expected/blkid/md-raid1-part
@ -57,8 +57,8 @@ index f409952..3d1b38c 100644 @@ -57,8 +57,8 @@ index f409952..3d1b38c 100644
-I/O size (minimum/optimal): 512 bytes / 32768 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
Disk label type: dos


diff --git a/tests/expected/blkid/md-raid1-whole b/tests/expected/blkid/md-raid1-whole
index 8977312..8ab1da2 100644
--- a/tests/expected/blkid/md-raid1-whole
@ -70,8 +70,8 @@ index 8977312..8ab1da2 100644 @@ -70,8 +70,8 @@ index 8977312..8ab1da2 100644
-I/O size (minimum/optimal): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
Disk label type: dos


diff --git a/tests/expected/fdisk/align-512-4K b/tests/expected/fdisk/align-512-4K
index e5a28f5..7b52fd2 100644
--- a/tests/expected/fdisk/align-512-4K
@ -83,8 +83,8 @@ index e5a28f5..7b52fd2 100644 @@ -83,8 +83,8 @@ index e5a28f5..7b52fd2 100644
-I/O size (minimum/optimal): 4096 bytes / 32768 bytes
+I/O size (minimum/optimal): 4096 bytes / <removed> bytes
Disk label type: dos


diff --git a/tests/expected/fdisk/align-512-4K-63 b/tests/expected/fdisk/align-512-4K-63
index 7e236ce..302a429 100644
--- a/tests/expected/fdisk/align-512-4K-63
@ -97,7 +97,7 @@ index 7e236ce..302a429 100644 @@ -97,7 +97,7 @@ index 7e236ce..302a429 100644
+I/O size (minimum/optimal): 4096 bytes / <removed> bytes
Alignment offset: 3584 bytes
Disk label type: dos

diff --git a/tests/expected/fdisk/align-512-4K-md b/tests/expected/fdisk/align-512-4K-md
index dbbbc05..e8f6ba1 100644
--- a/tests/expected/fdisk/align-512-4K-md
@ -109,8 +109,8 @@ index dbbbc05..e8f6ba1 100644 @@ -109,8 +109,8 @@ index dbbbc05..e8f6ba1 100644
-I/O size (minimum/optimal): 4096 bytes / 32768 bytes
+I/O size (minimum/optimal): 4096 bytes / <removed> bytes
Disk label type: dos


@@ -72,7 +72,7 @@ Command (m for help):
Disk /dev/md8: 51 MB, 51249152 bytes, 100096 sectors
Units = sectors of 1 * 512 = 512 bytes
@ -118,8 +118,8 @@ index dbbbc05..e8f6ba1 100644 @@ -118,8 +118,8 @@ index dbbbc05..e8f6ba1 100644
-I/O size (minimum/optimal): 65536 bytes / 131072 bytes
+I/O size (minimum/optimal): 65536 bytes / <removed> bytes
Disk label type: dos


diff --git a/tests/expected/fdisk/align-512-512 b/tests/expected/fdisk/align-512-512
index 018322f..8e03d90 100644
--- a/tests/expected/fdisk/align-512-512
@ -131,8 +131,8 @@ index 018322f..8e03d90 100644 @@ -131,8 +131,8 @@ index 018322f..8e03d90 100644
-I/O size (minimum/optimal): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
Disk label type: dos


diff --git a/tests/expected/fdisk/align-512-512-topology b/tests/expected/fdisk/align-512-512-topology
index b3d3114..fd57f60 100644
--- a/tests/expected/fdisk/align-512-512-topology
@ -144,8 +144,8 @@ index b3d3114..fd57f60 100644 @@ -144,8 +144,8 @@ index b3d3114..fd57f60 100644
-I/O size (minimum/optimal): 512 bytes / 32768 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
Disk label type: dos


diff --git a/tests/expected/ipcs/limits b/tests/expected/ipcs/limits
index 7480a1e..e08fa54 100644
--- a/tests/expected/ipcs/limits
@ -164,9 +164,9 @@ index b2d493c..0d1c9c8 100644 @@ -164,9 +164,9 @@ index b2d493c..0d1c9c8 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -31,6 +31,17 @@ function ts_canonicalize {
fi
fi
}

+function ts_check_test_command {
+ if [ ! -x "$1" ]; then
+ ts_skip "${1##*/} not found"
@ -179,18 +179,18 @@ index b2d493c..0d1c9c8 100644 @@ -179,18 +179,18 @@ index b2d493c..0d1c9c8 100644
+}
+
function ts_skip_subtest {
echo " IGNORE ($1)"
echo " IGNORE ($1)"
}
@@ -474,14 +485,20 @@ function ts_fdisk_clean {
local DEVNAME=$(basename "$1")

# remove non comparable parts of fdisk output
local DEVNAME=$(basename "$1")
# remove non comparable parts of fdisk output
- if [ x"${DEVNAME}" != x"" ]; then
- sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
+ if [ -n "${DEVNAME}" ]; then
+ sed -i -e "s@${DEVNAME}@...@;" $TS_OUTPUT
fi

fi
- sed -i -e 's/Disk identifier:.*//g' \
- -e 's/Building a new.*//g' \
- -e 's/Welcome to fdisk.*//g' \
@ -206,31 +206,31 @@ index b2d493c..0d1c9c8 100644 @@ -206,31 +206,31 @@ index b2d493c..0d1c9c8 100644
+ -e 's@^\(I/O size (minimum/op.* bytes /\) [1-9][0-9]* @\1 <removed> @' \
+ $TS_OUTPUT
}

function ts_scsi_debug_init {
diff --git a/tests/ts/ipcs/limits b/tests/ts/ipcs/limits
index b44adb1..c4717c3 100755
--- a/tests/ts/ipcs/limits
+++ b/tests/ts/ipcs/limits
@@ -23,7 +23,7 @@ TS_DESC="limits overflow"

ts_init "$*"
ts_skip_nonroot
-type bc >/dev/null 2>&1 || ts_skip "cannot find bc command"
+ts_check_prog "bc"

. $TS_SELF/functions.sh

@@ -32,9 +32,6 @@ for i in $IPCS_IDX; do
SHM_ORG[$i]=$(cat ${IPCS_PROCFILES[$i]})
SHM_ORG[$i]=$(cat ${IPCS_PROCFILES[$i]})
done >> $TS_OUTPUT

-ts_log "check for difference between kernel and IPC"
-ipcs_limits_check >> $TS_OUTPUT
-
ts_log "maximalize kernel setting"
for i in $IPCS_IDX; do
echo ${IPCS_LIMITS[$i]} >> ${IPCS_PROCFILES[$i]}
echo ${IPCS_LIMITS[$i]} >> ${IPCS_PROCFILES[$i]}
diff --git a/tests/ts/ipcs/limits2 b/tests/ts/ipcs/limits2
index 63f834d..2eabfd2 100755
--- a/tests/ts/ipcs/limits2
@ -238,27 +238,27 @@ index 63f834d..2eabfd2 100755 @@ -238,27 +238,27 @@ index 63f834d..2eabfd2 100755
@@ -22,6 +22,8 @@ TS_DESC="basic limits"
. $TS_TOPDIR/functions.sh
ts_init "$*"

+ts_check_prog "bc"
+
. $TS_SELF/functions.sh

# TODO https://github.com/karelzak/util-linux/issues/51
diff --git a/tests/ts/libmount/context-utab b/tests/ts/libmount/context-utab
index 859fc2b..b2bfefc 100755
--- a/tests/ts/libmount/context-utab
+++ b/tests/ts/libmount/context-utab
@@ -87,14 +87,20 @@ ts_finalize_subtest


if [ -x "/sbin/mkfs.btrfs" ]; then
+
$TS_CMD_WIPEFS -a $DEVICE &> /dev/null
ts_log "Create filesystem [btrfs]"
/sbin/mkfs.btrfs -L "$LABEL" $DEVICE &> /dev/null
udevadm settle

mount -t btrfs $DEVICE $MOUNTPOINT &> /dev/null
$TS_CMD_WIPEFS -a $DEVICE &> /dev/null
ts_log "Create filesystem [btrfs]"
/sbin/mkfs.btrfs -L "$LABEL" $DEVICE &> /dev/null
udevadm settle
mount -t btrfs $DEVICE $MOUNTPOINT &> /dev/null
- /sbin/btrfsctl -S sub $MOUNTPOINT &> /dev/null
- umount $MOUNTPOINT &> /dev/null
+
@ -268,8 +268,9 @@ index 859fc2b..b2bfefc 100755 @@ -268,8 +268,9 @@ index 859fc2b..b2bfefc 100755
+ btrfs subvolume create $MOUNTPOINT/sub &> /dev/null
+ fi
+ umount $MOUNTPOINT #&> /dev/null

udevadm settle

--
udevadm settle
--
2.7.4


35
SOURCES/0084-libmount-add-support-for-bind-ro.patch

@ -25,19 +25,19 @@ index d6691eb..4df2646 100644 @@ -25,19 +25,19 @@ index d6691eb..4df2646 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -62,6 +62,10 @@ static int mnt_context_append_additional_mount(struct libmnt_context *cxt,
return 0;
return 0;
}

+/*
+ * add additional mount(2) syscall requests when necessary to set propagation flags
+ * after regular mount(2).
+ */
static int init_propagation(struct libmnt_context *cxt)
{
char *name;
char *name;
@@ -102,6 +106,41 @@ static int init_propagation(struct libmnt_context *cxt)
}

/*
+ * add additional mount(2) syscall request to implement "ro,bind", the first regular
+ * mount(2) is the "bind" operation, the second is "remount,ro,bind" call.
@ -78,9 +78,9 @@ index d6691eb..4df2646 100644 @@ -78,9 +78,9 @@ index d6691eb..4df2646 100644
*/
static int fix_optstr(struct libmnt_context *cxt)
@@ -174,6 +213,13 @@ static int fix_optstr(struct libmnt_context *cxt)
if (rc)
return rc;
}
if (rc)
return rc;
}
+ if ((cxt->mountflags & MS_BIND)
+ && (cxt->mountflags & MS_RDONLY)
+ && !(cxt->mountflags & MS_REMOUNT)) {
@ -88,16 +88,16 @@ index d6691eb..4df2646 100644 @@ -88,16 +88,16 @@ index d6691eb..4df2646 100644
+ if (rc)
+ return rc;
+ }

next = fs->fs_optstr;

next = fs->fs_optstr;
diff --git a/sys-utils/mount.8 b/sys-utils/mount.8
index 3648870..49cb281 100644
--- a/sys-utils/mount.8
+++ b/sys-utils/mount.8
@@ -388,25 +388,25 @@ or shortoption
.\" available since Linux 2.4.11.

Note that the filesystem mount options will remain the same as those
-on the original mount point, and cannot be changed by passing the -o
-option along with --bind/--rbind. The mount options can be
@ -110,7 +110,7 @@ index 3648870..49cb281 100644 @@ -110,7 +110,7 @@ index 3648870..49cb281 100644
+option along with
+.BR \-\-bind
+for example:

.RS
.br
-.B mount --bind
@ -120,7 +120,7 @@ index 3648870..49cb281 100644 @@ -120,7 +120,7 @@ index 3648870..49cb281 100644
-.I newdir
+.B mount \-\-bind,ro foo foo
.RE

-Note that behavior of the remount operation depends on the /etc/mtab file. The
-first command stores the 'bind' flag to the /etc/mtab file and the second
-command reads the flag from the file. If you have a system without the
@ -132,13 +132,13 @@ index 3648870..49cb281 100644 @@ -132,13 +132,13 @@ index 3648870..49cb281 100644
+
+The alternative (classic) way to create a read-only bind mount is to use remount
+operation, for example:

.RS
.br
@@ -417,14 +417,15 @@ command (then mount(8) does not read /etc/mtab), then you have to use bind flag
.I olddir newdir
.RE

-Note that
-.I remount,ro,bind
-will create a read-only mountpoint (VFS entry), but the original filesystem suberblock
@ -153,7 +153,8 @@ index 3648870..49cb281 100644 @@ -153,7 +153,8 @@ index 3648870..49cb281 100644
+It's impossible to change mount options recursively
+(for example with \fB -o rbind,ro\fR).
.RE

.B The move operation.
--
--
2.7.4


103
SOURCES/0085-libblkid-store-only-canonical-devnames-to-the-cache.patch

@ -39,36 +39,36 @@ index 7de84b4..8183c12 100644 @@ -39,36 +39,36 @@ index 7de84b4..8183c12 100644
--- a/libblkid/src/blkidP.h
+++ b/libblkid/src/blkidP.h
@@ -44,7 +44,7 @@ struct blkid_struct_dev
struct list_head bid_devs; /* All devices in the cache */
struct list_head bid_tags; /* All tags for this device */
blkid_cache bid_cache; /* Dev belongs to this cache */
struct list_head bid_devs; /* All devices in the cache */
struct list_head bid_tags; /* All tags for this device */
blkid_cache bid_cache; /* Dev belongs to this cache */
- char *bid_name; /* Device inode pathname */
+ char *bid_name; /* Device real pathn (as used in cache) */
char *bid_type; /* Preferred device TYPE */
int bid_pri; /* Device priority */
dev_t bid_devno; /* Device major/minor number */
char *bid_type; /* Preferred device TYPE */
int bid_pri; /* Device priority */
dev_t bid_devno; /* Device major/minor number */
@@ -53,6 +53,8 @@ struct blkid_struct_dev
unsigned int bid_flags; /* Device status bitflags */
char *bid_label; /* Shortcut to device LABEL */
char *bid_uuid; /* Shortcut to binary UUID */
unsigned int bid_flags; /* Device status bitflags */
char *bid_label; /* Shortcut to device LABEL */
char *bid_uuid; /* Shortcut to binary UUID */
+
+ char *bid_xname; /* Device path as used by application (maybe symlink..) */
};

#define BLKID_BID_FL_VERIFIED 0x0001 /* Device data validated from disk */
diff --git a/libblkid/src/dev.c b/libblkid/src/dev.c
index a4b2aea..d2fd3f4 100644
--- a/libblkid/src/dev.c
+++ b/libblkid/src/dev.c
@@ -60,16 +60,23 @@ void blkid_free_dev(blkid_dev dev)
bit_tags);
blkid_free_tag(tag);
}
bit_tags);
blkid_free_tag(tag);
}
+ free(dev->bid_xname);
free(dev->bid_name);
free(dev);
free(dev->bid_name);
free(dev);
}

/*
- * Given a blkid device, return its name
+ * Given a blkid device, return its name. The function returns the name
@ -84,7 +84,7 @@ index a4b2aea..d2fd3f4 100644 @@ -84,7 +84,7 @@ index a4b2aea..d2fd3f4 100644
+ return dev->bid_xname;
+ return dev->bid_name;
}

#ifdef CONFIG_BLKID_DEBUG
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index 497deaf..55b9594 100644
@ -92,24 +92,24 @@ index 497deaf..55b9594 100644 @@ -92,24 +92,24 @@ index 497deaf..55b9594 100644
+++ b/libblkid/src/devname.c
@@ -51,28 +51,55 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
{
blkid_dev dev = NULL, tmp;
struct list_head *p, *pnext;
blkid_dev dev = NULL, tmp;
struct list_head *p, *pnext;
+ char *cn = NULL;

if (!cache || !devname)
return NULL;

if (!cache || !devname)
return NULL;
+ /* search by name */
list_for_each(p, &cache->bic_devs) {
tmp = list_entry(p, struct blkid_struct_dev, bid_devs);
if (strcmp(tmp->bid_name, devname))
continue;
list_for_each(p, &cache->bic_devs) {
tmp = list_entry(p, struct blkid_struct_dev, bid_devs);
if (strcmp(tmp->bid_name, devname))
continue;
-
- DBG(DEVNAME, blkid_debug("found devname %s in cache", tmp->bid_name));
dev = tmp;
break;
}

dev = tmp;
break;
}
+ /* try canonicalize the name */
+ if (!dev && (cn = canonicalize_path(devname))) {
+ if (strcmp(cn, devname) != 0) {
@ -131,15 +131,15 @@ index 497deaf..55b9594 100644 @@ -131,15 +131,15 @@ index 497deaf..55b9594 100644
+ }
+ }
+
if (!dev && (flags & BLKID_DEV_CREATE)) {
if (access(devname, F_OK) < 0)
if (!dev && (flags & BLKID_DEV_CREATE)) {
if (access(devname, F_OK) < 0)
- return NULL;
+ goto done;
dev = blkid_new_dev();
if (!dev)
dev = blkid_new_dev();
if (!dev)
- return NULL;
+ goto done;
dev->bid_time = INT_MIN;
dev->bid_time = INT_MIN;
- dev->bid_name = strdup(devname);
+ if (cn) {
+ dev->bid_name = cn;
@ -148,28 +148,29 @@ index 497deaf..55b9594 100644 @@ -148,28 +148,29 @@ index 497deaf..55b9594 100644
+ } else
+ dev->bid_name = strdup(devname);
+
dev->bid_cache = cache;
list_add_tail(&dev->bid_devs, &cache->bic_devs);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
dev->bid_cache = cache;
list_add_tail(&dev->bid_devs, &cache->bic_devs);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
@@ -81,7 +108,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
if (flags & BLKID_DEV_VERIFY) {
dev = blkid_verify(cache, dev);
if (!dev || !(dev->bid_flags & BLKID_BID_FL_VERIFIED))
if (flags & BLKID_DEV_VERIFY) {
dev = blkid_verify(cache, dev);
if (!dev || !(dev->bid_flags & BLKID_BID_FL_VERIFIED))
- return dev;
+ goto done;
/*
* If the device is verified, then search the blkid
* cache for any entries that match on the type, uuid,
/*
* If the device is verified, then search the blkid
* cache for any entries that match on the type, uuid,
@@ -112,6 +139,10 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
blkid_free_dev(dev2);
}
}
blkid_free_dev(dev2);
}
}
+done:
+ if (dev)
+ DBG(DEVNAME, blkid_debug("%s requested, found %s in cache", devname, dev->bid_name));
+ free(cn);
return dev;
return dev;
}

--
--
2.7.4


51
SOURCES/0086-libblkid-avoid-recursion-in-EBR.patch

@ -18,22 +18,22 @@ index 2d4a537..563fe9a 100644 @@ -18,22 +18,22 @@ index 2d4a537..563fe9a 100644
--- a/libblkid/src/partitions/dos.c
+++ b/libblkid/src/partitions/dos.c
@@ -48,6 +48,12 @@ static int parse_dos_extended(blkid_probe pr, blkid_parttable tab,
int ct_nodata = 0; /* count ext.partitions without data partitions */
int i;

int ct_nodata = 0; /* count ext.partitions without data partitions */
int i;
+ DBG(LOWPROBE, blkid_debug("parse EBR [start=%d, size=%d]", ex_start/ssf, ex_size/ssf));
+ if (ex_start == 0) {
+ DBG(LOWPROBE, blkid_debug("Bad offset in primary extended partition -- ignore"));
+ return 0;
+ }
+
while (1) {
struct dos_partition *p, *p0;
uint32_t start, size;
while (1) {
struct dos_partition *p, *p0;
uint32_t start, size;
@@ -100,6 +106,13 @@ static int parse_dos_extended(blkid_probe pr, blkid_parttable tab,
continue;
}

continue;
}
+ /* Avoid recursive non-empty links, see ct_nodata counter */
+ if (blkid_partlist_get_partition_by_start(ls, abs_start)) {
+ DBG(LOWPROBE, blkid_debug("#%d: EBR duplicate data partition [abs start=%u] -- ignore",
@ -41,13 +41,13 @@ index 2d4a537..563fe9a 100644 @@ -41,13 +41,13 @@ index 2d4a537..563fe9a 100644
+ continue;
+ }
+
par = blkid_partlist_add_partition(ls, tab, abs_start, size);
if (!par)
return -ENOMEM;
par = blkid_partlist_add_partition(ls, tab, abs_start, size);
if (!par)
return -ENOMEM;
@@ -116,8 +129,12 @@ static int parse_dos_extended(blkid_probe pr, blkid_parttable tab,
start = dos_partition_start(p) * ssf;
size = dos_partition_size(p) * ssf;

start = dos_partition_start(p) * ssf;
size = dos_partition_size(p) * ssf;
- if (size && is_extended(p))
- break;
+ if (size && is_extended(p)) {
@ -56,17 +56,17 @@ index 2d4a537..563fe9a 100644 @@ -56,17 +56,17 @@ index 2d4a537..563fe9a 100644
+ else
+ break;
+ }
}
if (i == 4)
goto leave;
}
if (i == 4)
goto leave;
diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c
index 752fc95..9d846ff 100644
--- a/libblkid/src/partitions/partitions.c
+++ b/libblkid/src/partitions/partitions.c
@@ -928,6 +928,20 @@ blkid_partition blkid_partlist_get_partition(blkid_partlist ls, int n)
return &ls->parts[n];
return &ls->parts[n];
}

+blkid_partition blkid_partlist_get_partition_by_start(blkid_partlist ls, uint64_t start)
+{
+ int i, nparts;
@ -89,13 +89,14 @@ index 61763bf..4e99e2a 100644 @@ -89,13 +89,14 @@ index 61763bf..4e99e2a 100644
--- a/libblkid/src/partitions/partitions.h
+++ b/libblkid/src/partitions/partitions.h
@@ -20,6 +20,8 @@ extern int blkid_partlist_increment_partno(blkid_partlist ls);

extern blkid_partition blkid_partlist_get_parent(blkid_partlist ls);

+extern blkid_partition blkid_partlist_get_partition_by_start(blkid_partlist ls, uint64_t start);
+
extern int blkid_partitions_do_subprobe(blkid_probe pr,
blkid_partition parent, const struct blkid_idinfo *id);

--
blkid_partition parent, const struct blkid_idinfo *id);
--
2.7.4


61
SOURCES/0087-findmnt-fix-target-behaviour.patch

@ -19,10 +19,10 @@ index 7b0848f..6cabced 100644 @@ -19,10 +19,10 @@ index 7b0848f..6cabced 100644
+++ b/libmount/src/mountP.h
@@ -164,6 +164,7 @@ extern int mnt_get_filesystems(char ***filesystems, const char *pattern);
extern void mnt_free_filesystems(char **filesystems);

extern char *mnt_get_kernel_cmdline_option(const char *name);
+extern int mnt_stat_mountpoint(const char *target, struct stat *st);

/* tab.c */
extern int mnt_table_set_parser_fltrcb( struct libmnt_table *tb,
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
@ -30,31 +30,31 @@ index 10ee7ce..5628da6 100644 @@ -30,31 +30,31 @@ index 10ee7ce..5628da6 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -528,6 +528,7 @@ struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb,
int direction)
int direction)
{
char *mnt;
char *mnt;
+ struct stat st;

if (!tb || !path || !*path)
return NULL;
if (!tb || !path || !*path)
return NULL;
@@ -536,6 +537,9 @@ struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb,

DBG(TAB, mnt_debug_h(tb, "lookup MOUNTPOINT: '%s'", path));

DBG(TAB, mnt_debug_h(tb, "lookup MOUNTPOINT: '%s'", path));
+ if (mnt_stat_mountpoint(path, &st))
+ return NULL;
+
mnt = strdup(path);
if (!mnt)
return NULL;
mnt = strdup(path);
if (!mnt)
return NULL;
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index c13fb96..5c374b4 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -104,6 +104,15 @@ static int fstype_cmp(const void *v1, const void *v2)
return strcmp(s1, s2);
return strcmp(s1, s2);
}

+int mnt_stat_mountpoint(const char *target, struct stat *st)
+{
+#ifdef AT_NO_AUTOMOUNT
@ -78,28 +78,29 @@ index fe899db..79ef12e 100644 @@ -78,28 +78,29 @@ index fe899db..79ef12e 100644
- char *cn = NULL;
- const char *tgt = NULL, *mnt = NULL;
+ const char *tgt, *mnt = NULL;
struct libmnt_fs *fs;

/*
* Check if match pattern is mountpoint, if not use the
* real mountpoint.
*/
struct libmnt_fs *fs;
/*
* Check if match pattern is mountpoint, if not use the
* real mountpoint.
*/
- cn = mnt_resolve_path(get_match(COL_TARGET), cache);
- if (!cn)
+ tgt = mnt_resolve_path(get_match(COL_TARGET), cache);
+ if (!tgt)
return;

fs = mnt_table_find_mountpoint(tb, tgt, MNT_ITER_BACKWARD);
return;
fs = mnt_table_find_mountpoint(tb, tgt, MNT_ITER_BACKWARD);
@@ -256,9 +255,6 @@ static void enable_extra_target_match(struct libmnt_table *tb)
mnt = mnt_fs_get_target(fs);
if (mnt && strcmp(mnt, tgt) != 0)
set_match(COL_TARGET, xstrdup(mnt)); /* replace the current setting */
mnt = mnt_fs_get_target(fs);
if (mnt && strcmp(mnt, tgt) != 0)
set_match(COL_TARGET, xstrdup(mnt)); /* replace the current setting */
-
- /* replace the current setting with the real mountpoint */
- set_match(COL_TARGET, mnt);
}


--
--
2.7.4


15
SOURCES/0088-su-properly-clear-child-PID.patch

@ -15,8 +15,8 @@ index d53d690..9b3cad5 100644 @@ -15,8 +15,8 @@ index d53d690..9b3cad5 100644
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -357,21 +357,26 @@ create_watching_parent (void)
break;
}
break;
}
if (pid != (pid_t)-1)
- if (WIFSIGNALED (status))
- {
@ -40,24 +40,25 @@ index d53d690..9b3cad5 100644 @@ -40,24 +40,25 @@ index d53d690..9b3cad5 100644
+ child = (pid_t) -1;
+ }
else
status = 1;
status = 1;
}
else
status = 1;

- if (caught_signal)
+ if (caught_signal && child != (pid_t)-1)
{
fprintf (stderr, _("\nSession terminated, killing shell..."));
kill (child, SIGTERM);
@@ -379,7 +384,7 @@ create_watching_parent (void)

cleanup_pam (PAM_SUCCESS);

- if (caught_signal)
+ if (caught_signal && (child != (pid_t)-1))
{
sleep (2);
kill (child, SIGKILL);
--
--
2.7.4


15
SOURCES/0089-fdisk-fix-Blocks-column-calculation.patch

@ -14,13 +14,14 @@ index b7eb35a..6375692 100644 @@ -14,13 +14,14 @@ index b7eb35a..6375692 100644
--- a/fdisks/fdiskdoslabel.c
+++ b/fdisks/fdiskdoslabel.c
@@ -1202,7 +1202,7 @@ int dos_list_table(struct fdisk_context *cxt,
p = pe->part_table;
if (p && !is_cleared_partition(p)) {
unsigned int psects = get_nr_sects(p);
p = pe->part_table;
if (p && !is_cleared_partition(p)) {
unsigned int psects = get_nr_sects(p);
- unsigned int pblocks = psects;
+ unsigned long pblocks = psects;
unsigned int podd = 0;
struct fdisk_parttype *type =
fdisk_get_parttype_from_code(cxt, p->sys_ind);
--
unsigned int podd = 0;
struct fdisk_parttype *type =
fdisk_get_parttype_from_code(cxt, p->sys_ind);
--
2.9.3


25
SOURCES/0090-fdisk-fix-menu-for-GPT.patch

@ -14,31 +14,32 @@ index 2656711..0ec9909 100644 @@ -14,31 +14,32 @@ index 2656711..0ec9909 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -87,18 +87,21 @@ static const struct menulist_descr menulist[] = {
{'n', N_("add a new partition"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF | FDISK_DISKLABEL_GPT, 0}},
{'o', N_("change rotation speed (rpm)"), {0, FDISK_DISKLABEL_SUN}},
{'o', N_("create a new empty DOS partition table"), {~FDISK_DISKLABEL_OSF, 0}},
{'n', N_("add a new partition"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF | FDISK_DISKLABEL_GPT, 0}},
{'o', N_("change rotation speed (rpm)"), {0, FDISK_DISKLABEL_SUN}},
{'o', N_("create a new empty DOS partition table"), {~FDISK_DISKLABEL_OSF, 0}},
- {'p', N_("print the partition table"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN}},
+ {'p', N_("print the partition table"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF | FDISK_DISKLABEL_GPT,
+ FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_GPT }},
{'q', N_("quit without saving changes"), {FDISK_DISKLABEL_ANY, FDISK_DISKLABEL_ANY}},
{'q', N_("quit without saving changes"), {FDISK_DISKLABEL_ANY, FDISK_DISKLABEL_ANY}},
- {'r', N_("return to main menu"), {FDISK_DISKLABEL_OSF, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF}},
+ {'r', N_("return to main menu"), {FDISK_DISKLABEL_OSF, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF | FDISK_DISKLABEL_GPT}},
{'s', N_("change number of sectors/track"), {0, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN}},
{'s', N_("create a new empty Sun disklabel"), {~FDISK_DISKLABEL_OSF, 0}},
{'s', N_("show complete disklabel"), {FDISK_DISKLABEL_OSF, 0}},
{'t', N_("change a partition's system id"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, 0}},
{'u', N_("change display/entry units"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, 0}},
{'s', N_("change number of sectors/track"), {0, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN}},
{'s', N_("create a new empty Sun disklabel"), {~FDISK_DISKLABEL_OSF, 0}},
{'s', N_("show complete disklabel"), {FDISK_DISKLABEL_OSF, 0}},
{'t', N_("change a partition's system id"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, 0}},
{'u', N_("change display/entry units"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, 0}},
- {'v', N_("verify the partition table"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI}},
+ {'v', N_("verify the partition table"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT,
+ FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT}},
{'w', N_("write disklabel to disk"), {FDISK_DISKLABEL_OSF, 0}},
{'w', N_("write disklabel to disk"), {FDISK_DISKLABEL_OSF, 0}},
- {'w', N_("write table to disk and exit"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI}},
- {'x', N_("extra functionality (experts only)"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI, 0}},
+ {'w', N_("write table to disk and exit"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT,
+ FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT}},
+ {'x', N_("extra functionality (experts only)"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT, 0}},
#if !defined (__alpha__)
{'x', N_("link BSD partition to non-BSD partition"), {FDISK_DISKLABEL_OSF, 0}},
{'x', N_("link BSD partition to non-BSD partition"), {FDISK_DISKLABEL_OSF, 0}},
#endif
--
--
2.9.3


143
SOURCES/0091-logger-backport-size.patch

@ -37,128 +37,129 @@ index a331869..dfda018 100644 @@ -37,128 +37,129 @@ index a331869..dfda018 100644
#include "strutils.h"
+#include "xalloc.h"
+#include "all-io.h"

#define SYSLOG_NAMES
#include <syslog.h>
@@ -183,7 +185,7 @@ inet_socket(const char *servername, const char *port, const int socket_type)

static void
mysyslog(int fd, int logflags, int pri, char *tag, char *msg) {
- char buf[1000], pid[30], *cp, *tp;
+ char *buf, pid[30], *cp, *tp;
time_t now;

if (fd > -1) {
@@ -201,11 +203,11 @@ mysyslog(int fd, int logflags, int pri, char *tag, char *msg) {
(void)time(&now);
tp = ctime(&now)+4;

tp = ctime(&now)+4;
- snprintf(buf, sizeof(buf), "<%d>%.15s %.200s%s: %.400s",
+ xasprintf(&buf, "<%d>%.15s %.200s%s: %s",
pri, tp, cp, pid, msg);

pri, tp, cp, pid, msg);
- if (write(fd, buf, strlen(buf)+1) < 0)
- return; /* error */
+ write_all(fd, buf, strlen(buf)+1);
+ free(buf);
}
}

@@ -221,6 +223,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
" -i, --id log the process ID too\n"
" -f, --file <file> log the contents of this file\n"
" -h, --help display this help text and exit\n"), out);
" -i, --id log the process ID too\n"
" -f, --file <file> log the contents of this file\n"
" -h, --help display this help text and exit\n"), out);
+ fputs(_(" -S, --size <num> maximum size for a single message (default 1024)\n"), out);
fputs(_(" -n, --server <name> write to this remote syslog server\n"
" -P, --port <port> use this port for UDP or TCP connection\n"
" -p, --priority <prio> mark given message with this priority\n"
fputs(_(" -n, --server <name> write to this remote syslog server\n"
" -P, --port <port> use this port for UDP or TCP connection\n"
" -p, --priority <prio> mark given message with this priority\n"
@@ -241,11 +244,12 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
int
main(int argc, char **argv) {
int ch, logflags, pri;
int ch, logflags, pri;
- char *tag, buf[1024];
+ char *tag, *buf;
char *usock = NULL;
char *server = NULL;
char *port = NULL;
int LogSock = -1, socket_type = ALL_TYPES;
char *usock = NULL;
char *server = NULL;
char *port = NULL;
int LogSock = -1, socket_type = ALL_TYPES;
+ size_t max_message_size = 1024;

static const struct option longopts[] = {
{ "id", no_argument, 0, 'i' },
static const struct option longopts[] = {
{ "id", no_argument, 0, 'i' },
@@ -253,6 +257,7 @@ main(int argc, char **argv) {
{ "file", required_argument, 0, 'f' },
{ "priority", required_argument, 0, 'p' },
{ "tag", required_argument, 0, 't' },
{ "file", required_argument, 0, 'f' },
{ "priority", required_argument, 0, 'p' },
{ "tag", required_argument, 0, 't' },
+ { "size", required_argument, 0, 'S' },
{ "socket", required_argument, 0, 'u' },
{ "udp", no_argument, 0, 'd' },
{ "tcp", no_argument, 0, 'T' },
{ "socket", required_argument, 0, 'u' },
{ "udp", no_argument, 0, 'd' },
{ "tcp", no_argument, 0, 'T' },
@@ -271,7 +276,7 @@ main(int argc, char **argv) {
tag = NULL;
pri = LOG_NOTICE;
logflags = 0;
tag = NULL;
pri = LOG_NOTICE;
logflags = 0;
- while ((ch = getopt_long(argc, argv, "f:ip:st:u:dTn:P:Vh",
+ while ((ch = getopt_long(argc, argv, "f:ip:st:u:dTn:P:S:Vh",
longopts, NULL)) != -1) {
switch((char)ch) {
case 'f': /* file to log */
longopts, NULL)) != -1) {
switch((char)ch) {
case 'f': /* file to log */
@@ -297,6 +302,10 @@ main(int argc, char **argv) {
case 'd':
socket_type = TYPE_UDP;
break;
case 'd':
socket_type = TYPE_UDP;
break;
+ case 'S':
+ max_message_size = strtosize_or_err(optarg,
+ _("failed to parse message size"));
+ break;
case 'T':
socket_type = TYPE_TCP;
break;
case 'T':
socket_type = TYPE_TCP;
break;
@@ -327,21 +336,23 @@ main(int argc, char **argv) {
else
openlog(tag ? tag : getlogin(), logflags, 0);

else
openlog(tag ? tag : getlogin(), logflags, 0);
+ buf = xcalloc(1, max_message_size);
+
/* log input line if appropriate */
if (argc > 0) {
register char *p, *endp;
size_t len;

/* log input line if appropriate */
if (argc > 0) {
register char *p, *endp;
size_t len;
- for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) {
+ for (p = buf, endp = buf + max_message_size - 2; *argv;) {
len = strlen(*argv);
if (p + len > endp && p > buf) {
if (!usock && !server)
syslog(pri, "%s", buf);
else
mysyslog(LogSock, logflags, pri, tag, buf);
len = strlen(*argv);
if (p + len > endp && p > buf) {
if (!usock && !server)
syslog(pri, "%s", buf);
else
mysyslog(LogSock, logflags, pri, tag, buf);
- p = buf;
+ p = buf;
}
}
- if (len > sizeof(buf) - 1) {
+ if (len > max_message_size - 1) {
if (!usock && !server)
syslog(pri, "%s", *argv++);
else
if (!usock && !server)
syslog(pri, "%s", *argv++);
else
@@ -360,7 +371,7 @@ main(int argc, char **argv) {
mysyslog(LogSock, logflags, pri, tag, buf);
}
} else {
mysyslog(LogSock, logflags, pri, tag, buf);
}
} else {
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
+ while (fgets(buf, max_message_size, stdin) != NULL) {
/* glibc is buggy and adds an additional newline,
so we have to remove it here until glibc is fixed */
int len = strlen(buf);
/* glibc is buggy and adds an additional newline,
so we have to remove it here until glibc is fixed */
int len = strlen(buf);
@@ -374,6 +385,9 @@ main(int argc, char **argv) {
mysyslog(LogSock, logflags, pri, tag, buf);
}
}
mysyslog(LogSock, logflags, pri, tag, buf);
}
}
+
+ free(buf);
+
if (!usock && !server)
closelog();
else
--
if (!usock && !server)
closelog();
else
--
2.9.3


21
SOURCES/0092-fdisk-print-header-UUID-for-GPT.patch

@ -16,24 +16,24 @@ index 0ec9909..974d735 100644 @@ -16,24 +16,24 @@ index 0ec9909..974d735 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -657,6 +657,8 @@ list_disk_geometry(struct fdisk_context *cxt) {
printf(_("Disk label type: %s\n"), cxt->label->name);
if (fdisk_is_disklabel(cxt, DOS))
dos_print_mbr_id(cxt);
printf(_("Disk label type: %s\n"), cxt->label->name);
if (fdisk_is_disklabel(cxt, DOS))
dos_print_mbr_id(cxt);
+ if (fdisk_is_disklabel(cxt, GPT))
+ gpt_print_header_id(cxt);
printf("\n");
printf("\n");
}

diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
index ce42860..6711ab8 100644
--- a/libfdisk/src/fdiskP.h
+++ b/libfdisk/src/fdiskP.h
@@ -315,6 +315,7 @@ extern void fdisk_deinit_label(struct fdisk_label *lb);

/* gpt.c -- temporary bypass library API... */
extern void gpt_list_table(struct fdisk_context *cxt, int xtra);
+extern void gpt_print_header_id(struct fdisk_context *cxt);

/* ask.c */
extern int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew);
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c
@ -41,9 +41,9 @@ index d3bdc2d..899e1b2 100644 @@ -41,9 +41,9 @@ index d3bdc2d..899e1b2 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -341,6 +341,24 @@ static inline int partition_unused(const struct gpt_entry *e)
sizeof(struct gpt_guid));
sizeof(struct gpt_guid));
}

+void gpt_print_header_id(struct fdisk_context *cxt)
+{
+ char str[37];
@ -65,5 +65,6 @@ index d3bdc2d..899e1b2 100644 @@ -65,5 +65,6 @@ index d3bdc2d..899e1b2 100644
/*
* Builds a clean new valid protective MBR - will wipe out any existing data.
* Returns 0 on success, otherwise < 0 on error.
--
--
2.9.3


55
SOURCES/0093-fdisk-improve-l-error-handling.patch

@ -15,7 +15,7 @@ index 974d735..177921a 100644 @@ -15,7 +15,7 @@ index 974d735..177921a 100644
+++ b/fdisks/fdisk.c
@@ -924,11 +924,15 @@ static int is_ide_cdrom_or_tape(char *device)
}

/* Print disk geometry and partition table of a specified device (-l option) */
-static void print_partition_table_from_option(struct fdisk_context *cxt,
- char *device, unsigned long sector_size)
@ -30,46 +30,47 @@ index 974d735..177921a 100644 @@ -30,46 +30,47 @@ index 974d735..177921a 100644
+ warn(_("cannot open %s"), device);
+ return -1;
+ }

if (sector_size) /* passed -b option, override autodiscovery */
fdisk_override_sector_size(cxt, sector_size);
if (sector_size) /* passed -b option, override autodiscovery */
fdisk_override_sector_size(cxt, sector_size);
@@ -941,6 +945,8 @@ static void print_partition_table_from_option(struct fdisk_context *cxt,
list_table(cxt, 0);
else
list_disk_geometry(cxt);
list_table(cxt, 0);
else
list_disk_geometry(cxt);
+
+ return 0;
}

/*
@@ -971,7 +977,7 @@ print_all_partition_table_from_option(struct fdisk_context *cxt,
char *cn = canonicalize_path(devname);
if (cn) {
if (!is_ide_cdrom_or_tape(cn))
char *cn = canonicalize_path(devname);
if (cn) {
if (!is_ide_cdrom_or_tape(cn))
- print_partition_table_from_option(cxt, cn, sector_size);
+ print_partition_table_from_option(cxt, cn, sector_size, 0);
free(cn);
}
}
free(cn);
}
}
@@ -1223,14 +1229,17 @@ int main(int argc, char **argv)
" be used with one specified device\n"));

if (optl) {
" be used with one specified device\n"));
if (optl) {
+ int rc = 0;
+
nowarn = 1;
if (argc > optind) {
int k;
for (k = optind; k < argc; k++)
nowarn = 1;
if (argc > optind) {
int k;
for (k = optind; k < argc; k++)
- print_partition_table_from_option(cxt, argv[k], sector_size);
+ rc += print_partition_table_from_option(cxt, argv[k], sector_size, 1);
} else
print_all_partition_table_from_option(cxt, sector_size);
} else
print_all_partition_table_from_option(cxt, sector_size);
- exit(EXIT_SUCCESS);
+
+ exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
}

if (opts) {
--
}
if (opts) {
--
2.9.3


3
SOURCES/0094-losetup-improve-man-page-SYNOPSIS.patch

@ -37,5 +37,6 @@ index bd73518..9a8c1d5 100644 @@ -37,5 +37,6 @@ index bd73518..9a8c1d5 100644
.I file
.sp
.in -13
--
--
2.9.3


55
SOURCES/0095-libblkid-fix-potential-bufer-overflows.patch

@ -27,13 +27,13 @@ index 6ab0dc6..e801ea3 100644 @@ -27,13 +27,13 @@ index 6ab0dc6..e801ea3 100644
#include <stdint.h>
#include <stddef.h>
+#include <limits.h>

#include "partitions.h"
#include "crc32.h"
@@ -266,14 +267,17 @@ static struct gpt_header *get_gpt_header(
return NULL;
}

return NULL;
}
- /* Size of blocks with GPT entries */
- esz = le32_to_cpu(h->num_partition_entries) *
- le32_to_cpu(h->sizeof_partition_entry);
@ -41,17 +41,17 @@ index 6ab0dc6..e801ea3 100644 @@ -41,17 +41,17 @@ index 6ab0dc6..e801ea3 100644
+ if (le32_to_cpu(h->num_partition_entries) == 0 ||
+ le32_to_cpu(h->sizeof_partition_entry) == 0 ||
+ ULONG_MAX / le32_to_cpu(h->num_partition_entries) < le32_to_cpu(h->sizeof_partition_entry)) {
DBG(LOWPROBE, blkid_debug("GPT entries undefined"));
return NULL;
}

DBG(LOWPROBE, blkid_debug("GPT entries undefined"));
return NULL;
}
+ /* Size of blocks with GPT entries */
+ esz = le32_to_cpu(h->num_partition_entries) *
+ le32_to_cpu(h->sizeof_partition_entry);
+
/* The header seems valid, save it
* (we don't care about zeros in hdr->reserved2 area) */
memcpy(hdr, h, sizeof(*h));
/* The header seems valid, save it
* (we don't care about zeros in hdr->reserved2 area) */
memcpy(hdr, h, sizeof(*h));
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index f9fab5b..9cf099a 100644
--- a/libblkid/src/probe.c
@ -61,22 +61,22 @@ index f9fab5b..9cf099a 100644 @@ -61,22 +61,22 @@ index f9fab5b..9cf099a 100644
#include <stdint.h>
#include <stdarg.h>
+#include <limits.h>

#ifdef HAVE_LIBUUID
# include <uuid.h>
@@ -565,6 +566,12 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
return NULL;
}

return NULL;
}
+ /* someone trying to overflow some buffers? */
+ if (len > ULONG_MAX - sizeof(struct blkid_bufinfo)) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
/* allocate info and space for data by why call */
bf = calloc(1, sizeof(struct blkid_bufinfo) + len);
if (!bf) {
/* allocate info and space for data by why call */
bf = calloc(1, sizeof(struct blkid_bufinfo) + len);
if (!bf) {
diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c
index 406ba2b..56ee472 100644
--- a/libblkid/src/superblocks/zfs.c
@ -86,17 +86,18 @@ index 406ba2b..56ee472 100644 @@ -86,17 +86,18 @@ index 406ba2b..56ee472 100644
#include <ctype.h>
#include <inttypes.h>
+#include <limits.h>

#include "superblocks.h"

@@ -108,6 +109,8 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)

nvs->nvs_type = be32_to_cpu(nvs->nvs_type);
nvs->nvs_strlen = be32_to_cpu(nvs->nvs_strlen);
nvs->nvs_type = be32_to_cpu(nvs->nvs_type);
nvs->nvs_strlen = be32_to_cpu(nvs->nvs_strlen);
+ if (nvs->nvs_strlen > UINT_MAX - sizeof(*nvs))
+ break;
avail -= nvs->nvs_strlen + sizeof(*nvs);
nvdebug("nvstring: type %u string %*s\n", nvs->nvs_type,
nvs->nvs_strlen, nvs->nvs_string);
--
avail -= nvs->nvs_strlen + sizeof(*nvs);
nvdebug("nvstring: type %u string %*s\n", nvs->nvs_type,
nvs->nvs_strlen, nvs->nvs_string);
--
2.9.3


3
SOURCES/0096-umount-fix-obsolete-info-about-loop-in-umount.8.patch

@ -48,5 +48,6 @@ index 1fa653c..f0a712b 100644 @@ -48,5 +48,6 @@ index 1fa653c..f0a712b 100644
.SH NOTES
The syntax of external umount helpers is:
.PP
--
--
2.9.3


21
SOURCES/0097-mount-fix-all-and-nofail-return-code.patch

@ -20,23 +20,24 @@ index f332070..44e2b7c 100644 @@ -20,23 +20,24 @@ index f332070..44e2b7c 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -197,12 +197,14 @@ static int mount_all(struct libmnt_context *cxt)
if (mnt_context_is_verbose(cxt))
printf("%-25s: mount successfully forked\n", tgt);
} else {
if (mnt_context_is_verbose(cxt))
printf("%-25s: mount successfully forked\n", tgt);
} else {
- mk_exit_code(cxt, mntrc); /* to print warnings */
-
- if (mnt_context_get_status(cxt)) {
+ if (mk_exit_code(cxt, mntrc) == MOUNT_EX_SUCCESS) {
nsucc++;

nsucc++;
- if (mnt_context_is_verbose(cxt))
+ /* Note that MOUNT_EX_SUCCESS return code does
+ * not mean that FS has been really mounted
+ * (e.g. nofail option) */
+ if (mnt_context_get_status(cxt)
+ if (mnt_context_get_status(cxt)
+ && mnt_context_is_verbose(cxt))
printf("%-25s: successfully mounted\n", tgt);
} else
nerrs++;
--
printf("%-25s: successfully mounted\n", tgt);
} else
nerrs++;
--
2.9.3


15
SOURCES/0098-umount-exclude-selinuxfs-from-all.patch

@ -15,13 +15,14 @@ index 9c47744..48483dc 100644 @@ -15,13 +15,14 @@ index 9c47744..48483dc 100644
--- a/sys-utils/umount.c
+++ b/sys-utils/umount.c
@@ -605,7 +605,7 @@ int main(int argc, char **argv)

if (all) {
if (!types)
if (all) {
if (!types)
- types = "noproc,nodevfs,nodevpts,nosysfs,norpc_pipefs,nonfsd";
+ types = "noproc,nodevfs,nodevpts,nosysfs,norpc_pipefs,nonfsd,noselinuxfs";

mnt_context_set_fstype_pattern(cxt, types);
rc = umount_all(cxt);
--
mnt_context_set_fstype_pattern(cxt, types);
rc = umount_all(cxt);
--
2.9.3


29
SOURCES/0099-sfdisk-remove-useless-CDROM-detection-for-s.patch

@ -20,41 +20,42 @@ index 93bca27..afb15fc 100644 @@ -20,41 +20,42 @@ index 93bca27..afb15fc 100644
- int fd;
+ int fd, rc;
unsigned long long size;

fd = my_open(dev, 0, silent);
if (fd < 0)
return;

return;
- if (blkdev_get_sectors(fd, &size) == -1) {
+ rc = blkdev_get_sectors(fd, &size);
+ close(fd);
+
+ if (rc == -1) {
if (!silent) {
perror(dev);
errx(EXIT_FAILURE, _("Cannot get size of %s"), dev);
}
if (!silent) {
perror(dev);
errx(EXIT_FAILURE, _("Cannot get size of %s"), dev);
}
- goto done;
+ return;
}

size /= 2; /* convert sectors to blocks */

- /* a CDROM drive without mounted CD yields MAXINT */
- if (silent && size == ((1 << 30) - 1))
- goto done;
-
if (silent)
printf("%s: %9llu\n", dev, size);
printf("%s: %9llu\n", dev, size);
else
printf("%llu\n", size);

printf("%llu\n", size);
total_size += size;
-
-done:
- close(fd);
}

/*
--
--
2.9.3


25
SOURCES/0100-more-fix-repeat-search-crash.patch

@ -20,21 +20,22 @@ index 496b116..0e9c2bd 100644 @@ -20,21 +20,22 @@ index 496b116..0e9c2bd 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1588,6 +1588,8 @@ void search(char buf[], FILE *file, register int n)
context.line = saveln = Currline;
context.chrctr = startline;
lncount = 0;
context.line = saveln = Currline;
context.chrctr = startline;
lncount = 0;
+ if (!buf)
+ goto notfound;
if ((rc = regcomp(&re, buf, REG_NOSUB)) != 0) {
char s[REGERR_BUF];
regerror(rc, &re, s, sizeof s);
if ((rc = regcomp(&re, buf, REG_NOSUB)) != 0) {
char s[REGERR_BUF];
regerror(rc, &re, s, sizeof s);
@@ -1644,6 +1646,7 @@ void search(char buf[], FILE *file, register int n)
}
free(previousre);
previousre = NULL;
}
free(previousre);
previousre = NULL;
+notfound:
more_error(_("Pattern not found"));
}
more_error(_("Pattern not found"));
}
}
--
--
2.9.3


9
SOURCES/0101-more-avoid-double-free-on-exit.patch

@ -34,8 +34,9 @@ index 0e9c2bd..f98cb14 100644 @@ -34,8 +34,9 @@ index 0e9c2bd..f98cb14 100644
+ */
+ signal(SIGINT, SIG_IGN);
+
reset_tty();
if (clreol) {
putchar('\r');
--
reset_tty();
if (clreol) {
putchar('\r');
--
2.9.3


39
SOURCES/0102-ipcs-show-gid-instead-of-uid.patch

@ -17,31 +17,32 @@ index 1843cd5..1db7fd0 100644 @@ -17,31 +17,32 @@ index 1843cd5..1db7fd0 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -564,7 +564,7 @@ static void print_shm(int shmid, int unit)

printf(_("\nShared memory Segment shmid=%d\n"), shmid);
printf(_("uid=%u\tgid=%u\tcuid=%u\tcgid=%u\n"),
printf(_("\nShared memory Segment shmid=%d\n"), shmid);
printf(_("uid=%u\tgid=%u\tcuid=%u\tcgid=%u\n"),
- shmdata->shm_perm.uid, shmdata->shm_perm.uid,
+ shmdata->shm_perm.uid, shmdata->shm_perm.gid,
shmdata->shm_perm.cuid, shmdata->shm_perm.cgid);
printf(_("mode=%#o\taccess_perms=%#o\n"), shmdata->shm_perm.mode,
shmdata->shm_perm.mode & 0777);
shmdata->shm_perm.cuid, shmdata->shm_perm.cgid);
printf(_("mode=%#o\taccess_perms=%#o\n"), shmdata->shm_perm.mode,
shmdata->shm_perm.mode & 0777);
@@ -594,7 +594,7 @@ void print_msg(int msgid, int unit)

printf(_("\nMessage Queue msqid=%d\n"), msgid);
printf(_("uid=%u\tgid=%u\tcuid=%u\tcgid=%u\tmode=%#o\n"),
printf(_("\nMessage Queue msqid=%d\n"), msgid);
printf(_("uid=%u\tgid=%u\tcuid=%u\tcgid=%u\tmode=%#o\n"),
- msgdata->msg_perm.uid, msgdata->msg_perm.uid,
+ msgdata->msg_perm.uid, msgdata->msg_perm.gid,
msgdata->msg_perm.cuid, msgdata->msg_perm.cgid,
msgdata->msg_perm.mode);
ipc_print_size(unit, unit == IPC_UNIT_HUMAN ? _("csize=") : _("cbytes="),
msgdata->msg_perm.cuid, msgdata->msg_perm.cgid,
msgdata->msg_perm.mode);
ipc_print_size(unit, unit == IPC_UNIT_HUMAN ? _("csize=") : _("cbytes="),
@@ -627,7 +627,7 @@ static void print_sem(int semid)

printf(_("\nSemaphore Array semid=%d\n"), semid);
printf(_("uid=%u\t gid=%u\t cuid=%u\t cgid=%u\n"),
printf(_("\nSemaphore Array semid=%d\n"), semid);
printf(_("uid=%u\t gid=%u\t cuid=%u\t cgid=%u\n"),
- semdata->sem_perm.uid, semdata->sem_perm.uid,
+ semdata->sem_perm.uid, semdata->sem_perm.gid,
semdata->sem_perm.cuid, semdata->sem_perm.cgid);
printf(_("mode=%#o, access_perms=%#o\n"),
semdata->sem_perm.mode, semdata->sem_perm.mode & 0777);
--
semdata->sem_perm.cuid, semdata->sem_perm.cgid);
printf(_("mode=%#o, access_perms=%#o\n"),
semdata->sem_perm.mode, semdata->sem_perm.mode & 0777);
--
2.9.3


7
SOURCES/0103-ipcs-fix-JP-status-message.patch

@ -14,13 +14,14 @@ index 4c748de..f0d3645 100644 @@ -14,13 +14,14 @@ index 4c748de..f0d3645 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -13013,7 +13013,7 @@ msgstr "セットされていません"

#: sys-utils/ipcs.c:327
msgid "dest"
-msgstr "対象"
+msgstr "削除"

#: sys-utils/ipcs.c:328
msgid "locked"
--
--
2.9.3


37
SOURCES/0104-swapon-fix-discard-option-parsing.patch

@ -15,29 +15,30 @@ index d85b910..d4f2c08 100644 @@ -15,29 +15,30 @@ index d85b910..d4f2c08 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -632,20 +632,21 @@ static int swapon_all(void)

while (mnt_table_find_next_fs(tb, itr, match_swap, NULL, &fs) == 0) {
/* defaults */
while (mnt_table_find_next_fs(tb, itr, match_swap, NULL, &fs) == 0) {
/* defaults */
+ size_t argsz = 0;
int pri = priority, dsc = discard, nofail = ifexists;
char *p, *src, *dscarg;

if (mnt_fs_get_option(fs, "noauto", NULL, NULL) == 0)
continue;
int pri = priority, dsc = discard, nofail = ifexists;
char *p, *src, *dscarg;
if (mnt_fs_get_option(fs, "noauto", NULL, NULL) == 0)
continue;
- if (mnt_fs_get_option(fs, "discard", &dscarg, NULL) == 0) {
+ if (mnt_fs_get_option(fs, "discard", &dscarg, &argsz) == 0) {
dsc |= SWAP_FLAG_DISCARD;
if (dscarg) {
/* only single-time discards are wanted */
dsc |= SWAP_FLAG_DISCARD;
if (dscarg) {
/* only single-time discards are wanted */
- if (strcmp(dscarg, "once") == 0)
+ if (strncmp(dscarg, "once", argsz) == 0)
dsc |= SWAP_FLAG_DISCARD_ONCE;

/* do discard for every released swap page */
dsc |= SWAP_FLAG_DISCARD_ONCE;
/* do discard for every released swap page */
- if (strcmp(dscarg, "pages") == 0)
+ if (strncmp(dscarg, "pages", argsz) == 0)
dsc |= SWAP_FLAG_DISCARD_PAGES;
}
}
--
dsc |= SWAP_FLAG_DISCARD_PAGES;
}
}
--
2.9.3


89
SOURCES/0105-fallocate-Added-posix_fallocate-support.patch

@ -35,7 +35,7 @@ index 266ef08..f87a885 100644 @@ -35,7 +35,7 @@ index 266ef08..f87a885 100644
@@ -917,6 +917,34 @@ if test "x$build_fallocate" = xyes; then
AC_MSG_RESULT([no])])
fi

+AS_IF([test "x$build_fallocate" = xyes], [
+ dnl check for valid posix_fallocate() function
+ AC_MSG_CHECKING([for valid posix_fallocate() function])
@ -64,7 +64,7 @@ index 266ef08..f87a885 100644 @@ -64,7 +64,7 @@ index 266ef08..f87a885 100644
+ AC_MSG_RESULT([no])])
+])
+

AC_ARG_ENABLE([unshare],
AS_HELP_STRING([--disable-unshare], [do not build unshare]),
diff --git a/sys-utils/fallocate.1 b/sys-utils/fallocate.1
@ -104,23 +104,23 @@ index ff0f9e6..17ae5fe 100644 @@ -104,23 +104,23 @@ index ff0f9e6..17ae5fe 100644
#include "c.h"
#include "closestream.h"
+#include "optutils.h"

static void __attribute__((__noreturn__)) usage(FILE *out)
{
@@ -63,6 +64,9 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
" -p, --punch-hole punch holes in the file\n"
" -o, --offset <num> offset of the allocation, in bytes\n"
" -l, --length <num> length of the allocation, in bytes\n"), out);
" -p, --punch-hole punch holes in the file\n"
" -o, --offset <num> offset of the allocation, in bytes\n"
" -l, --length <num> length of the allocation, in bytes\n"), out);
+#ifdef HAVE_POSIX_FALLOCATE
+ fputs(_(" -x, --posix use posix_fallocate(3) instead of fallocate(2)\n"), out);
+#endif
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
@@ -71,6 +75,18 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}

+
+#ifdef HAVE_POSIX_FALLOCATE
+static void xposix_fallocate(int fd, off_t offset, off_t length)
@ -135,50 +135,50 @@ index ff0f9e6..17ae5fe 100644 @@ -135,50 +135,50 @@ index ff0f9e6..17ae5fe 100644
+
static loff_t cvtnum(char *s)
{
uintmax_t x;
uintmax_t x;
@@ -85,9 +101,10 @@ int main(int argc, char **argv)
{
char *fname;
int c;
char *fname;
int c;
- int error;
+ int error = 0;
int fd;
int mode = 0;
int fd;
int mode = 0;
+ int posix = 0;
loff_t length = -2LL;
loff_t offset = 0;

loff_t length = -2LL;
loff_t offset = 0;
@@ -98,15 +115,25 @@ int main(int argc, char **argv)
{ "punch-hole", 0, 0, 'p' },
{ "offset", 1, 0, 'o' },
{ "length", 1, 0, 'l' },
{ "punch-hole", 0, 0, 'p' },
{ "offset", 1, 0, 'o' },
{ "length", 1, 0, 'l' },
+ { "posix", 0, 0, 'x' },
{ NULL, 0, 0, 0 }
};

{ NULL, 0, 0, 0 }
};
+ static const ul_excl_t excl[] = { /* rows and cols in ASCII order */
+ { 'x', 'n', 'p' },
+ { 0 }
+ };
+ int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
+
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);

setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
- while ((c = getopt_long(argc, argv, "hVnpl:o:", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "hVnpl:o:x", longopts, NULL)) != -1) {
+
+ err_exclusive_options(c, longopts, excl, excl_st);
+
switch(c) {
case 'h':
usage(stdout);
switch(c) {
case 'h':
usage(stdout);
@@ -126,6 +153,13 @@ int main(int argc, char **argv)
case 'o':
offset = cvtnum(optarg);
break;
case 'o':
offset = cvtnum(optarg);
break;
+ case 'x':
+#ifdef HAVE_POSIX_FALLOCATE
+ posix = 1;
@ -186,13 +186,13 @@ index ff0f9e6..17ae5fe 100644 @@ -186,13 +186,13 @@ index ff0f9e6..17ae5fe 100644
+#else
+ errx(EXIT_FAILURE, _("posix_fallocate support is not compiled"))
+#endif
default:
usage(stderr);
break;
default:
usage(stderr);
break;
@@ -152,6 +186,12 @@ int main(int argc, char **argv)
if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), fname);

if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), fname);
+#ifdef HAVE_POSIX_FALLOCATE
+ if (posix)
+ xposix_fallocate(fd, offset, length);
@ -200,7 +200,8 @@ index ff0f9e6..17ae5fe 100644 @@ -200,7 +200,8 @@ index ff0f9e6..17ae5fe 100644
+#endif
+
#ifdef HAVE_FALLOCATE
error = fallocate(fd, mode, offset, length);
error = fallocate(fd, mode, offset, length);
#else
--
--
2.9.3


91
SOURCES/0106-zramctl-backport-from-v2.29.patch

@ -32,8 +32,8 @@ index f87a885..db7095a 100644 @@ -32,8 +32,8 @@ index f87a885..db7095a 100644
+++ b/configure.ac
@@ -826,6 +826,12 @@ UL_REQUIRES_LINUX([losetup])
AM_CONDITIONAL(BUILD_LOSETUP, test "x$build_losetup" = xyes)


+UL_BUILD_INIT([zramctl], [check])
+UL_REQUIRES_LINUX([zramctl])
+UL_REQUIRES_BUILD([zramctl], [libsmartcols])
@ -48,20 +48,20 @@ index 757f317..1680296 100644 @@ -48,20 +48,20 @@ index 757f317..1680296 100644
--- a/include/Makemodule.am
+++ b/include/Makemodule.am
@@ -39,6 +39,7 @@ dist_noinst_HEADERS += \
include/readutmp.h \
include/setproctitle.h \
include/strutils.h \
include/readutmp.h \
include/setproctitle.h \
include/strutils.h \
+ include/strv.h \
include/swapheader.h \
include/sysfs.h \
include/timer.h \
include/swapheader.h \
include/sysfs.h \
include/timer.h \
diff --git a/include/c.h b/include/c.h
index a2779a5..3754e75 100644
--- a/include/c.h
+++ b/include/c.h
@@ -309,6 +309,14 @@ static inline int usleep(useconds_t usec)
#endif

/*
+ * Macros to convert #define'itions to strings, for example
+ * #define XYXXY 42
@ -83,13 +83,13 @@ index 709fcad..aa7b95f 100644 @@ -83,13 +83,13 @@ index 709fcad..aa7b95f 100644
#include <string.h>
#include <sys/types.h>
+#include <stdio.h>

/* default strtoxx_or_err() exit code */
#ifndef STRTOXX_EXIT_CODE
@@ -102,4 +103,12 @@ extern int parse_range(const char *str, int *lower, int *upper, int def);

extern int streq_except_trailing_slash(const char *s1, const char *s2);

+extern char *strnappend(const char *s, const char *suffix, size_t b);
+extern char *strappend(const char *s, const char *suffix);
+extern char *strfappend(const char *s, const char *format, ...)
@ -167,25 +167,25 @@ index 0a9c218..a547005 100644 @@ -167,25 +167,25 @@ index 0a9c218..a547005 100644
@@ -58,6 +58,9 @@ extern int sysfs_read_s64(struct sysfs_cxt *cxt, const char *attr, int64_t *res)
extern int sysfs_read_u64(struct sysfs_cxt *cxt, const char *attr, uint64_t *res);
extern int sysfs_read_int(struct sysfs_cxt *cxt, const char *attr, int *res);

+extern int sysfs_write_string(struct sysfs_cxt *cxt, const char *attr, const char *str);
+extern int sysfs_write_u64(struct sysfs_cxt *cxt, const char *attr, uint64_t num);
+
extern char *sysfs_get_devname(struct sysfs_cxt *cxt, char *buf, size_t bufsiz);

extern char *sysfs_strdup(struct sysfs_cxt *cxt, const char *attr);
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 73280f9..faf9d74 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -27,7 +27,8 @@ libcommon_la_SOURCES = \
lib/ttyutils.c \
lib/xgetpass.c \
lib/exec_shell.c \
lib/ttyutils.c \
lib/xgetpass.c \
lib/exec_shell.c \
- lib/readutmp.c
+ lib/readutmp.c \
+ lib/strv.c

if LINUX
libcommon_la_SOURCES += \
diff --git a/lib/strutils.c b/lib/strutils.c
@ -197,13 +197,13 @@ index f9cdcbb..4b8a813 100644 @@ -197,13 +197,13 @@ index f9cdcbb..4b8a813 100644
#include <sys/stat.h>
#include <string.h>
+#include <assert.h>

#include "c.h"
#include "nls.h"
@@ -687,6 +688,134 @@ int streq_except_trailing_slash(const char *s1, const char *s2)
return equal;
return equal;
}

+char *strnappend(const char *s, const char *suffix, size_t b)
+{
+ size_t a;
@ -332,9 +332,9 @@ index f9cdcbb..4b8a813 100644 @@ -332,9 +332,9 @@ index f9cdcbb..4b8a813 100644
+ return 0;
+ } while (1);
+}

#ifdef TEST_PROGRAM

diff --git a/lib/strv.c b/lib/strv.c
new file mode 100644
index 0000000..ddc2a0c
@ -753,43 +753,43 @@ index 0bfd622..65a8394 100644 @@ -753,43 +753,43 @@ index 0bfd622..65a8394 100644
#include "pathnames.h"
#include "sysfs.h"
+#include "all-io.h"

char *sysfs_devno_attribute_path(dev_t devno, char *buf,
size_t bufsiz, const char *attr)
size_t bufsiz, const char *attr)
@@ -203,9 +204,9 @@ int sysfs_has_attribute(struct sysfs_cxt *cxt, const char *attr)
return sysfs_stat(cxt, attr, &st) == 0;
return sysfs_stat(cxt, attr, &st) == 0;
}

-static int sysfs_open(struct sysfs_cxt *cxt, const char *attr)
+static int sysfs_open(struct sysfs_cxt *cxt, const char *attr, int flags)
{
- int fd = open_at(cxt->dir_fd, cxt->dir_path, attr, O_RDONLY|O_CLOEXEC);
+ int fd = open_at(cxt->dir_fd, cxt->dir_path, attr, flags);

if (fd == -1 && errno == ENOENT &&
strncmp(attr, "queue/", 6) == 0 && cxt->parent) {
if (fd == -1 && errno == ENOENT &&
strncmp(attr, "queue/", 6) == 0 && cxt->parent) {
@@ -238,7 +239,7 @@ DIR *sysfs_opendir(struct sysfs_cxt *cxt, const char *attr)
int fd = -1;

if (attr)
int fd = -1;
if (attr)
- fd = sysfs_open(cxt, attr);
+ fd = sysfs_open(cxt, attr, O_RDONLY|O_CLOEXEC);

else if (cxt->dir_fd >= 0)
/* request to open root of device in sysfs (/sys/block/<dev>)
else if (cxt->dir_fd >= 0)
/* request to open root of device in sysfs (/sys/block/<dev>)
@@ -263,7 +264,7 @@ DIR *sysfs_opendir(struct sysfs_cxt *cxt, const char *attr)

static FILE *sysfs_fopen(struct sysfs_cxt *cxt, const char *attr)
{
- int fd = sysfs_open(cxt, attr);
+ int fd = sysfs_open(cxt, attr, O_RDONLY|O_CLOEXEC);

return fd < 0 ? NULL : fdopen(fd, "r" UL_CLOEXECSTR);
return fd < 0 ? NULL : fdopen(fd, "r" UL_CLOEXECSTR);
}
@@ -417,6 +418,42 @@ int sysfs_read_int(struct sysfs_cxt *cxt, const char *attr, int *res)
return -1;
return -1;
}

+int sysfs_write_string(struct sysfs_cxt *cxt, const char *attr, const char *str)
+{
+ int fd = sysfs_open(cxt, attr, O_WRONLY|O_CLOEXEC);
@ -828,7 +828,7 @@ index 0bfd622..65a8394 100644 @@ -828,7 +828,7 @@ index 0bfd622..65a8394 100644
+
char *sysfs_strdup(struct sysfs_cxt *cxt, const char *attr)
{
char buf[1024];
char buf[1024];
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index 6badd17..408e884 100644
--- a/sys-utils/Makemodule.am
@ -836,7 +836,7 @@ index 6badd17..408e884 100644 @@ -836,7 +836,7 @@ index 6badd17..408e884 100644
@@ -184,6 +184,13 @@ losetup_static_LDADD = $(losetup_LDADD)
endif
endif # BUILD_LOSETUP

+if BUILD_ZRAMCTL
+sbin_PROGRAMS += zramctl
+dist_man_MANS += sys-utils/zramctl.8
@ -844,7 +844,7 @@ index 6badd17..408e884 100644 @@ -844,7 +844,7 @@ index 6badd17..408e884 100644
+zramctl_LDADD = $(LDADD) libcommon.la libsmartcols.la
+zramctl_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
+endif

if BUILD_PRLIMIT
usrbin_exec_PROGRAMS += prlimit
diff --git a/sys-utils/zramctl.8 b/sys-utils/zramctl.8
@ -1718,5 +1718,6 @@ index 0000000..853401c @@ -1718,5 +1718,6 @@ index 0000000..853401c
+
+ return rc ? EXIT_FAILURE : EXIT_SUCCESS;
+}
--
--
2.9.3


15
SOURCES/0107-libblkid-zfs-let-s-keep-compiler-happy.patch

@ -15,13 +15,14 @@ index 56ee472..86da59d 100644 @@ -15,13 +15,14 @@ index 56ee472..86da59d 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -171,7 +171,7 @@ static int probe_zfs(blkid_probe pr,
uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
struct zfs_uberblock *ub;
int swab_endian;
uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
struct zfs_uberblock *ub;
int swab_endian;
- loff_t offset, ub_offset;
+ loff_t offset, ub_offset = 0;
int tried;
int found;

--
int tried;
int found;
--
2.9.3


65
SOURCES/0108-blkid-make-zfs-detection-more-robust.patch

@ -21,22 +21,22 @@ index 86da59d..4a64a03 100644 @@ -21,22 +21,22 @@ index 86da59d..4a64a03 100644
#define VDEV_LABEL_NVPAIR ( 16 * 1024ULL)
#define VDEV_LABEL_SIZE (256 * 1024ULL)
+#define UBERBLOCK_SIZE 1024ULL

/* #include <sys/uberblock_impl.h> */
#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */
@@ -31,7 +32,7 @@ struct zfs_uberblock {
char ub_rootbp; /* MOS objset_phys_t */
char ub_rootbp; /* MOS objset_phys_t */
} __attribute__((packed));

-#define ZFS_TRIES 64
+#define ZFS_TRIES 512
#define ZFS_WANT 4

#define DATA_TYPE_UINT64 8
@@ -162,11 +163,10 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
#define zdebug(fmt, ...) do {} while(0)
/*#define zdebug(fmt, a...) fprintf(stderr, fmt, ##a)*/

-/* ZFS has 128x1kB host-endian root blocks, stored in 2 areas at the start
- * of the disk, and 2 areas at the end of the disk. Check only some of them...
- * #4 (@ 132kB) is the first one written on a new filesystem. */
@ -47,19 +47,19 @@ index 86da59d..4a64a03 100644 @@ -47,19 +47,19 @@ index 86da59d..4a64a03 100644
+ */
+static int probe_zfs(blkid_probe pr, const struct blkid_idmag *mag)
{
uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
struct zfs_uberblock *ub;
uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
struct zfs_uberblock *ub;
@@ -174,15 +174,29 @@ static int probe_zfs(blkid_probe pr,
loff_t offset, ub_offset = 0;
int tried;
int found;
loff_t offset, ub_offset = 0;
int tried;
int found;
+ loff_t blk_align = (pr->size % (256 * 1024ULL));

zdebug("probe_zfs\n");
zdebug("probe_zfs\n");
- /* Look for at least 4 uberblocks to ensure a positive match */
+ /* Look for at least 4 uberblocks to ensure a positive match.
+ Begin with Label 0 (L0) at the start of the block device. */
for (tried = found = 0, offset = VDEV_LABEL_UBERBLOCK;
for (tried = found = 0, offset = VDEV_LABEL_UBERBLOCK;
- tried < ZFS_TRIES && found < ZFS_WANT;
- tried++, offset += 4096) {
- /* also try the second uberblock copy */
@ -70,7 +70,7 @@ index 86da59d..4a64a03 100644 @@ -70,7 +70,7 @@ index 86da59d..4a64a03 100644
+ /* Leave L0 to try other labels */
+ switch(tried) {
+ case 128: // jump to L1, just after L0
offset = VDEV_LABEL_SIZE + VDEV_LABEL_UBERBLOCK;
offset = VDEV_LABEL_SIZE + VDEV_LABEL_UBERBLOCK;
+ break;
+ case 256: // jump to L2 near the far end of the block device
+ offset = pr->size - 2 * VDEV_LABEL_SIZE + VDEV_LABEL_UBERBLOCK - blk_align;
@ -81,31 +81,32 @@ index 86da59d..4a64a03 100644 @@ -81,31 +81,32 @@ index 86da59d..4a64a03 100644
+ zdebug("probe_zfs: l3 offset %llu\n", offset >> 10);
+ break;
+ }

ub = (struct zfs_uberblock *)
blkid_probe_get_buffer(pr, offset,
ub = (struct zfs_uberblock *)
blkid_probe_get_buffer(pr, offset,
@@ -193,15 +207,14 @@ static int probe_zfs(blkid_probe pr,
if (ub->ub_magic == UBERBLOCK_MAGIC) {
ub_offset = offset;
found++;
if (ub->ub_magic == UBERBLOCK_MAGIC) {
ub_offset = offset;
found++;
+ zdebug("probe_zfs: found little-endian uberblock at %llu\n", offset >> 10);
}

if ((swab_endian = (ub->ub_magic == swab_magic))) {
ub_offset = offset;
found++;
}
if ((swab_endian = (ub->ub_magic == swab_magic))) {
ub_offset = offset;
found++;
+ zdebug("probe_zfs: found big-endian uberblock at %llu\n", offset >> 10);
}
}
-
- zdebug("probe_zfs: found %s-endian uberblock at %llu\n",
- swab_endian ? "big" : "little", offset >> 10);
}

if (found < 4)
}
if (found < 4)
@@ -230,4 +243,3 @@ const struct blkid_idinfo zfs_idinfo =
.minsz = 64 * 1024 * 1024,
.magics = BLKID_NONE_MAGIC
.minsz = 64 * 1024 * 1024,
.magics = BLKID_NONE_MAGIC
};
-
--
--
2.9.3


53
SOURCES/0109-zfs-make-less-syscalls.patch

@ -19,21 +19,21 @@ index 4a64a03..9b5601e 100644 @@ -19,21 +19,21 @@ index 4a64a03..9b5601e 100644
#define VDEV_LABEL_SIZE (256 * 1024ULL)
#define UBERBLOCK_SIZE 1024ULL
+#define UBERBLOCKS_COUNT 128

/* #include <sys/uberblock_impl.h> */
#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */
@@ -32,7 +33,6 @@ struct zfs_uberblock {
char ub_rootbp; /* MOS objset_phys_t */
char ub_rootbp; /* MOS objset_phys_t */
} __attribute__((packed));

-#define ZFS_TRIES 512
#define ZFS_WANT 4

#define DATA_TYPE_UINT64 8
@@ -163,61 +163,82 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
#define zdebug(fmt, ...) do {} while(0)
/*#define zdebug(fmt, a...) fprintf(stderr, fmt, ##a)*/

-/* ZFS has 128x1kB host-endian root blocks, stored in 2 areas (labels)
- * at the start of the disk, and 2 areas at the end of the disk.
- */
@ -70,18 +70,18 @@ index 4a64a03..9b5601e 100644 @@ -70,18 +70,18 @@ index 4a64a03..9b5601e 100644
+ * #4 (@ 132kB) is the first one written on a new filesystem. */
static int probe_zfs(blkid_probe pr, const struct blkid_idmag *mag)
{
uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
+ int swab_endian = 0;
struct zfs_uberblock *ub;
struct zfs_uberblock *ub;
- int swab_endian;
loff_t offset, ub_offset = 0;
loff_t offset, ub_offset = 0;
- int tried;
- int found;
+ int label_no, found = 0, found_in_label;
+ void *label;
loff_t blk_align = (pr->size % (256 * 1024ULL));

zdebug("probe_zfs\n");
loff_t blk_align = (pr->size % (256 * 1024ULL));
zdebug("probe_zfs\n");
- /* Look for at least 4 uberblocks to ensure a positive match.
- Begin with Label 0 (L0) at the start of the block device. */
- for (tried = found = 0, offset = VDEV_LABEL_UBERBLOCK;
@ -97,13 +97,13 @@ index 4a64a03..9b5601e 100644 @@ -97,13 +97,13 @@ index 4a64a03..9b5601e 100644
+ switch(label_no) {
+ case 0: // jump to L0
+ offset = 0;
break;
break;
- case 256: // jump to L2 near the far end of the block device
- offset = pr->size - 2 * VDEV_LABEL_SIZE + VDEV_LABEL_UBERBLOCK - blk_align;
- zdebug("probe_zfs: l2 offset %llu\n", offset >> 10);
+ case 1: // jump to L1
+ offset = VDEV_LABEL_SIZE;
break;
break;
- case 384: // jump to L3 at the furthest end of the block device
- offset = pr->size - VDEV_LABEL_SIZE + VDEV_LABEL_UBERBLOCK - blk_align;
- zdebug("probe_zfs: l3 offset %llu\n", offset >> 10);
@ -112,24 +112,24 @@ index 4a64a03..9b5601e 100644 @@ -112,24 +112,24 @@ index 4a64a03..9b5601e 100644
+ break;
+ case 3: // jump to L3
+ offset = pr->size - VDEV_LABEL_SIZE - blk_align;
break;
}

break;
}
- ub = (struct zfs_uberblock *)
- blkid_probe_get_buffer(pr, offset,
- sizeof(struct zfs_uberblock));
- if (ub == NULL)
+ label = blkid_probe_get_buffer(pr, offset, VDEV_LABEL_SIZE);
+ if (label == NULL)
return errno ? -errno : 1;

return errno ? -errno : 1;
- if (ub->ub_magic == UBERBLOCK_MAGIC) {
- ub_offset = offset;
- found++;
- zdebug("probe_zfs: found little-endian uberblock at %llu\n", offset >> 10);
- }
+ found_in_label = find_uberblocks(label, &ub_offset, &swab_endian);

- if ((swab_endian = (ub->ub_magic == swab_magic))) {
- ub_offset = offset;
- found++;
@ -141,13 +141,14 @@ index 4a64a03..9b5601e 100644 @@ -141,13 +141,14 @@ index 4a64a03..9b5601e 100644
+
+ if (found >= ZFS_WANT)
+ break;
}
}

}
}
- if (found < 4)
+ if (found < ZFS_WANT)
return 1;

/* If we found the 4th uberblock, then we will have exited from the
--
return 1;
/* If we found the 4th uberblock, then we will have exited from the
--
2.9.3


31
SOURCES/0110-libblkid-zfs-keep-bufferes-read-only.patch

@ -15,33 +15,34 @@ index 9b5601e..8e88b39 100644 @@ -15,33 +15,34 @@ index 9b5601e..8e88b39 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -70,9 +70,10 @@ struct nvlist {

static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
{
+ unsigned char *p, buff[4096];
struct nvlist *nvl;
struct nvpair *nvp;
struct nvlist *nvl;
struct nvpair *nvp;
- size_t left = 4096;
+ size_t left = sizeof(buff);
int found = 0;

offset = (offset & ~(VDEV_LABEL_SIZE - 1)) + VDEV_LABEL_NVPAIR;
int found = 0;
offset = (offset & ~(VDEV_LABEL_SIZE - 1)) + VDEV_LABEL_NVPAIR;
@@ -81,10 +82,14 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
* the first 4k (left) of the nvlist. This is true for all pools
* I've seen, and simplifies this code somewhat, because we don't
* have to handle an nvpair crossing a buffer boundary. */
* the first 4k (left) of the nvlist. This is true for all pools
* I've seen, and simplifies this code somewhat, because we don't
* have to handle an nvpair crossing a buffer boundary. */
- nvl = (struct nvlist *)blkid_probe_get_buffer(pr, offset, left);
- if (nvl == NULL)
+ p = blkid_probe_get_buffer(pr, offset, left);
+ if (!p)
return;

return;
+ /* libblkid buffers are strictly readonly, but the code below modifies nvpair etc. */
+ memcpy(buff, p, sizeof(buff));
+ nvl = (struct nvlist *) buff;
+
nvdebug("zfs_extract: nvlist offset %llu\n", offset);

nvp = &nvl->nvl_nvpair;
--
nvdebug("zfs_extract: nvlist offset %llu\n", offset);
nvp = &nvl->nvl_nvpair;
--
2.9.3


11
SOURCES/0111-libblkid-don-t-mark-zfs-as-RAID.patch

@ -17,11 +17,12 @@ index 8e88b39..5074495 100644 @@ -17,11 +17,12 @@ index 8e88b39..5074495 100644
@@ -264,7 +264,7 @@ static int probe_zfs(blkid_probe pr, const struct blkid_idmag *mag)
const struct blkid_idinfo zfs_idinfo =
{
.name = "zfs_member",
.name = "zfs_member",
- .usage = BLKID_USAGE_RAID,
+ .usage = BLKID_USAGE_FILESYSTEM,
.probefunc = probe_zfs,
.minsz = 64 * 1024 * 1024,
.magics = BLKID_NONE_MAGIC
--
.probefunc = probe_zfs,
.minsz = 64 * 1024 * 1024,
.magics = BLKID_NONE_MAGIC
--
2.9.3


3
SOURCES/0112-tests-update-ZFS-test.patch

@ -23,5 +23,6 @@ index 46727de..952e0e5 100644 @@ -23,5 +23,6 @@ index 46727de..952e0e5 100644
ID_FS_UUID=1782036546311300980
ID_FS_UUID_ENC=1782036546311300980
ID_FS_UUID_SUB=13179280127379850514
--
--
2.9.3


11
SOURCES/0113-libblkid-zfs-add-cast-to-fix-UB-cppcheck.patch

@ -18,13 +18,14 @@ index 5074495..ff12fa6 100644 @@ -18,13 +18,14 @@ index 5074495..ff12fa6 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -170,7 +170,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)

static int find_uberblocks(const void *label, loff_t *ub_offset, int *swap_endian)
{
- uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
+ uint64_t swab_magic = swab64((uint64_t)UBERBLOCK_MAGIC);
struct zfs_uberblock *ub;
int i, found = 0;
loff_t offset = VDEV_LABEL_UBERBLOCK;
--
struct zfs_uberblock *ub;
int i, found = 0;
loff_t offset = VDEV_LABEL_UBERBLOCK;
--
2.9.3


21
SOURCES/0114-libblkid-Avoid-OOB-access-on-illegal-ZFS-superblocks.patch

@ -27,21 +27,22 @@ index ff12fa6..2c7b4b7 100644 @@ -27,21 +27,22 @@ index ff12fa6..2c7b4b7 100644
--- a/libblkid/src/superblocks/zfs.c
+++ b/libblkid/src/superblocks/zfs.c
@@ -115,7 +115,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)

nvs->nvs_type = be32_to_cpu(nvs->nvs_type);
nvs->nvs_strlen = be32_to_cpu(nvs->nvs_strlen);
nvs->nvs_type = be32_to_cpu(nvs->nvs_type);
nvs->nvs_strlen = be32_to_cpu(nvs->nvs_strlen);
- if (nvs->nvs_strlen > UINT_MAX - sizeof(*nvs))
+ if (nvs->nvs_strlen > INT_MAX - sizeof(*nvs))
break;
avail -= nvs->nvs_strlen + sizeof(*nvs);
nvdebug("nvstring: type %u string %*s\n", nvs->nvs_type,
break;
avail -= nvs->nvs_strlen + sizeof(*nvs);
nvdebug("nvstring: type %u string %*s\n", nvs->nvs_type,
@@ -201,7 +201,6 @@ static int find_uberblocks(const void *label, loff_t *ub_offset, int *swap_endia
* #4 (@ 132kB) is the first one written on a new filesystem. */
static int probe_zfs(blkid_probe pr, const struct blkid_idmag *mag)
{
- uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
int swab_endian = 0;
struct zfs_uberblock *ub;
loff_t offset, ub_offset = 0;
--
int swab_endian = 0;
struct zfs_uberblock *ub;
loff_t offset, ub_offset = 0;
--
2.9.3


999
SOURCES/0115-lscpu-backport-from-v2.29.patch

File diff suppressed because it is too large Load Diff

13
SOURCES/0116-fdisk-use-sysfs_devno_is_wholedisk.patch

@ -24,14 +24,14 @@ index 5161a1e..7c63204 100644 @@ -24,14 +24,14 @@ index 5161a1e..7c63204 100644
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#include "blkdev.h"
+#include "sysfs.h"
#include "wholedisk.h"

int is_whole_disk_fd(int fd, const char *name)
@@ -35,16 +31,13 @@ int is_whole_disk_fd(int fd, const char *name)

int is_whole_disk(const char *name)
{
- int fd = -1, res = 0;
@ -45,13 +45,14 @@ index 5161a1e..7c63204 100644 @@ -45,13 +45,14 @@ index 5161a1e..7c63204 100644
+ if (sysfs_devno_is_lvm_private(devno) ||
+ sysfs_devno_is_wholedisk(devno) <= 0)
+ return 0;

- if (fd != -1)
- close(fd);
- return res;
+ return 1;
}

#ifdef TEST_PROGRAM
--
--
2.9.3


11
SOURCES/0117-zramctl-add-bash-completion.patch

@ -16,13 +16,13 @@ index c3791e7..84ab258 100644 @@ -16,13 +16,13 @@ index c3791e7..84ab258 100644
--- a/bash-completion/Makemodule.am
+++ b/bash-completion/Makemodule.am
@@ -30,7 +30,8 @@ dist_bashcompletion_DATA = \
bash-completion/setsid \
bash-completion/tailf \
bash-completion/whereis \
bash-completion/setsid \
bash-completion/tailf \
bash-completion/whereis \
- bash-completion/wipefs
+ bash-completion/wipefs \
+ bash-completion/zramctl

# disk-utils...
if BUILD_BFS
diff --git a/bash-completion/zramctl b/bash-completion/zramctl
@ -88,5 +88,6 @@ index 0000000..a4ef536 @@ -88,5 +88,6 @@ index 0000000..a4ef536
+ return 0
+}
+complete -F _zramctl_module zramctl
--
--
2.9.3


15
SOURCES/0118-zramctl-make-mm_stat-parser-more-robust.patch

@ -19,9 +19,9 @@ index 853401c..c3112d6 100644 @@ -19,9 +19,9 @@ index 853401c..c3112d6 100644
--- a/sys-utils/zramctl.c
+++ b/sys-utils/zramctl.c
@@ -359,8 +359,12 @@ static char *get_mm_stat(struct zram *z, size_t idx, int bytes)
str = sysfs_strdup(sysfs, "mm_stat");
if (str) {
z->mm_stat = strv_split(str, " ");
str = sysfs_strdup(sysfs, "mm_stat");
if (str) {
z->mm_stat = strv_split(str, " ");
- if (strv_length(z->mm_stat) < ARRAY_SIZE(mm_stat_names))
- errx(EXIT_FAILURE, _("Failed to parse mm_stat"));
+
@ -30,8 +30,9 @@ index 853401c..c3112d6 100644 @@ -30,8 +30,9 @@ index 853401c..c3112d6 100644
+ strv_free(z->mm_stat);
+ z->mm_stat = NULL;
+ }
}
z->mm_stat_probed = 1;
free(str);
--
}
z->mm_stat_probed = 1;
free(str);
--
2.9.3


63
SOURCES/0119-fdisk-improve-menu-and-u-for-GPT.patch

@ -19,55 +19,56 @@ index 177921a..b47b975 100644 @@ -19,55 +19,56 @@ index 177921a..b47b975 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -70,7 +70,7 @@ static const struct menulist_descr menulist[] = {
{'c', N_("toggle the dos compatibility flag"), {FDISK_DISKLABEL_DOS, 0}},
{'c', N_("toggle the mountable flag"), {FDISK_DISKLABEL_SUN, 0}},
{'d', N_("delete a partition"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF | FDISK_DISKLABEL_GPT, 0}},
{'c', N_("toggle the dos compatibility flag"), {FDISK_DISKLABEL_DOS, 0}},
{'c', N_("toggle the mountable flag"), {FDISK_DISKLABEL_SUN, 0}},
{'d', N_("delete a partition"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF | FDISK_DISKLABEL_GPT, 0}},
- {'d', N_("print the raw data in the partition table"), {0, FDISK_DISKLABEL_ANY}},
+ {'d', N_("print the raw data in the first sector"), {0, FDISK_DISKLABEL_ANY}},
{'e', N_("change number of extra sectors per cylinder"), {0, FDISK_DISKLABEL_SUN}},
{'e', N_("edit drive data"), {FDISK_DISKLABEL_OSF, 0}},
{'e', N_("list extended partitions"), {0, FDISK_DISKLABEL_DOS}},
{'e', N_("change number of extra sectors per cylinder"), {0, FDISK_DISKLABEL_SUN}},
{'e', N_("edit drive data"), {FDISK_DISKLABEL_OSF, 0}},
{'e', N_("list extended partitions"), {0, FDISK_DISKLABEL_DOS}},
@@ -94,7 +94,7 @@ static const struct menulist_descr menulist[] = {
{'s', N_("change number of sectors/track"), {0, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN}},
{'s', N_("create a new empty Sun disklabel"), {~FDISK_DISKLABEL_OSF, 0}},
{'s', N_("show complete disklabel"), {FDISK_DISKLABEL_OSF, 0}},
{'s', N_("change number of sectors/track"), {0, FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN}},
{'s', N_("create a new empty Sun disklabel"), {~FDISK_DISKLABEL_OSF, 0}},
{'s', N_("show complete disklabel"), {FDISK_DISKLABEL_OSF, 0}},
- {'t', N_("change a partition's system id"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, 0}},
+ {'t', N_("change a partition's system id"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF | FDISK_DISKLABEL_GPT, 0}},
{'u', N_("change display/entry units"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, 0}},
{'v', N_("verify the partition table"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT,
FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT}},
{'u', N_("change display/entry units"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_OSF, 0}},
{'v', N_("verify the partition table"), {FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT,
FDISK_DISKLABEL_DOS | FDISK_DISKLABEL_SUN | FDISK_DISKLABEL_SGI | FDISK_DISKLABEL_GPT}},
@@ -1018,6 +1018,11 @@ static void command_prompt(struct fdisk_context *cxt)
fdisk_context_switch_label(cxt, "dos");
}

fdisk_context_switch_label(cxt, "dos");
}
+ if (fdisk_is_disklabel(cxt, GPT) && fdisk_context_use_cylinders(cxt)) {
+ printf(_("Use cylinders for GPT is unsupported. "));
+ toggle_units(cxt);
+ }
+
while (1) {

assert(cxt->label);
while (1) {
assert(cxt->label);
@@ -1073,6 +1078,8 @@ static void command_prompt(struct fdisk_context *cxt)
break;
case 'g':
fdisk_create_disklabel(cxt, "gpt");
break;
case 'g':
fdisk_create_disklabel(cxt, "gpt");
+ if (fdisk_is_disklabel(cxt, GPT) && fdisk_context_use_cylinders(cxt))
+ toggle_units(cxt);
break;
case 'G':
fdisk_create_disklabel(cxt, "sgi");
break;
case 'G':
fdisk_create_disklabel(cxt, "sgi");
@@ -1107,7 +1114,10 @@ static void command_prompt(struct fdisk_context *cxt)
change_partition_type(cxt);
break;
case 'u':
change_partition_type(cxt);
break;
case 'u':
- toggle_units(cxt);
+ if (fdisk_is_disklabel(cxt, GPT) && !fdisk_context_use_cylinders(cxt))
+ printf(_("Use cylinders for GPT is unsupported."));
+ else
+ toggle_units(cxt);
break;
case 'v':
verify(cxt);
--
break;
case 'v':
verify(cxt);
--
2.9.3


49
SOURCES/0120-tests-update-for-RHEL7.4-changes.patch

@ -24,11 +24,11 @@ index faf9d74..acae27a 100644 @@ -24,11 +24,11 @@ index faf9d74..acae27a 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -82,6 +82,7 @@ test_ismounted_LDADD = libcommon.la

test_wholedisk_SOURCES = lib/wholedisk.c
test_wholedisk_CFLAGS = -DTEST_PROGRAM
+test_wholedisk_LDADD = libcommon.la

test_mangle_SOURCES = lib/mangle.c
test_mangle_CFLAGS = -DTEST_PROGRAM
diff --git a/tests/expected/fdisk/gpt b/tests/expected/fdisk/gpt
@ -40,40 +40,40 @@ index b73d5c3..017d819 100644 @@ -40,40 +40,40 @@ index b73d5c3..017d819 100644
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
+Disk identifier: <removed>


# Start End Size Type Name
@@ -21,6 +22,7 @@ Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
+Disk identifier: <removed>


# Start End Size Type Name
@@ -42,6 +44,7 @@ Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
+Disk identifier: <removed>


# Start End Size Type Name
@@ -63,6 +66,7 @@ Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
+Disk identifier: <removed>


# Start End Size Type Name
@@ -83,6 +87,7 @@ Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
+Disk identifier: <removed>


# Start End Size Type Name
diff --git a/tests/expected/lscpu/lscpu-armv7 b/tests/expected/lscpu/lscpu-armv7
index a1b691c..bcb16cc 100644
@ -88,7 +88,7 @@ index a1b691c..bcb16cc 100644 @@ -88,7 +88,7 @@ index a1b691c..bcb16cc 100644
+CPU min MHz: 200.0000
+BogoMIPS: 1694.10
+Flags: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
diff --git a/tests/expected/lscpu/lscpu-s390-kvm b/tests/expected/lscpu/lscpu-s390-kvm
@ -106,7 +106,7 @@ index 1aa42f9..66d1c04 100644 @@ -106,7 +106,7 @@ index 1aa42f9..66d1c04 100644
Virtualization type: full
Dispatching mode: horizontal
+Flags: esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
diff --git a/tests/expected/lscpu/lscpu-s390-lpar b/tests/expected/lscpu/lscpu-s390-lpar
@ -124,7 +124,7 @@ index 0799ab9..9c8ac2c 100644 @@ -124,7 +124,7 @@ index 0799ab9..9c8ac2c 100644
Virtualization type: full
Dispatching mode: vertical
+Flags: esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
diff --git a/tests/expected/lscpu/lscpu-s390-zvm b/tests/expected/lscpu/lscpu-s390-zvm
@ -142,7 +142,7 @@ index 04dcf76..4cd6b8f 100644 @@ -142,7 +142,7 @@ index 04dcf76..4cd6b8f 100644
Virtualization type: full
Dispatching mode: horizontal
+Flags: esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
diff --git a/tests/expected/lscpu/lscpu-x86_64-64cpu b/tests/expected/lscpu/lscpu-x86_64-64cpu
@ -165,7 +165,7 @@ index 32aa57c..07990ea 100644 @@ -165,7 +165,7 @@ index 32aa57c..07990ea 100644
NUMA node2 CPU(s): 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
NUMA node3 CPU(s): 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63
+Flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 x2apic popcnt lahf_lm ida epb dts tpr_shadow vnmi flexpriority ept vpid

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
diff --git a/tests/expected/lscpu/lscpu-x86_64-dell_e4310 b/tests/expected/lscpu/lscpu-x86_64-dell_e4310
@ -187,7 +187,7 @@ index a81878d..39ec32c 100644 @@ -187,7 +187,7 @@ index a81878d..39ec32c 100644
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
+Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid

# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
diff --git a/tests/ts/fdisk/gpt b/tests/ts/fdisk/gpt
@ -195,14 +195,15 @@ index a0902ca..ec3438f 100755 @@ -195,14 +195,15 @@ index a0902ca..ec3438f 100755
--- a/tests/ts/fdisk/gpt
+++ b/tests/ts/fdisk/gpt
@@ -38,7 +38,8 @@ function print_layout {
echo -ne "\n---layout----------" >> $TS_OUTPUT
$TS_CMD_FDISK -l ${TEST_IMAGE_NAME} 2> /dev/null | \
sed 's/^.*\.img/__ts_dev__/g;
echo -ne "\n---layout----------" >> $TS_OUTPUT
$TS_CMD_FDISK -l ${TEST_IMAGE_NAME} 2> /dev/null | \
sed 's/^.*\.img/__ts_dev__/g;
- s/^[[:blank:]]*Device Boot/ Device Boot/g' >> $TS_OUTPUT 2>&1
+ s/^[[:blank:]]*Device Boot/ Device Boot/g;
+ s/^Disk identifier:.*/Disk identifier: <removed>/g' >> $TS_OUTPUT 2>&1
echo -ne "-------------------\n\n" >> $TS_OUTPUT
echo -ne "-------------------\n\n" >> $TS_OUTPUT
}

--
--
2.9.3


3
SOURCES/0121-zramctl-be-more-specific-about-default-output.patch

@ -26,5 +26,6 @@ index f6fc45c..9ca2983 100644 @@ -26,5 +26,6 @@ index f6fc45c..9ca2983 100644
.SH OPTIONS
.TP
.BR \-a , " \-\-algorithm lzo" | lz4
--
--
2.9.3


23
SOURCES/0122-libfdisk-gpt-fix-UUID-printing.patch

@ -15,17 +15,17 @@ index 899e1b2..612ce09 100644 @@ -15,17 +15,17 @@ index 899e1b2..612ce09 100644
+++ b/libfdisk/src/gpt.c
@@ -1690,7 +1690,7 @@ static int gpt_create_disklabel(struct fdisk_context *cxt)
{
int rc = 0;
ssize_t esz = 0;
int rc = 0;
ssize_t esz = 0;
- struct gpt_guid *uid;
+ char str[37];
struct fdisk_gpt_label *gpt;

assert(cxt);
struct fdisk_gpt_label *gpt;
assert(cxt);
@@ -1746,16 +1746,8 @@ static int gpt_create_disklabel(struct fdisk_context *cxt)
cxt->label->nparts_max = le32_to_cpu(gpt->pheader->npartition_entries);
cxt->label->nparts_cur = 0;

cxt->label->nparts_max = le32_to_cpu(gpt->pheader->npartition_entries);
cxt->label->nparts_cur = 0;
- uid = &gpt->pheader->disk_guid;
- fdisk_info(cxt, _("Building a new GPT disklabel "
- "(GUID: %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X)\n"),
@ -38,8 +38,9 @@ index 899e1b2..612ce09 100644 @@ -38,8 +38,9 @@ index 899e1b2..612ce09 100644
- uid->node[4], uid->node[5]);
+ guid_to_string(&gpt->pheader->disk_guid, str);
+ fdisk_info(cxt, _("Building a new GPT disklabel (GUID: %s)\n"), str);
fdisk_label_set_changed(cxt->label, 1);
fdisk_label_set_changed(cxt->label, 1);
done:
return rc;
--
return rc;
--
2.9.3


39
SOURCES/0123-libblkid-Add-metadata-signature-check-for-IMSM-on-4K.patch

@ -20,22 +20,22 @@ index 065c2b2..81d53a1 100644 @@ -20,22 +20,22 @@ index 065c2b2..81d53a1 100644
--- a/libblkid/src/superblocks/isw_raid.c
+++ b/libblkid/src/superblocks/isw_raid.c
@@ -25,11 +25,11 @@ struct isw_metadata {

#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. "

-
static int probe_iswraid(blkid_probe pr,
const struct blkid_idmag *mag __attribute__((__unused__)))
const struct blkid_idmag *mag __attribute__((__unused__)))
{
uint64_t off;
uint64_t off;
+ unsigned int sector_size;
struct isw_metadata *isw;

if (pr->size < 0x10000)
struct isw_metadata *isw;
if (pr->size < 0x10000)
@@ -37,16 +37,17 @@ static int probe_iswraid(blkid_probe pr,
if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
return 1;

if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
return 1;
- off = ((pr->size / 0x200) - 2) * 0x200;
- isw = (struct isw_metadata *)
- blkid_probe_get_buffer(pr,
@ -46,14 +46,15 @@ index 065c2b2..81d53a1 100644 @@ -46,14 +46,15 @@ index 065c2b2..81d53a1 100644
+
+ isw = (struct isw_metadata *)blkid_probe_get_buffer(pr,
+ off, sizeof(struct isw_metadata));
if (!isw)
return errno ? -errno : 1;

if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
return 1;
if (!isw)
return errno ? -errno : 1;
if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
return 1;
+
if (blkid_probe_sprintf_version(pr, "%6s",
&isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0)
return 1;
--
if (blkid_probe_sprintf_version(pr, "%6s",
&isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0)
return 1;
--
2.9.4


19
SOURCES/0124-lscpu-use-sysfs-for-table-access-if-available.patch

@ -32,9 +32,9 @@ index 0e497d1..a8298ff 100644 @@ -32,9 +32,9 @@ index 0e497d1..a8298ff 100644
--- a/sys-utils/lscpu-dmi.c
+++ b/sys-utils/lscpu-dmi.c
@@ -192,6 +192,18 @@ static int hypervisor_decode_smbios(uint8_t *buf, const char *devmem)
devmem);
devmem);
}

+static int hypervisor_decode_sysfw(void)
+{
+ static char const sys_fw_dmi_tables[] = "/sys/firmware/dmi/tables/DMI";
@ -51,15 +51,16 @@ index 0e497d1..a8298ff 100644 @@ -51,15 +51,16 @@ index 0e497d1..a8298ff 100644
* Probe for EFI interface
*/
@@ -242,6 +254,10 @@ int read_hypervisor_dmi(void)
|| '\0' != 0)
return rc;

|| '\0' != 0)
return rc;
+ rc = hypervisor_decode_sysfw();
+ if (rc >= 0)
+ return rc;
+
/* First try EFI (ia64, Intel-based Mac) */
switch (address_from_efi(&fp)) {
case EFI_NOT_FOUND:
--
/* First try EFI (ia64, Intel-based Mac) */
switch (address_from_efi(&fp)) {
case EFI_NOT_FOUND:
--
2.9.4


35
SOURCES/0125-lscpu-improve-for-offline-CPUs-on-AMD.patch

@ -14,30 +14,31 @@ index 683fd66..1ee73f3 100644 @@ -14,30 +14,31 @@ index 683fd66..1ee73f3 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1550,11 +1550,11 @@ get_cell_data(struct lscpu_desc *desc, int idx, int col,
is_cpu_online(desc, cpu) ? _("yes") : _("no"));
break;
case COL_MAXMHZ:
is_cpu_online(desc, cpu) ? _("yes") : _("no"));
break;
case COL_MAXMHZ:
- if (desc->maxmhz)
+ if (desc->maxmhz && desc->maxmhz[idx])
xstrncpy(buf, desc->maxmhz[idx], bufsz);
break;
case COL_MINMHZ:
xstrncpy(buf, desc->maxmhz[idx], bufsz);
break;
case COL_MINMHZ:
- if (desc->minmhz)
+ if (desc->minmhz && desc->minmhz[idx])
xstrncpy(buf, desc->minmhz[idx], bufsz);
break;
}
xstrncpy(buf, desc->minmhz[idx], bufsz);
break;
}
@@ -1897,9 +1897,9 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
print_s(_("CPU dynamic MHz:"), desc->dynamic_mhz);
if (desc->static_mhz)
print_s(_("CPU static MHz:"), desc->static_mhz);
print_s(_("CPU dynamic MHz:"), desc->dynamic_mhz);
if (desc->static_mhz)
print_s(_("CPU static MHz:"), desc->static_mhz);
- if (desc->maxmhz)
+ if (desc->maxmhz && desc->maxmhz[0])
print_s(_("CPU max MHz:"), desc->maxmhz[0]);
print_s(_("CPU max MHz:"), desc->maxmhz[0]);
- if (desc->minmhz)
+ if (desc->minmhz && desc->minmhz[0])
print_s(_("CPU min MHz:"), desc->minmhz[0]);
if (desc->bogomips)
print_s(_("BogoMIPS:"), desc->bogomips);
--
print_s(_("CPU min MHz:"), desc->minmhz[0]);
if (desc->bogomips)
print_s(_("BogoMIPS:"), desc->bogomips);
--
2.9.4


31
SOURCES/0126-libmount-use-eacess-rather-than-open-to-check-mtab-u.patch

@ -20,27 +20,27 @@ index 78258d677..96c5838cf 100644 @@ -20,27 +20,27 @@ index 78258d677..96c5838cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,6 +315,7 @@ AC_CHECK_FUNCS([ \
__fpending \
secure_getenv \
__secure_getenv \
__fpending \
secure_getenv \
__secure_getenv \
+ eaccess \
err \
errx \
fsync \
err \
errx \
fsync \
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index 5c374b432..a275d0a0e 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -653,18 +653,25 @@ done:

static int try_write(const char *filename)
{
- int fd;
+ int rc = 0;

if (!filename)
return -EINVAL;

if (!filename)
return -EINVAL;
- fd = open(filename, O_RDWR|O_CREAT|O_CLOEXEC,
+#ifdef HAVE_EACCESS
+ if (eaccess(filename, R_OK|W_OK) != 0)
@ -48,7 +48,7 @@ index 5c374b432..a275d0a0e 100644 @@ -48,7 +48,7 @@ index 5c374b432..a275d0a0e 100644
+#else
+ {
+ int fd = open(filename, O_RDWR|O_CREAT|O_CLOEXEC,
S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH);
S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH);
- if (fd >= 0) {
- close(fd);
- return 0;
@ -56,12 +56,13 @@ index 5c374b432..a275d0a0e 100644 @@ -56,12 +56,13 @@ index 5c374b432..a275d0a0e 100644
+ rc = -errno;
+ else
+ close(fd);
}
}
- return -errno;
+#endif
+ return rc;
}

/**
--
--
2.13.6


21
SOURCES/0127-agetty-fix-etc-os-release-parsing.patch

@ -26,24 +26,25 @@ index 5692126dd..b626cdbeb 100644 @@ -26,24 +26,25 @@ index 5692126dd..b626cdbeb 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -1280,6 +1280,7 @@ static char *xgetdomainname(void)
return NULL;
return NULL;
}

+
static char *read_os_release(struct options *op, const char *varname)
{
int fd = -1;
int fd = -1;
@@ -1329,6 +1330,11 @@ static char *read_os_release(struct options *op, const char *varname)
continue;
}
p += varsz;
continue;
}
p += varsz;
+ p += strspn(p, " \t\n\r");
+
+ if (*p != '=')
+ continue;
+
p += strspn(p, " \t\n\r=\"");
eol = p + strcspn(p, "\n\r");
*eol = '\0';
--
p += strspn(p, " \t\n\r=\"");
eol = p + strcspn(p, "\n\r");
*eol = '\0';
--
2.13.6


5
SOURCES/0128-fdisk-remove-obsolete-info-about-GPT-from-man-page.patch

@ -25,8 +25,9 @@ index e4e585f12..39e4ad5c3 100644 @@ -25,8 +25,9 @@ index e4e585f12..39e4ad5c3 100644
-.BR parted (8).
+It understands GPT (experimental for now), MBR, Sun, SGI and BSD
+partition tables.

.B fdisk
does not use DOS-compatible mode and cylinders as display units by default.
--
--
2.13.6


55
SOURCES/0129-libfdisk-gpt-sync-type-UUIDs-with-upstream.patch

@ -19,12 +19,12 @@ index 612ce0971..de30b3dcb 100644 @@ -19,12 +19,12 @@ index 612ce0971..de30b3dcb 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -157,27 +157,53 @@ static struct fdisk_parttype gpt_parttypes[] =
DEF_GUID("C12A7328-F81F-11D2-BA4B-00A0C93EC93B", N_("EFI System")),

DEF_GUID("024DEE41-33E7-11D3-9D69-0008C781F39F", N_("MBR partition scheme")),
DEF_GUID("C12A7328-F81F-11D2-BA4B-00A0C93EC93B", N_("EFI System")),
DEF_GUID("024DEE41-33E7-11D3-9D69-0008C781F39F", N_("MBR partition scheme")),
+ DEF_GUID("D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", N_("Intel Fast Flash")),
+
/* Hah!IdontneedEFI */
/* Hah!IdontneedEFI */
- DEF_GUID("21686148-6449-6E6F-744E-656564454649", N_("BIOS boot partition")),
+ DEF_GUID("21686148-6449-6E6F-744E-656564454649", N_("BIOS boot")),
+
@ -38,27 +38,27 @@ index 612ce0971..de30b3dcb 100644 @@ -38,27 +38,27 @@ index 612ce0971..de30b3dcb 100644
+ /* Open Network Install Environment */
+ DEF_GUID("7412F7D5-A156-4B13-81DC-867174929325", N_("ONIE boot")),
+ DEF_GUID("D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149", N_("ONIE config")),

/* Windows */
DEF_GUID("E3C9E316-0B5C-4DB8-817D-F92DF00215AE", N_("Microsoft reserved")),
DEF_GUID("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", N_("Microsoft basic data")),
DEF_GUID("5808C8AA-7E8F-42E0-85D2-E1E90434CFB3", N_("Microsoft LDM metadata")),
DEF_GUID("AF9B60A0-1431-4F62-BC68-3311714A69AD", N_("Microsoft LDM data")),
/* Windows */
DEF_GUID("E3C9E316-0B5C-4DB8-817D-F92DF00215AE", N_("Microsoft reserved")),
DEF_GUID("EBD0A0A2-B9E5-4433-87C0-68B6B72699C7", N_("Microsoft basic data")),
DEF_GUID("5808C8AA-7E8F-42E0-85D2-E1E90434CFB3", N_("Microsoft LDM metadata")),
DEF_GUID("AF9B60A0-1431-4F62-BC68-3311714A69AD", N_("Microsoft LDM data")),
- DEF_GUID("DE94BBA4-06D1-4D40-A16A-BFD50179D6AC", N_("Windows recovery evironmnet")),
+ DEF_GUID("DE94BBA4-06D1-4D40-A16A-BFD50179D6AC", N_("Windows recovery environment")),
DEF_GUID("37AFFC90-EF7D-4E96-91C3-2D7AE055B174", N_("IBM General Parallel Fs")),
DEF_GUID("37AFFC90-EF7D-4E96-91C3-2D7AE055B174", N_("IBM General Parallel Fs")),
+ DEF_GUID("E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D", N_("Microsoft Storage Spaces")),

/* HP-UX */
/* HP-UX */
- DEF_GUID("75894C1E-3AEB-11D3-B7C1-7B03A0000000", N_("HP-UX data partition")),
- DEF_GUID("E2A1E728-32E3-11D6-A682-7B03A0000000", N_("HP-UX service partition")),
+ DEF_GUID("75894C1E-3AEB-11D3-B7C1-7B03A0000000", N_("HP-UX data")),
+ DEF_GUID("E2A1E728-32E3-11D6-A682-7B03A0000000", N_("HP-UX service")),

- /* Linux */
+ /* Linux (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec) */
+ DEF_GUID("0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", N_("Linux swap")),
DEF_GUID("0FC63DAF-8483-4772-8E79-3D69D8477DE4", N_("Linux filesystem")),
DEF_GUID("0FC63DAF-8483-4772-8E79-3D69D8477DE4", N_("Linux filesystem")),
+ DEF_GUID("3B8F8425-20E0-4F3B-907F-1A25A76F98E8", N_("Linux server data")),
+ DEF_GUID("44479540-F297-41B2-9AF7-D131D5F0458A", N_("Linux root (x86)")),
+ DEF_GUID("69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", N_("Linux root (ARM)")),
@ -67,26 +67,26 @@ index 612ce0971..de30b3dcb 100644 @@ -67,26 +67,26 @@ index 612ce0971..de30b3dcb 100644
+ DEF_GUID("993D8D3D-F80E-4225-855A-9DAF8ED7EA97", N_("Linux root (IA-64)")),
+ DEF_GUID("8DA63339-0007-60C0-C436-083AC8230908", N_("Linux reserved")),
+ DEF_GUID("933AC7E1-2EB4-4F13-B844-0E14E2AEF915", N_("Linux home")),
DEF_GUID("A19D880F-05FC-4D3B-A006-743F0F84911E", N_("Linux RAID")),
DEF_GUID("A19D880F-05FC-4D3B-A006-743F0F84911E", N_("Linux RAID")),
- DEF_GUID("0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", N_("Linux swap")),
+ DEF_GUID("BC13C2FF-59E6-4262-A352-B275FD6F7172", N_("Linux extended boot")),
DEF_GUID("E6D6D379-F507-44C2-A23C-238F2A3DF928", N_("Linux LVM")),
DEF_GUID("E6D6D379-F507-44C2-A23C-238F2A3DF928", N_("Linux LVM")),
- DEF_GUID("8DA63339-0007-60C0-C436-083AC8230908", N_("Linux reserved")),
+ /* ... too crazy, ignore for now:
+ DEF_GUID("7FFEC5C9-2D00-49B7-8941-3EA10A5586B7", N_("Linux plain dm-crypt")),
+ DEF_GUID("CA7D7CCB-63ED-4C53-861C-1742536059CC", N_("Linux LUKS")),
+ */

/* FreeBSD */
DEF_GUID("516E7CB4-6ECF-11D6-8FF8-00022D09712B", N_("FreeBSD data")),
/* FreeBSD */
DEF_GUID("516E7CB4-6ECF-11D6-8FF8-00022D09712B", N_("FreeBSD data")),
@@ -230,9 +256,26 @@ static struct fdisk_parttype gpt_parttypes[] =
DEF_GUID("85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD data")),
DEF_GUID("85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD boot")),
DEF_GUID("85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD swap")),
DEF_GUID("85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD data")),
DEF_GUID("85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD boot")),
DEF_GUID("85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD swap")),
- DEF_GUID("0394Ef8B-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD UFS")),
+ DEF_GUID("0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD UFS")),
DEF_GUID("85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD ZFS")),
DEF_GUID("85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD Vinum")),
DEF_GUID("85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD ZFS")),
DEF_GUID("85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7", N_("MidnightBSD Vinum")),
+
+ /* Ceph */
+ DEF_GUID("45B0969E-9B03-4F30-B4C6-B4B80CEFF106", N_("Ceph Journal")),
@ -105,7 +105,8 @@ index 612ce0971..de30b3dcb 100644 @@ -105,7 +105,8 @@ index 612ce0971..de30b3dcb 100644
+ /* Plan 9 */
+ DEF_GUID("C91818F9-8025-47AF-89D2-F030D7000C2C", N_("Plan 9 partition"))
};

/* gpt_entry macros */
--
--
2.13.6


61
SOURCES/0130-lscpu-cleanup-DMI-detection-return-codes.patch

@ -25,62 +25,63 @@ index a8298ff74..e4afd0b92 100644 @@ -25,62 +25,63 @@ index a8298ff74..e4afd0b92 100644
@@ -172,7 +172,7 @@ done:
static int hypervisor_decode_legacy(uint8_t *buf, const char *devmem)
{
if (!checksum(buf, 0x0F))
if (!checksum(buf, 0x0F))
- return HYPER_NONE;
+ return -1;

return hypervisor_from_dmi_table(DWORD(buf + 0x08), WORD(buf + 0x06),
WORD(buf + 0x0C),
return hypervisor_from_dmi_table(DWORD(buf + 0x08), WORD(buf + 0x06),
WORD(buf + 0x0C),
@@ -252,11 +252,15 @@ int read_hypervisor_dmi(void)
|| sizeof(uint16_t) != 2
|| sizeof(uint32_t) != 4
|| '\0' != 0)
|| sizeof(uint16_t) != 2
|| sizeof(uint32_t) != 4
|| '\0' != 0)
- return rc;
+ goto done;

+ /* -1 : no DMI in /sys,
+ * 0 : DMI exist, nothing detected (HYPER_NONE)
+ * >0 : hypervisor detected
+ */
rc = hypervisor_decode_sysfw();
rc = hypervisor_decode_sysfw();
- if (rc >= 0)
- return rc;
+ if (rc >= HYPER_NONE)
+ goto done;

/* First try EFI (ia64, Intel-based Mac) */
switch (address_from_efi(&fp)) {
/* First try EFI (ia64, Intel-based Mac) */
switch (address_from_efi(&fp)) {
@@ -271,8 +275,9 @@ int read_hypervisor_dmi(void)
goto done;

rc = hypervisor_decode_smbios(buf, _PATH_DEV_MEM);
goto done;
rc = hypervisor_decode_smbios(buf, _PATH_DEV_MEM);
- if (rc)
+ if (rc >= HYPER_NONE)
goto done;
goto done;
+
free(buf);
buf = NULL;
free(buf);
buf = NULL;
memory_scan:
@@ -285,17 +290,17 @@ memory_scan:
for (fp = 0; fp <= 0xFFF0; fp += 16) {
if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) {
rc = hypervisor_decode_smbios(buf + fp, _PATH_DEV_MEM);
for (fp = 0; fp <= 0xFFF0; fp += 16) {
if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) {
rc = hypervisor_decode_smbios(buf + fp, _PATH_DEV_MEM);
- if (rc == -1)
+ if (rc < 0)
fp += 16;

} else if (memcmp(buf + fp, "_DMI_", 5) == 0)
rc = hypervisor_decode_legacy(buf + fp, _PATH_DEV_MEM);

fp += 16;
} else if (memcmp(buf + fp, "_DMI_", 5) == 0)
rc = hypervisor_decode_legacy(buf + fp, _PATH_DEV_MEM);
- if (rc >= 0)
+ if (rc >= HYPER_NONE)
break;
}
break;
}
#endif
done:
free(buf);
free(buf);
- return rc;
+ return rc < 0 ? HYPER_NONE : rc;
}
--
--
2.13.6


15
SOURCES/0131-flock-zero-timeout-is-valid.patch

@ -37,13 +37,14 @@ index 18625a029..7dad46af0 100644 @@ -37,13 +37,14 @@ index 18625a029..7dad46af0 100644
--- a/sys-utils/flock.c
+++ b/sys-utils/flock.c
@@ -175,8 +175,6 @@ int main(int argc, char *argv[])
have_timeout = 1;
strtotimeval_or_err(optarg, &timeout.it_value,
_("invalid timeout value"));
have_timeout = 1;
strtotimeval_or_err(optarg, &timeout.it_value,
_("invalid timeout value"));
- if (timeout.it_value.tv_sec + timeout.it_value.tv_usec == 0)
- errx(EX_USAGE, _("timeout cannot be zero"));
break;
case 'E':
conflict_exit_code = strtos32_or_err(optarg,
--
break;
case 'E':
conflict_exit_code = strtos32_or_err(optarg,
--
2.13.6


3
SOURCES/0132-logger-add-man-page-note-about-the-default-tag.patch

@ -23,5 +23,6 @@ index 57ca0d55a..3b55c8d7d 100644 @@ -23,5 +23,6 @@ index 57ca0d55a..3b55c8d7d 100644
.TP
\fB\-u\fR, \fB\-\-socket\fR \fIsocket\fR
Write to the specified
--
--
2.13.6


45
SOURCES/0133-script-use-all-io-to-write.patch

@ -18,43 +18,44 @@ index 242b8154a..5840b600d 100644 @@ -18,43 +18,44 @@ index 242b8154a..5840b600d 100644
#include "nls.h"
#include "c.h"
+#include "all-io.h"

#if defined(HAVE_LIBUTIL) && defined(HAVE_PTY_H)
# include <pty.h>
@@ -301,8 +302,7 @@ doinput(void) {

while (die == 0) {
if ((cc = read(STDIN_FILENO, ibuf, BUFSIZ)) > 0) {
while (die == 0) {
if ((cc = read(STDIN_FILENO, ibuf, BUFSIZ)) > 0) {
- ssize_t wrt = write(master, ibuf, cc);
- if (wrt < 0) {
+ if (write_all(master, ibuf, cc)) {
warn (_("write failed"));
fail();
}
warn (_("write failed"));
fail();
}
@@ -355,8 +355,6 @@ dooutput(FILE *timingfd) {
struct timeval tv;
double oldtime=time(NULL), newtime;
int flgs = 0;
struct timeval tv;
double oldtime=time(NULL), newtime;
int flgs = 0;
- ssize_t wrt;
- ssize_t fwrt;

close(STDIN_FILENO);
close(STDIN_FILENO);
#ifdef HAVE_LIBUTIL
@@ -393,13 +391,11 @@ dooutput(FILE *timingfd) {
fprintf(timingfd, "%f %zd\n", newtime - oldtime, cc);
oldtime = newtime;
}
fprintf(timingfd, "%f %zd\n", newtime - oldtime, cc);
oldtime = newtime;
}
- wrt = write(STDOUT_FILENO, obuf, cc);
- if (wrt < 0) {
+ if (write_all(STDOUT_FILENO, obuf, cc)) {
warn (_("write failed"));
fail();
}
warn (_("write failed"));
fail();
}
- fwrt = fwrite(obuf, 1, cc, fscript);
- if (fwrt < cc) {
+ if (fwrite_all(obuf, 1, cc, fscript)) {
warn (_("cannot write script file"));
fail();
}
--
warn (_("cannot write script file"));
fail();
}
--
2.13.6


31
SOURCES/0134-logger-do-not-rely-only-getlogin-3-telling-who-ran-t.patch

@ -25,13 +25,13 @@ index dfda01866..c1cec45e8 100644 @@ -25,13 +25,13 @@ index dfda01866..c1cec45e8 100644
#include <getopt.h>
+#include <sys/types.h>
+#include <pwd.h>

#include "c.h"
#include "closestream.h"
@@ -183,9 +185,20 @@ inet_socket(const char *servername, const char *port, const int socket_type)
return fd;
return fd;
}

+static char const *xgetlogin(void)
+{
+ char const *cp;
@ -48,12 +48,12 @@ index dfda01866..c1cec45e8 100644 @@ -48,12 +48,12 @@ index dfda01866..c1cec45e8 100644
+ char *buf, pid[30], *tp;
+ const char *cp;
time_t now;

if (fd > -1) {
@@ -193,13 +206,7 @@ mysyslog(int fd, int logflags, int pri, char *tag, char *msg) {
snprintf (pid, sizeof(pid), "[%d]", getpid());
else
pid[0] = 0;
else
pid[0] = 0;
- if (tag)
- cp = tag;
- else {
@ -63,16 +63,17 @@ index dfda01866..c1cec45e8 100644 @@ -63,16 +63,17 @@ index dfda01866..c1cec45e8 100644
- }
+ cp = tag ? tag : xgetlogin();
(void)time(&now);
tp = ctime(&now)+4;

tp = ctime(&now)+4;
@@ -334,7 +341,7 @@ main(int argc, char **argv) {
else if (usock)
LogSock = unix_socket(usock, socket_type);
else
else if (usock)
LogSock = unix_socket(usock, socket_type);
else
- openlog(tag ? tag : getlogin(), logflags, 0);
+ openlog(tag ? tag : xgetlogin(), logflags, 0);

buf = xcalloc(1, max_message_size);

--
buf = xcalloc(1, max_message_size);
--
2.13.6


17
SOURCES/0135-login-use-IPv4-on-IPv4-mapping-to-IPv6.patch

@ -31,21 +31,22 @@ index e0e960f88..5c36953ef 100644 @@ -31,21 +31,22 @@ index e0e960f88..5c36953ef 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -1101,8 +1101,15 @@ static void init_remote_info(struct login_context *cxt, char *remotehost)
} else if (info->ai_family == AF_INET6) {
struct sockaddr_in6 *sa =
(struct sockaddr_in6 *) info->ai_addr;
} else if (info->ai_family == AF_INET6) {
struct sockaddr_in6 *sa =
(struct sockaddr_in6 *) info->ai_addr;
+#ifdef IN6_IS_ADDR_V4MAPPED
+ if (IN6_IS_ADDR_V4MAPPED(&sa->sin6_addr)) {
+ const uint8_t *bytes = sa->sin6_addr.s6_addr;
+ struct in_addr addr = { *(const in_addr_t *) (bytes + 12) };

- memcpy(cxt->hostaddress, &(sa->sin6_addr), sizeof(sa->sin6_addr));
+ memcpy(cxt->hostaddress, &addr, sizeof(struct in_addr));
+ } else
+#endif
+ memcpy(cxt->hostaddress, &(sa->sin6_addr), sizeof(sa->sin6_addr));
}
freeaddrinfo(info);
}
--
}
freeaddrinfo(info);
}
--
2.13.6


7
SOURCES/0136-blkid-update-man-page-about-lsblk-and-ambivalent-pro.patch

@ -72,13 +72,14 @@ index a974b8e99..1f12d202a 100644 @@ -72,13 +72,14 @@ index a974b8e99..1f12d202a 100644
The \fIsize\fR and \fIoffset\fR arguments may be followed by the multiplicative
suffixes like KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB
@@ -264,7 +279,7 @@ identified, an exit code of 2 is returned.

For usage or other errors, an exit code of 4 is returned.

-If an ambivalent low-level probing result was detected, an exit code of 8 is
+If an ambivalent probing result was detected by low-level probing mode (\fB\-p\fR), an exit code of 8 is
returned.
.SH CONFIGURATION FILE
The standard location of the
--
--
2.13.6


59
SOURCES/0137-wipefs-fix-t-filter.patch

@ -15,54 +15,55 @@ index 0144c9ef8..a0852aa97 100644 @@ -15,54 +15,55 @@ index 0144c9ef8..a0852aa97 100644
+++ b/misc-utils/wipefs.c
@@ -162,13 +162,16 @@ clone_offset(struct wipe_desc *wp0)
}

static struct wipe_desc *
-get_desc_for_probe(struct wipe_desc *wp, blkid_probe pr)
+get_desc_for_probe(struct wipe_desc *wp, blkid_probe pr, int *found)
{
const char *off, *type, *mag, *p, *usage = NULL;
size_t len;
loff_t offset;
int rc, ispt = 0;

const char *off, *type, *mag, *p, *usage = NULL;
size_t len;
loff_t offset;
int rc, ispt = 0;
+ if (found)
+ *found = 0;
+
/* superblocks */
if (blkid_probe_lookup_value(pr, "TYPE", &type, NULL) == 0) {
rc = blkid_probe_lookup_value(pr, "SBMAGIC_OFFSET", &off, NULL);
/* superblocks */
if (blkid_probe_lookup_value(pr, "TYPE", &type, NULL) == 0) {
rc = blkid_probe_lookup_value(pr, "SBMAGIC_OFFSET", &off, NULL);
@@ -215,6 +218,8 @@ get_desc_for_probe(struct wipe_desc *wp, blkid_probe pr)
if (blkid_probe_lookup_value(pr, "UUID", &p, NULL) == 0)
wp->uuid = xstrdup(p);

if (blkid_probe_lookup_value(pr, "UUID", &p, NULL) == 0)
wp->uuid = xstrdup(p);
+ if (found)
+ *found = 1;
return wp;
return wp;
}

@@ -266,7 +271,7 @@ read_offsets(struct wipe_desc *wp, const char *devname)
return NULL;

while (blkid_do_probe(pr) == 0) {
return NULL;
while (blkid_do_probe(pr) == 0) {
- wp = get_desc_for_probe(wp, pr);
+ wp = get_desc_for_probe(wp, pr, NULL);
if (!wp)
break;
}
if (!wp)
break;
}
@@ -347,9 +352,13 @@ do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet
wp0 = clone_offset(wp);

while (blkid_do_probe(pr) == 0) {
wp0 = clone_offset(wp);
while (blkid_do_probe(pr) == 0) {
- wp = get_desc_for_probe(wp, pr);
+ int found = 0;
+
+ wp = get_desc_for_probe(wp, pr, &found);
if (!wp)
break;
if (!wp)
break;
+ if (!found)
+ continue;

/* Check if offset is in provided list */
w = wp0;
--
/* Check if offset is in provided list */
w = wp0;
--
2.13.6


19
SOURCES/0138-tests-backport-new-ts_scsi_debug_init.patch

@ -14,18 +14,18 @@ index 0d1c9c88a..b930dfe7e 100644 @@ -14,18 +14,18 @@ index 0d1c9c88a..b930dfe7e 100644
+++ b/tests/functions.sh
@@ -502,21 +502,77 @@ function ts_fdisk_clean {
}

function ts_scsi_debug_init {
+ local devname
+ local t
+ TS_DEVICE="none"

- modprobe --dry-run --quiet scsi_debug
- [ "$?" == 0 ] || ts_skip "missing scsi_debug module"
+ # dry run is not really reliable, real modprobe may still fail
+ modprobe --dry-run --quiet scsi_debug &>/dev/null \
+ || ts_skip "missing scsi_debug module (dry-run)"

- rmmod scsi_debug &> /dev/null
- modprobe scsi_debug $*
- [ "$?" == 0 ] || ts_die "Cannot init device"
@ -33,20 +33,20 @@ index 0d1c9c88a..b930dfe7e 100644 @@ -33,20 +33,20 @@ index 0d1c9c88a..b930dfe7e 100644
+ # We don't want a slow timeout here so we don't use ts_scsi_debug_rmmod!
+ modprobe -r scsi_debug &>/dev/null \
+ || ts_skip "cannot remove scsi_debug module (rmmod)"

- DEVNAME=$(grep --with-filename scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
- [ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
+ modprobe -b scsi_debug "$@" &>/dev/null \
+ || ts_skip "cannot load scsi_debug module (modprobe)"

- DEVICE="/dev/${DEVNAME}"
+ # it might be still not loaded, modprobe.conf or whatever
+ lsmod 2>/dev/null | grep -q "^scsi_debug " \
+ || ts_skip "scsi_debug module not loaded (lsmod)"

- sleep 1
udevadm settle

udevadm settle
- echo $DEVICE
+ # wait for device if udevadm settle does not work
+ for t in 0 0.02 0.05 0.1 1; do
@ -100,5 +100,6 @@ index 0d1c9c88a..b930dfe7e 100644 @@ -100,5 +100,6 @@ index 0d1c9c88a..b930dfe7e 100644
+
+ return 0
}
--
--
2.13.6


163
SOURCES/0139-tests-ts_scsi_debug_init-must-not-run-in-a-subshell.patch

@ -35,11 +35,11 @@ index 46bde0ec8..20612ec21 100755 @@ -35,11 +35,11 @@ index 46bde0ec8..20612ec21 100755
@@ -23,10 +23,11 @@ TS_DESC="MD raid1 (last partition)"
ts_init "$*"
ts_skip_nonroot

-DEVICE=$(ts_scsi_debug_init dev_size_mb=51 sector_size=512)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=51 sector_size=512

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
@ -49,7 +49,7 @@ index 46bde0ec8..20612ec21 100755 @@ -49,7 +49,7 @@ index 46bde0ec8..20612ec21 100755
@@ -42,6 +43,16 @@ w
q
EOF

+# replace generated ID with something stable
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <<EOF
+x
@ -70,24 +70,24 @@ index 46bde0ec8..20612ec21 100755 @@ -70,24 +70,24 @@ index 46bde0ec8..20612ec21 100755
- --raid-devices=2 ${DEVICE}1 ${DEVICE}2 >> $TS_OUTPUT 2>&1
+ --raid-devices=2 ${TS_DEVICE}1 ${TS_DEVICE}2 >> $TS_OUTPUT 2>&1
udevadm settle

ts_log "Probe whole-disk"
-$TS_CMD_BLKID -p -o udev ${DEVICE} 2>&1 | sort >> $TS_OUTPUT
+$TS_CMD_BLKID -p -o udev ${TS_DEVICE} 2>&1 | sort >> $TS_OUTPUT

ts_log "Probe first RAID member"
-$TS_CMD_BLKID -p -o udev ${DEVICE}1 2>&1 | sort >> $TS_OUTPUT
+$TS_CMD_BLKID -p -o udev ${TS_DEVICE}1 2>&1 | sort >> $TS_OUTPUT

ts_log "Probe second RAID member"
-$TS_CMD_BLKID -p -o udev ${DEVICE}2 2>&1 | sort >> $TS_OUTPUT
+$TS_CMD_BLKID -p -o udev ${TS_DEVICE}2 2>&1 | sort >> $TS_OUTPUT

/sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1

udevadm settle
rmmod scsi_debug

-ts_fdisk_clean $DEVICE
+ts_fdisk_clean $TS_DEVICE
# substitue UUIDs and major/minor number before comparison
@ -100,14 +100,14 @@ index 3c1f84edf..994ddb483 100755 @@ -100,14 +100,14 @@ index 3c1f84edf..994ddb483 100755
@@ -12,6 +12,7 @@ ts_skip_nonroot
# not removable device.
#

+# set global variable TS_DEVICE
function init_device {
ts_scsi_debug_init dev_size_mb=100
ts_scsi_debug_init dev_size_mb=100
}
@@ -47,50 +48,50 @@ function deinit_device {


ts_init_subtest "by-disk"
-DEVICE=$(init_device)
-$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
@ -115,7 +115,7 @@ index 3c1f84edf..994ddb483 100755 @@ -115,7 +115,7 @@ index 3c1f84edf..994ddb483 100755
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
deinit_device
ts_finalize_subtest

ts_init_subtest "by-disk-mounted"
-DEVICE=$(init_device)
-mkfs.ext2 -q -F $DEVICE
@ -129,8 +129,8 @@ index 3c1f84edf..994ddb483 100755 @@ -129,8 +129,8 @@ index 3c1f84edf..994ddb483 100755
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
deinit_device
ts_finalize_subtest


ts_init_subtest "by-disk-mounted-partition"
-DEVICE=$(init_device)
-init_partitions $DEVICE
@ -146,8 +146,8 @@ index 3c1f84edf..994ddb483 100755 @@ -146,8 +146,8 @@ index 3c1f84edf..994ddb483 100755
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
deinit_device
ts_finalize_subtest


ts_init_subtest "by-partition"
-DEVICE=$(init_device)
-init_partitions $DEVICE
@ -157,8 +157,8 @@ index 3c1f84edf..994ddb483 100755 @@ -157,8 +157,8 @@ index 3c1f84edf..994ddb483 100755
+$TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success"
deinit_device
ts_finalize_subtest


ts_init_subtest "by-partition-mounted"
-DEVICE=$(init_device)
-init_partitions $DEVICE
@ -174,7 +174,7 @@ index 3c1f84edf..994ddb483 100755 @@ -174,7 +174,7 @@ index 3c1f84edf..994ddb483 100755
+$TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success"
deinit_device
ts_finalize_subtest

diff --git a/tests/ts/fdisk/align-512-4K b/tests/ts/fdisk/align-512-4K
index c5ea72e7a..5608b1b65 100755
--- a/tests/ts/fdisk/align-512-4K
@ -182,13 +182,13 @@ index c5ea72e7a..5608b1b65 100755 @@ -182,13 +182,13 @@ index c5ea72e7a..5608b1b65 100755
@@ -27,11 +27,12 @@ TS_DESC="align 512/4K"
ts_init "$*"
ts_skip_nonroot

-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3)
-DEVNAME=$(basename $DEVICE)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3
+DEVNAME=$(basename $TS_DEVICE)

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
@ -196,12 +196,12 @@ index c5ea72e7a..5608b1b65 100755 @@ -196,12 +196,12 @@ index c5ea72e7a..5608b1b65 100755
p
1
@@ -71,6 +72,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP

rmmod scsi_debug

-ts_fdisk_clean $DEVICE
+ts_fdisk_clean $TS_DEVICE

ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K-63 b/tests/ts/fdisk/align-512-4K-63
index 4ec81982f..8199cf7b3 100755
@ -210,13 +210,13 @@ index 4ec81982f..8199cf7b3 100755 @@ -210,13 +210,13 @@ index 4ec81982f..8199cf7b3 100755
@@ -27,11 +27,12 @@ TS_DESC="align 512/4K +alignment_offset"
ts_init "$*"
ts_skip_nonroot

-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3 lowest_aligned=7)
-DEVNAME=$(basename $DEVICE)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3 lowest_aligned=7
+DEVNAME=$(basename $TS_DEVICE)

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
@ -224,12 +224,12 @@ index 4ec81982f..8199cf7b3 100755 @@ -224,12 +224,12 @@ index 4ec81982f..8199cf7b3 100755
p
1
@@ -71,6 +72,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP

rmmod scsi_debug

-ts_fdisk_clean $DEVICE
+ts_fdisk_clean $TS_DEVICE

ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K-md b/tests/ts/fdisk/align-512-4K-md
index 09947ff9e..ad662e0e8 100755
@ -238,13 +238,13 @@ index 09947ff9e..ad662e0e8 100755 @@ -238,13 +238,13 @@ index 09947ff9e..ad662e0e8 100755
@@ -27,11 +27,12 @@ TS_DESC="align 512/4K +MD"
ts_init "$*"
ts_skip_nonroot

-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3)
-DEVNAME=$(basename $DEVICE)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3
+DEVNAME=$(basename $TS_DEVICE)

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
@ -252,22 +252,22 @@ index 09947ff9e..ad662e0e8 100755 @@ -252,22 +252,22 @@ index 09947ff9e..ad662e0e8 100755
p
1
@@ -56,7 +57,7 @@ MD_DEVICE=/dev/${MD_DEVNAME}

/sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null
/sbin/mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 \
- --level=0 --raid-devices=2 ${DEVICE}1 ${DEVICE}2 >> $TS_OUTPUT 2>&1
+ --level=0 --raid-devices=2 ${TS_DEVICE}1 ${TS_DEVICE}2 >> $TS_OUTPUT 2>&1

udevadm settle
ts_log "Create partitions (MD)"
@@ -85,6 +86,7 @@ cat /sys/block/${MD_DEVNAME}/${MD_DEVNAME}p{1,2}/alignment_offset >> $TS_OUTPUT
udevadm settle
rmmod scsi_debug

-ts_fdisk_clean $DEVICE
+ts_fdisk_clean $TS_DEVICE
+ts_fdisk_clean $MD_DEVICE

ts_finalize
diff --git a/tests/ts/fdisk/align-512-512-topology b/tests/ts/fdisk/align-512-512-topology
index 9354e45c7..65cb03f1d 100755
@ -276,14 +276,14 @@ index 9354e45c7..65cb03f1d 100755 @@ -276,14 +276,14 @@ index 9354e45c7..65cb03f1d 100755
@@ -27,12 +27,12 @@ TS_DESC="align 512/512 +topology"
ts_init "$*"
ts_skip_nonroot

-
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512)
-DEVNAME=$(basename $DEVICE)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=50 sector_size=512
+DEVNAME=$(basename $TS_DEVICE)

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
@ -291,12 +291,12 @@ index 9354e45c7..65cb03f1d 100755 @@ -291,12 +291,12 @@ index 9354e45c7..65cb03f1d 100755
p
1
@@ -72,6 +72,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP

rmmod scsi_debug

-ts_fdisk_clean $DEVICE
+ts_fdisk_clean $TS_DEVICE

ts_finalize
diff --git a/tests/ts/libmount/context b/tests/ts/libmount/context
index 0c3bce986..873890378 100755
@ -305,13 +305,13 @@ index 0c3bce986..873890378 100755 @@ -305,13 +305,13 @@ index 0c3bce986..873890378 100755
@@ -21,11 +21,12 @@ TS_NOEXIST="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-noex"
ts_log "Init device"
umount $MOUNTPOINT &> /dev/null

-DEVICE=$(ts_scsi_debug_init dev_size_mb=100)
-DEVNAME=$(basename $DEVICE)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=100
+DEVNAME=$(basename $TS_DEVICE)

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <<EOF
@ -321,10 +321,10 @@ index 0c3bce986..873890378 100755 @@ -321,10 +321,10 @@ index 0c3bce986..873890378 100755
@@ -35,7 +36,7 @@ w
q
EOF

-DEVICE="${DEVICE}1"
+DEVICE="${TS_DEVICE}1"

sleep 1
udevadm settle
diff --git a/tests/ts/libmount/context-utab b/tests/ts/libmount/context-utab
@ -332,15 +332,15 @@ index b2bfefc69..d57a64e6d 100755 @@ -332,15 +332,15 @@ index b2bfefc69..d57a64e6d 100755
--- a/tests/ts/libmount/context-utab
+++ b/tests/ts/libmount/context-utab
@@ -16,11 +16,12 @@ MOUNTPOINT="$TS_MOUNTPOINT"

[ -x $TESTPROG ] || ts_skip "test not compiled"

-DEVICE=$(ts_scsi_debug_init dev_size_mb=100)
-DEVNAME=$(basename $DEVICE)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=100
+DEVNAME=$(basename $TS_DEVICE)

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <<EOF
@ -350,10 +350,10 @@ index b2bfefc69..d57a64e6d 100755 @@ -350,10 +350,10 @@ index b2bfefc69..d57a64e6d 100755
@@ -30,7 +31,7 @@ w
q
EOF

-DEVICE="${DEVICE}1"
+DEVICE="${TS_DEVICE}1"

sleep 1
udevadm settle
diff --git a/tests/ts/libmount/tabfiles-tags b/tests/ts/libmount/tabfiles-tags
@ -361,51 +361,51 @@ index f52c4047c..fbd7daf47 100755 @@ -361,51 +361,51 @@ index f52c4047c..fbd7daf47 100755
--- a/tests/ts/libmount/tabfiles-tags
+++ b/tests/ts/libmount/tabfiles-tags
@@ -11,17 +11,18 @@ TESTPROG="$TS_HELPER_LIBMOUNT_TAB"

[ -x $TESTPROG ] || ts_skip "test not compiled"

-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=50 sector_size=512
LABEL="testLibmount"
UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"

#
# Create filesystem
#
-mkfs.ext3 -F -L $LABEL $DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 -F -L $LABEL $TS_DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $TS_DEVICE" $TS_DEVICE
udevadm settle

-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $TS_DEVICE || ts_die "Cannot find UUID on $TS_DEVICE" $TS_DEVICE

FSTAB="$TS_OUTDIR/fstab"

@@ -36,7 +37,7 @@ sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "fstab-label2dev"
-ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
+ts_valgrind $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest

@@ -60,18 +61,18 @@ ts_finalize_subtest

ts_init_subtest "fstab-dev2label"
# has to return /mnt/mountpoint
-ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
+ts_valgrind $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest

#
# Add devname
#
-echo "$DEVICE /mnt/mountpoint3 auto defaults" >> $FSTAB
+echo "$TS_DEVICE /mnt/mountpoint3 auto defaults" >> $FSTAB

ts_init_subtest "fstab-dev"
# has to return /mnt/mountpoint3
-ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
@ -420,11 +420,11 @@ index 434ecab2d..ae35e320a 100755 @@ -420,11 +420,11 @@ index 434ecab2d..ae35e320a 100755
@@ -12,10 +12,11 @@ ts_skip_nonroot
$TS_CMD_UMOUNT --help | grep -q all-targets
[ $? -eq 1 ] && ts_skip "all-targets unsupported"

-DEVICE=$(ts_scsi_debug_init dev_size_mb=50)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=50

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <<EOF
@ -433,7 +433,7 @@ index 434ecab2d..ae35e320a 100755 @@ -433,7 +433,7 @@ index 434ecab2d..ae35e320a 100755
1
@@ -42,13 +43,13 @@ EOF
udevadm settle

ts_log "Create filesystem A"
-mkfs.ext2 ${DEVICE}1 &> /dev/null
+mkfs.ext2 ${TS_DEVICE}1 &> /dev/null
@ -446,9 +446,9 @@ index 434ecab2d..ae35e320a 100755 @@ -446,9 +446,9 @@ index 434ecab2d..ae35e320a 100755
ts_log "Create filesystem D"
-mkfs.ext2 ${DEVICE}4 &> /dev/null
+mkfs.ext2 ${TS_DEVICE}4 &> /dev/null

udevadm settle

@@ -76,7 +77,7 @@ MOUNTPOINT=$TS_MOUNTPOINT
# The same device mounted on more places, umount all by mountpoint name
#
@ -468,7 +468,7 @@ index 434ecab2d..ae35e320a 100755 @@ -468,7 +468,7 @@ index 434ecab2d..ae35e320a 100755
+$TS_CMD_UMOUNT --all-targets ${TS_DEVICE}1 >> $TS_OUTPUT 2>&1
[ $? == 0 ] || ts_log "umount failed"
ts_finalize_subtest

@@ -95,14 +96,14 @@ ts_finalize_subtest
# sub-mounts. Umount all by one umount all by top-level device name.
#
@ -488,19 +488,19 @@ index 434ecab2d..ae35e320a 100755 @@ -488,19 +488,19 @@ index 434ecab2d..ae35e320a 100755
+$TS_CMD_UMOUNT --recursive --all-targets ${TS_DEVICE}1 >> $TS_OUTPUT 2>&1
[ $? == 0 ] || ts_log "umount failed"
ts_finalize_subtest

diff --git a/tests/ts/mount/umount-recursive b/tests/ts/mount/umount-recursive
index 85e54df7a..9b9a7a1f1 100755
--- a/tests/ts/mount/umount-recursive
+++ b/tests/ts/mount/umount-recursive
@@ -13,10 +13,11 @@ $TS_CMD_UMOUNT --help | grep -q recursive
[ $? -eq 1 ] && ts_skip "recursive unsupported"

ts_log "Init device"
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=50

ts_log "Create partitions"
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <<EOF
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <<EOF
@ -509,7 +509,7 @@ index 85e54df7a..9b9a7a1f1 100755 @@ -509,7 +509,7 @@ index 85e54df7a..9b9a7a1f1 100755
1
@@ -43,13 +44,13 @@ EOF
udevadm settle

ts_log "Create filesystem A"
-mkfs.ext2 ${DEVICE}1 &> /dev/null
+mkfs.ext2 ${TS_DEVICE}1 &> /dev/null
@ -522,36 +522,37 @@ index 85e54df7a..9b9a7a1f1 100755 @@ -522,36 +522,37 @@ index 85e54df7a..9b9a7a1f1 100755
ts_log "Create filesystem D"
-mkfs.ext2 ${DEVICE}4 &> /dev/null
+mkfs.ext2 ${TS_DEVICE}4 &> /dev/null

udevadm settle

@@ -58,12 +59,12 @@ ts_log "Do tests..."
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT

ts_log "A) Mount root"
-$TS_CMD_MOUNT ${DEVICE}1 $TS_MOUNTPOINT >> $TS_OUTPUT 2>&1
+$TS_CMD_MOUNT ${TS_DEVICE}1 $TS_MOUNTPOINT >> $TS_OUTPUT 2>&1
$TS_CMD_MOUNT --make-shared $TS_MOUNTPOINT

ts_log "B) Mount child"
mkdir -p $TS_MOUNTPOINT/mntB
-$TS_CMD_MOUNT ${DEVICE}2 $TS_MOUNTPOINT/mntB >> $TS_OUTPUT 2>&1
+$TS_CMD_MOUNT ${TS_DEVICE}2 $TS_MOUNTPOINT/mntB >> $TS_OUTPUT 2>&1

ts_log "B2) Mount child-bind"
mkdir -p $TS_MOUNTPOINT/bindB
@@ -71,10 +72,10 @@ $TS_CMD_MOUNT --bind $TS_MOUNTPOINT/mntB $TS_MOUNTPOINT/bindB >> $TS_OUTPUT 2>&1

ts_log "C) Mount child/child"
mkdir -p $TS_MOUNTPOINT/mntB/mnt{C,D}
-$TS_CMD_MOUNT ${DEVICE}3 $TS_MOUNTPOINT/mntB/mntC >> $TS_OUTPUT 2>&1
+$TS_CMD_MOUNT ${TS_DEVICE}3 $TS_MOUNTPOINT/mntB/mntC >> $TS_OUTPUT 2>&1

ts_log "D) Mount child/child"
-$TS_CMD_MOUNT ${DEVICE}4 $TS_MOUNTPOINT/mntB/mntD >> $TS_OUTPUT 2>&1
+$TS_CMD_MOUNT ${TS_DEVICE}4 $TS_MOUNTPOINT/mntB/mntD >> $TS_OUTPUT 2>&1

ts_log "E) Mount child-bind"
mkdir -p $TS_MOUNTPOINT/bindC
--
--
2.13.6


31
SOURCES/0140-tests-cleanup-fdisk-outputs.patch

@ -17,40 +17,40 @@ index e8f6ba161..336c9e019 100644 @@ -17,40 +17,40 @@ index e8f6ba161..336c9e019 100644
+++ b/tests/expected/fdisk/align-512-4K-md
@@ -69,7 +69,7 @@ Select (default p): Partition number (2-4, default 2): First sector (22528-10009
Last sector, +sectors or +size{K,M,G} (22528-100095, default 100095): Partition 2 of type Linux and of size 10 MiB is set

Command (m for help):
Command (m for help):
-Disk /dev/md8: 51 MB, 51249152 bytes, 100096 sectors
+Disk /dev/...: 51 MB, 51249152 bytes, 100096 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 65536 bytes / <removed> bytes
@@ -77,8 +77,8 @@ Disk label type: dos


Device Boot Start End Blocks Id System
-/dev/md8p1 2048 22527 10240 83 Linux
-/dev/md8p2 22528 43007 10240 83 Linux
+/dev/...p1 2048 22527 10240 83 Linux
+/dev/...p2 22528 43007 10240 83 Linux

Command (m for help): The partition table has been altered!

diff --git a/tests/expected/fdisk/align-512-512 b/tests/expected/fdisk/align-512-512
index 8e03d900d..f9cbb0e89 100644
--- a/tests/expected/fdisk/align-512-512
+++ b/tests/expected/fdisk/align-512-512
@@ -50,7 +50,7 @@ Last sector, +sectors or +size{K,M,G} (90112-102399, default 102399): Using defa
Partition 7 of type Linux and of size 6 MiB is set

Command (m for help):
Command (m for help):
-Disk /dev/loop0: 52 MB, 52428800 bytes, 102400 sectors
+Disk /dev/...: 52 MB, 52428800 bytes, 102400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / <removed> bytes
@@ -58,12 +58,12 @@ Disk label type: dos


Device Boot Start End Blocks Id System
-/dev/loop0p1 2048 22527 10240 83 Linux
-/dev/loop0p2 22528 43007 10240 83 Linux
@ -66,20 +66,21 @@ index 8e03d900d..f9cbb0e89 100644 @@ -66,20 +66,21 @@ index 8e03d900d..f9cbb0e89 100644
+/dev/...p5 65536 75775 5120 83 Linux
+/dev/...p6 77824 88063 5120 83 Linux
+/dev/...p7 90112 102399 6144 83 Linux

Command (m for help):
Command (m for help):
diff --git a/tests/ts/fdisk/align-512-512 b/tests/ts/fdisk/align-512-512
index 82a6268cf..03133a6d1 100755
--- a/tests/ts/fdisk/align-512-512
+++ b/tests/ts/fdisk/align-512-512
@@ -64,7 +64,6 @@ q
EOF

ts_device_deinit $DEVICE
-
-ts_fdisk_clean
+ts_fdisk_clean $DEVICE

ts_finalize
--
--
2.13.6


15
SOURCES/0141-tests-check-for-mdadm.patch

@ -20,7 +20,7 @@ index 20612ec21..de21bca9a 100755 @@ -20,7 +20,7 @@ index 20612ec21..de21bca9a 100755
ts_init "$*"
ts_skip_nonroot
+ts_check_prog "mdadm"

# set global variable TS_DEVICE
ts_scsi_debug_init dev_size_mb=51 sector_size=512
diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount
@ -28,14 +28,14 @@ index 994ddb483..e5cfe2b14 100755 @@ -28,14 +28,14 @@ index 994ddb483..e5cfe2b14 100755
--- a/tests/ts/eject/umount
+++ b/tests/ts/eject/umount
@@ -43,7 +43,7 @@ EOF

function deinit_device {
udevadm settle
udevadm settle
- rmmod scsi_debug
+ ts_scsi_debug_rmmod
}


diff --git a/tests/ts/fdisk/align-512-4K-md b/tests/ts/fdisk/align-512-4K-md
index ad662e0e8..c45a0d43b 100755
--- a/tests/ts/fdisk/align-512-4K-md
@ -45,8 +45,9 @@ index ad662e0e8..c45a0d43b 100755 @@ -45,8 +45,9 @@ index ad662e0e8..c45a0d43b 100755
ts_init "$*"
ts_skip_nonroot
+ts_check_prog "mdadm"

# set global variable TS_DEVICE
ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3
--
--
2.13.6


75
SOURCES/0142-lsmem-chmem-backport-new-commands.patch

@ -29,8 +29,8 @@ index 96c5838cf..d561e01d0 100644 @@ -29,8 +29,8 @@ index 96c5838cf..d561e01d0 100644
+++ b/configure.ac
@@ -1138,6 +1138,25 @@ UL_REQUIRES_SYSCALL_CHECK([pivot_root], [UL_CHECK_SYSCALL([pivot_root])])
AM_CONDITIONAL(BUILD_PIVOT_ROOT, test "x$build_pivot_root" = xyes)


+AC_ARG_ENABLE([lsmem],
+ AS_HELP_STRING([--disable-lsmem], [do not build lsmem]),
+ [], enable_lsmem=check
@ -58,9 +58,9 @@ index 8ff61b484..124035ea5 100644 @@ -58,9 +58,9 @@ index 8ff61b484..124035ea5 100644
--- a/include/c.h
+++ b/include/c.h
@@ -302,6 +302,16 @@ static inline int usleep(useconds_t usec)

#define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING

+/* backported to RHEL */
+#define USAGE_COLUMNS _("\nAvailable output columns:\n")
+#define USAGE_OPTSTR_HELP _("display this help")
@ -81,34 +81,34 @@ index 45da692f8..1ab5724fc 100644 @@ -81,34 +81,34 @@ index 45da692f8..1ab5724fc 100644
@@ -4,6 +4,10 @@
#include <stdio.h>
#include <stdint.h>

+extern int path_set_prefix(const char *);
+
+extern const char *path_get(const char *path, ...);
+
extern char *path_strdup(const char *path, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
__attribute__ ((__format__ (__printf__, 1, 2)));
extern FILE *path_fopen(const char *mode, int exit_on_err, const char *path, ...)
@@ -27,7 +31,6 @@ extern cpu_set_t *path_read_cpuset(int, const char *path, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
__attribute__ ((__format__ (__printf__, 2, 3)));
extern cpu_set_t *path_read_cpulist(int, const char *path, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
__attribute__ ((__format__ (__printf__, 2, 3)));
-extern void path_set_prefix(const char *);
#endif /* HAVE_CPU_SET_T */

#endif /* UTIL_LINUX_PATH_H */
diff --git a/include/strutils.h b/include/strutils.h
index aa7b95f96..1f028e4ed 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -25,6 +25,7 @@ extern uint32_t strtou32_or_err(const char *str, const char *errmesg);

extern int64_t strtos64_or_err(const char *str, const char *errmesg);
extern uint64_t strtou64_or_err(const char *str, const char *errmesg);
+extern uint64_t strtox64_or_err(const char *str, const char *errmesg);

extern double strtod_or_err(const char *str, const char *errmesg);

diff --git a/lib/path.c b/lib/path.c
index e47d31418..49ca9b5e0 100644
--- a/lib/path.c
@ -116,7 +116,7 @@ index e47d31418..49ca9b5e0 100644 @@ -116,7 +116,7 @@ index e47d31418..49ca9b5e0 100644
@@ -38,6 +38,20 @@
static size_t prefixlen;
static char pathbuf[PATH_MAX];

+int
+path_set_prefix(const char *prefix)
+{
@ -135,9 +135,9 @@ index e47d31418..49ca9b5e0 100644 @@ -135,9 +135,9 @@ index e47d31418..49ca9b5e0 100644
path_vcreate(const char *path, va_list ap)
{
@@ -49,6 +63,19 @@ path_vcreate(const char *path, va_list ap)
return pathbuf;
return pathbuf;
}

+const char *
+path_get(const char *path, ...)
+{
@ -155,12 +155,12 @@ index e47d31418..49ca9b5e0 100644 @@ -155,12 +155,12 @@ index e47d31418..49ca9b5e0 100644
path_strdup(const char *path, ...)
{
@@ -246,13 +273,6 @@ path_read_cpulist(int maxcpus, const char *path, ...)

return set;
return set;
}
-
#endif /* HAVE_CPU_SET_T */

-void
-path_set_prefix(const char *prefix)
-{
@ -174,34 +174,34 @@ index 4b8a8130d..2458a2c2f 100644 @@ -174,34 +174,34 @@ index 4b8a8130d..2458a2c2f 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -237,27 +237,36 @@ err:
errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);
errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);
}

-uint64_t strtou64_or_err(const char *str, const char *errmesg)
+static uint64_t _strtou64_or_err(const char *str, const char *errmesg, int base)
{
uintmax_t num;
char *end = NULL;

uintmax_t num;
char *end = NULL;
+ errno = 0;
if (str == NULL || *str == '\0')
goto err;
if (str == NULL || *str == '\0')
goto err;
- errno = 0;
- num = strtoumax(str, &end, 10);
+ num = strtoumax(str, &end, base);

if (errno || str == end || (end && *end))
goto err;

return num;
if (errno || str == end || (end && *end))
goto err;
return num;
err:
- if (errno)
+ if (errno == ERANGE)
err(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);

errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);
err(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);
errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, str);
}

+uint64_t strtou64_or_err(const char *str, const char *errmesg)
+{
+ return _strtou64_or_err(str, errmesg, 10);
@ -211,7 +211,7 @@ index 4b8a8130d..2458a2c2f 100644 @@ -211,7 +211,7 @@ index 4b8a8130d..2458a2c2f 100644
+{
+ return _strtou64_or_err(str, errmesg, 16);
+}

double strtod_or_err(const char *str, const char *errmesg)
{
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
@ -233,7 +233,7 @@ index 0496b84e3..21585ce80 100644 @@ -233,7 +233,7 @@ index 0496b84e3..21585ce80 100644
+chmem_SOURCES = sys-utils/chmem.c
+chmem_LDADD = $(LDADD) libcommon.la
+endif

usrbin_exec_PROGRAMS += flock
dist_man_MANS += sys-utils/flock.1
diff --git a/sys-utils/chmem.8 b/sys-utils/chmem.8
@ -1603,5 +1603,6 @@ index 000000000..34a2847af @@ -1603,5 +1603,6 @@ index 000000000..34a2847af
+ scols_unref_table(lsmem->table);
+ return 0;
+}
--
--
2.13.6


39
SOURCES/0143-lsmem-make-split-optional-follow-output-by-default.patch

@ -21,7 +21,7 @@ index 3f5cd7d4b..bfe312bfc 100644 @@ -21,7 +21,7 @@ index 3f5cd7d4b..bfe312bfc 100644
+++ b/sys-utils/lsmem.1
@@ -16,14 +16,12 @@ Always explicitly define expected columns by using the \fB\-\-output\fR option
together with a columns list in environments where a stable output is required.

The \fBlsmem\fP command lists a new memory range always when the current memory
-block distinguish from the previous block by STATE, REMOVABLE, NODE or ZONES
-attribute. This default behavior is possible to override by the
@ -37,7 +37,7 @@ index 3f5cd7d4b..bfe312bfc 100644 @@ -37,7 +37,7 @@ index 3f5cd7d4b..bfe312bfc 100644
+differences between memory blocks and to create as large as possible continuous
+ranges. The opposite semantic is \fB\-\-all\fR to list individual memory
+blocks.

Note that some output columns may provide inaccurate information if a split policy
forces \fBlsmem\fP to ignore diffrences in some attributes. For example if you
diff --git a/sys-utils/lsmem.c b/sys-utils/lsmem.c
@ -45,9 +45,9 @@ index 34a2847af..aaf7374fc 100644 @@ -45,9 +45,9 @@ index 34a2847af..aaf7374fc 100644
--- a/sys-utils/lsmem.c
+++ b/sys-utils/lsmem.c
@@ -202,6 +202,32 @@ static inline void reset_split_policy(struct lsmem *l, int enable)
l->split_by_zones = enable;
l->split_by_zones = enable;
}

+static void set_split_policy(struct lsmem *l, int cols[], size_t ncols)
+{
+ size_t i;
@ -76,19 +76,19 @@ index 34a2847af..aaf7374fc 100644 @@ -76,19 +76,19 @@ index 34a2847af..aaf7374fc 100644
+
static void add_scols_line(struct lsmem *lsmem, struct memory_block *blk)
{
size_t i;
size_t i;
@@ -638,32 +664,17 @@ int main(int argc, char **argv)
int split[ARRAY_SIZE(coldescs)] = { 0 };
static size_t nsplits = 0;

int split[ARRAY_SIZE(coldescs)] = { 0 };
static size_t nsplits = 0;
- reset_split_policy(lsmem, 0); /* disable all */
-
if (strcasecmp(splitarg, "none") == 0)
;
else if (string_add_to_idarray(splitarg, split, ARRAY_SIZE(split),
(int *) &nsplits, column_name_to_id) < 0)
return EXIT_FAILURE;

if (strcasecmp(splitarg, "none") == 0)
;
else if (string_add_to_idarray(splitarg, split, ARRAY_SIZE(split),
(int *) &nsplits, column_name_to_id) < 0)
return EXIT_FAILURE;
- for (i = 0; i < nsplits; i++) {
- switch (split[i]) {
- case COL_STATE:
@ -107,12 +107,13 @@ index 34a2847af..aaf7374fc 100644 @@ -107,12 +107,13 @@ index 34a2847af..aaf7374fc 100644
- }
+ set_split_policy(lsmem, split, nsplits);
+
} else
} else
- reset_split_policy(lsmem, 1); /* enable all */
+ /* follow output columns */
+ set_split_policy(lsmem, columns, ncolumns);

/*
* Read data and print output
--
/*
* Read data and print output
--
2.13.6


173
SOURCES/0144-libmount-fix-access-utab-write-test.patch

@ -31,12 +31,12 @@ index 6cabcedeb..8b3f92e17 100644 @@ -31,12 +31,12 @@ index 6cabcedeb..8b3f92e17 100644
--- a/libmount/src/mountP.h
+++ b/libmount/src/mountP.h
@@ -278,7 +278,7 @@ struct libmnt_table {
struct list_head ents; /* list of entries (libmnt_fs) */
struct list_head ents; /* list of entries (libmnt_fs) */
};

-extern struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt);
+extern struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt, int empty_for_enoent);

/*
* Tab file format
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
@ -44,24 +44,24 @@ index 987e671fa..c629c67ad 100644 @@ -44,24 +44,24 @@ index 987e671fa..c629c67ad 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -714,7 +714,7 @@ int mnt_table_parse_dir(struct libmnt_table *tb, const char *dirname)
return __mnt_table_parse_dir(tb, dirname);
return __mnt_table_parse_dir(tb, dirname);
}

-struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt)
+struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt, int empty_for_enoent)
{
struct libmnt_table *tb;
struct stat st;
struct libmnt_table *tb;
struct stat st;
@@ -723,7 +723,8 @@ struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt)
if (!filename)
return NULL;
if (stat(filename, &st))
if (!filename)
return NULL;
if (stat(filename, &st))
- return NULL;
+ return empty_for_enoent ? mnt_new_table() : NULL;
+
tb = mnt_new_table();
if (tb) {
tb->fmt = fmt;
tb = mnt_new_table();
if (tb) {
tb->fmt = fmt;
@@ -748,8 +749,10 @@ struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt)
*/
struct libmnt_table *mnt_new_table_from_file(const char *filename)
@ -73,72 +73,72 @@ index 987e671fa..c629c67ad 100644 @@ -73,72 +73,72 @@ index 987e671fa..c629c67ad 100644
+
+ return __mnt_new_table_from_file(filename, MNT_FMT_GUESS, 0);
}

/**
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c
index 1e7f32be0..5f503cad7 100644
--- a/libmount/src/tab_update.c
+++ b/libmount/src/tab_update.c
@@ -567,6 +567,7 @@ leave:

unlink(uq); /* be paranoid */
free(uq);
unlink(uq); /* be paranoid */
free(uq);
+ DBG(UPDATE, mnt_debug_h(upd, "%s: done [rc=%d]", upd->filename, rc));
return rc;
return rc;
}

@@ -600,7 +601,7 @@ static int update_add_entry(struct libmnt_update *upd, struct libmnt_lock *lc)
return rc;

tb = __mnt_new_table_from_file(upd->filename,
return rc;
tb = __mnt_new_table_from_file(upd->filename,
- upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
+ upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
if (tb)
rc = add_file_entry(tb, upd);
if (lc)
if (tb)
rc = add_file_entry(tb, upd);
if (lc)
@@ -626,7 +627,7 @@ static int update_remove_entry(struct libmnt_update *upd, struct libmnt_lock *lc
return rc;

tb = __mnt_new_table_from_file(upd->filename,
return rc;
tb = __mnt_new_table_from_file(upd->filename,
- upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
+ upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
if (tb) {
struct libmnt_fs *rem = mnt_table_find_target(tb, upd->target, MNT_ITER_BACKWARD);
if (rem) {
if (tb) {
struct libmnt_fs *rem = mnt_table_find_target(tb, upd->target, MNT_ITER_BACKWARD);
if (rem) {
@@ -656,7 +657,7 @@ static int update_modify_target(struct libmnt_update *upd, struct libmnt_lock *l
return rc;

tb = __mnt_new_table_from_file(upd->filename,
return rc;
tb = __mnt_new_table_from_file(upd->filename,
- upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
+ upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
if (tb) {
struct libmnt_fs *cur = mnt_table_find_target(tb,
mnt_fs_get_srcpath(upd->fs), MNT_ITER_BACKWARD);
if (tb) {
struct libmnt_fs *cur = mnt_table_find_target(tb,
mnt_fs_get_srcpath(upd->fs), MNT_ITER_BACKWARD);
@@ -693,7 +694,7 @@ static int update_modify_options(struct libmnt_update *upd, struct libmnt_lock *
return rc;

tb = __mnt_new_table_from_file(upd->filename,
return rc;
tb = __mnt_new_table_from_file(upd->filename,
- upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
+ upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
if (tb) {
struct libmnt_fs *cur = mnt_table_find_target(tb,
mnt_fs_get_target(fs),
if (tb) {
struct libmnt_fs *cur = mnt_table_find_target(tb,
mnt_fs_get_target(fs),
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index a275d0a0e..fa33bd9a1 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -651,18 +651,37 @@ done:
return rc;
return rc;
}

-static int try_write(const char *filename)
+static int try_write(const char *filename, const char *directory)
{
int rc = 0;

if (!filename)
return -EINVAL;

int rc = 0;
if (!filename)
return -EINVAL;
+ DBG(UTILS, mnt_debug("try write %s dir: %s", filename, directory));
+
#ifdef HAVE_EACCESS
@ -163,63 +163,64 @@ index a275d0a0e..fa33bd9a1 100644 @@ -163,63 +163,64 @@ index a275d0a0e..fa33bd9a1 100644
+ return rc;
+ } else
+#endif
{
{
+ DBG(UTILS, mnt_debug(" doing open-write test"));
+
int fd = open(filename, O_RDWR|O_CREAT|O_CLOEXEC,
S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH);
if (fd < 0)
int fd = open(filename, O_RDWR|O_CREAT|O_CLOEXEC,
S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH);
if (fd < 0)
@@ -670,7 +689,6 @@ static int try_write(const char *filename)
else
close(fd);
}
else
close(fd);
}
-#endif
return rc;
return rc;
}

@@ -704,7 +722,7 @@ int mnt_has_regular_mtab(const char **mtab, int *writable)
/* file exist */
if (S_ISREG(st.st_mode)) {
if (writable)
/* file exist */
if (S_ISREG(st.st_mode)) {
if (writable)
- *writable = !try_write(filename);
+ *writable = !try_write(filename, NULL);
return 1;
}
goto done;
return 1;
}
goto done;
@@ -712,7 +730,7 @@ int mnt_has_regular_mtab(const char **mtab, int *writable)

/* try to create the file */
if (writable) {
/* try to create the file */
if (writable) {
- *writable = !try_write(filename);
+ *writable = !try_write(filename, NULL);
if (*writable)
return 1;
}
if (*writable)
return 1;
}
@@ -750,7 +768,7 @@ int mnt_has_regular_utab(const char **utab, int *writable)
/* file exist */
if (S_ISREG(st.st_mode)) {
if (writable)
/* file exist */
if (S_ISREG(st.st_mode)) {
if (writable)
- *writable = !try_write(filename);
+ *writable = !try_write(filename, NULL);
return 1;
}
goto done; /* it's not regular file */
return 1;
}
goto done; /* it's not regular file */
@@ -767,11 +785,13 @@ int mnt_has_regular_utab(const char **utab, int *writable)
rc = mkdir(dirname, S_IWUSR|
S_IRUSR|S_IRGRP|S_IROTH|
S_IXUSR|S_IXGRP|S_IXOTH);
rc = mkdir(dirname, S_IWUSR|
S_IRUSR|S_IRGRP|S_IROTH|
S_IXUSR|S_IXGRP|S_IXOTH);
- free(dirname);
- if (rc && errno != EEXIST)
+ if (rc && errno != EEXIST) {
+ free(dirname);
goto done; /* probably EACCES */
goto done; /* probably EACCES */
+ }

- *writable = !try_write(filename);
+ *writable = !try_write(filename, dirname);
+ free(dirname);
if (*writable)
return 1;
}
--
if (*writable)
return 1;
}
--
2.13.6


23
SOURCES/0145-login-add-LOGIN_PLAIN_PROMPT-to-login.defs.patch

@ -54,7 +54,7 @@ index 5c36953ef..eee3f7bd1 100644 @@ -54,7 +54,7 @@ index 5c36953ef..eee3f7bd1 100644
+++ b/login-utils/login.c
@@ -709,7 +709,8 @@ static void loginpam_err(pam_handle_t *pamh, int retcode)
}

/*
- * Composes "<host> login: " string; or returns "login: " is -H is given
+ * Composes "<host> login: " string; or returns "login: " if -H is given or
@ -63,23 +63,24 @@ index 5c36953ef..eee3f7bd1 100644 @@ -63,23 +63,24 @@ index 5c36953ef..eee3f7bd1 100644
static const char *loginpam_get_prompt(struct login_context *cxt)
{
@@ -717,11 +718,16 @@ static const char *loginpam_get_prompt(struct login_context *cxt)
char *prompt, *dflt_prompt = _("login: ");
size_t sz;

char *prompt, *dflt_prompt = _("login: ");
size_t sz;
- if (cxt->nohost || !(host = get_thishost(cxt, NULL)))
+ if (cxt->nohost)
+ return dflt_prompt; /* -H on command line */
+
+ if (getlogindefs_bool("LOGIN_PLAIN_PROMPT", 0) == 1)
return dflt_prompt;

return dflt_prompt;
- sz = strlen(host) + 1 + strlen(dflt_prompt) + 1;
+ if (!(host = get_thishost(cxt, NULL)))
+ return dflt_prompt;

+ sz = strlen(host) + 1 + strlen(dflt_prompt) + 1;
prompt = xmalloc(sz);
snprintf(prompt, sz, "%s %s", host, dflt_prompt);

--
prompt = xmalloc(sz);
snprintf(prompt, sz, "%s %s", host, dflt_prompt);
--
2.13.6


29
SOURCES/0146-libblkid-Add-VDO-superblock-information-into-blkid.patch

@ -24,25 +24,25 @@ index 15639768a..791d7cbe8 100644 @@ -24,25 +24,25 @@ index 15639768a..791d7cbe8 100644
--- a/libblkid/src/Makemodule.am
+++ b/libblkid/src/Makemodule.am
@@ -88,6 +88,7 @@ libblkid_la_SOURCES = \
libblkid/src/superblocks/ubifs.c \
libblkid/src/superblocks/udf.c \
libblkid/src/superblocks/ufs.c \
libblkid/src/superblocks/ubifs.c \
libblkid/src/superblocks/udf.c \
libblkid/src/superblocks/ufs.c \
+ libblkid/src/superblocks/vdo.c \
libblkid/src/superblocks/vfat.c \
libblkid/src/superblocks/via_raid.c \
libblkid/src/superblocks/vmfs.c \
libblkid/src/superblocks/vfat.c \
libblkid/src/superblocks/via_raid.c \
libblkid/src/superblocks/vmfs.c \
diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c
index 3721544ff..8210fc17b 100644
--- a/libblkid/src/superblocks/superblocks.c
+++ b/libblkid/src/superblocks/superblocks.c
@@ -109,6 +109,7 @@ static const struct blkid_idinfo *idinfos[] =
&verity_hash_idinfo,
&luks_idinfo,
&vmfs_volume_idinfo,
&verity_hash_idinfo,
&luks_idinfo,
&vmfs_volume_idinfo,
+ &vdo_idinfo,

/* Filesystems */
&vfat_idinfo,
/* Filesystems */
&vfat_idinfo,
diff --git a/libblkid/src/superblocks/superblocks.h b/libblkid/src/superblocks/superblocks.h
index 90847151b..487fe38c2 100644
--- a/libblkid/src/superblocks/superblocks.h
@ -52,7 +52,7 @@ index 90847151b..487fe38c2 100644 @@ -52,7 +52,7 @@ index 90847151b..487fe38c2 100644
extern const struct blkid_idinfo exfat_idinfo;
extern const struct blkid_idinfo f2fs_idinfo;
+extern const struct blkid_idinfo vdo_idinfo;

/*
* superblock functions
diff --git a/libblkid/src/superblocks/vdo.c b/libblkid/src/superblocks/vdo.c
@ -109,5 +109,6 @@ index 000000000..bec686f4f @@ -109,5 +109,6 @@ index 000000000..bec686f4f
+ { NULL }
+ }
+};
--
--
2.13.6


255
SOURCES/0147-include-debug-don-t-print-pointer-address-for-SUID-p.patch

@ -43,14 +43,14 @@ index 168029683..bd4aa8cea 100644 @@ -43,14 +43,14 @@ index 168029683..bd4aa8cea 100644
--- a/include/Makemodule.am
+++ b/include/Makemodule.am
@@ -11,6 +11,8 @@ dist_noinst_HEADERS += \
include/colors.h \
include/cpuset.h \
include/crc32.h \
include/colors.h \
include/cpuset.h \
include/crc32.h \
+ include/debug.h \
+ include/debugobj.h \
include/env.h \
include/exec_shell.h \
include/exitcodes.h \
include/env.h \
include/exec_shell.h \
include/exitcodes.h \
diff --git a/include/debug.h b/include/debug.h
index 848e47456..1c7ed8037 100644
--- a/include/debug.h
@ -58,36 +58,36 @@ index 848e47456..1c7ed8037 100644 @@ -58,36 +58,36 @@ index 848e47456..1c7ed8037 100644
@@ -13,12 +13,15 @@
struct dbg_mask { char *mname; int val; };
#define UL_DEBUG_EMPTY_MASKNAMES {{ NULL, 0 }}

-#define UL_DEBUG_DEFINE_MASK(m) int m ## _debug_mask
+#define UL_DEBUG_MASK(m) m ## _debug_mask
+#define UL_DEBUG_DEFINE_MASK(m) int UL_DEBUG_MASK(m)
#define UL_DEBUG_DECLARE_MASK(m) extern UL_DEBUG_DEFINE_MASK(m)
#define UL_DEBUG_DEFINE_MASKNAMES(m) static const struct dbg_mask m ## _masknames[]

-/* p - flag prefix, m - flag postfix */
-#define UL_DEBUG_DEFINE_FLAG(p, m) p ## m
+/*
+ * Internal mask flags (above 0xffffff)
+ */
+#define __UL_DEBUG_FL_NOADDR (1 << 24) /* Don't print object address */

/* l - library name, p - flag prefix, m - flag postfix, x - function */
#define __UL_DBG(l, p, m, x) \
@@ -55,6 +58,10 @@ struct dbg_mask { char *mname; int val; };
lib ## _debug_mask = parse_envmask(lib ## _masknames, str); \
} else \
lib ## _debug_mask = mask; \
lib ## _debug_mask = parse_envmask(lib ## _masknames, str); \
} else \
lib ## _debug_mask = mask; \
+ if (lib ## _debug_mask) { \
+ if (getuid() != geteuid() || getgid() != getegid()) \
+ lib ## _debug_mask |= __UL_DEBUG_FL_NOADDR; \
+ } \
lib ## _debug_mask |= pref ## INIT; \
if (lib ## _debug_mask != pref ## INIT) { \
__UL_DBG(lib, pref, INIT, ul_debug("library debug mask: 0x%04x", \
lib ## _debug_mask |= pref ## INIT; \
if (lib ## _debug_mask != pref ## INIT) { \
__UL_DBG(lib, pref, INIT, ul_debug("library debug mask: 0x%04x", \
@@ -72,21 +79,7 @@ ul_debug(const char *mesg, ...)
va_end(ap);
fputc('\n', stderr);
va_end(ap);
fputc('\n', stderr);
}
-
-static inline void __attribute__ ((__format__ (__printf__, 2, 3)))
@ -105,9 +105,9 @@ index 848e47456..1c7ed8037 100644 @@ -105,9 +105,9 @@ index 848e47456..1c7ed8037 100644
-
-static inline int parse_envmask(const struct dbg_mask const flagnames[],
+static inline int parse_envmask(const struct dbg_mask flagnames[],
const char *mask)
const char *mask)
{
int res;
int res;
diff --git a/include/debugobj.h b/include/debugobj.h
new file mode 100644
index 000000000..73b70b8df
@ -141,184 +141,184 @@ index db5463698..daf0a81e8 100644 @@ -141,184 +141,184 @@ index db5463698..daf0a81e8 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -50,7 +50,7 @@

# define DBG(l,x) do { \
if ((l)->debug) {\
if ((l)->debug) {\
- fprintf(stderr, "loopdev: [%p]: ", (l)); \
+ fprintf(stderr, "loopdev: "); \
x; \
} \
} while(0)
x; \
} \
} while(0)
diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c
index 9d846ff85..2d0d70d81 100644
--- a/libblkid/src/partitions/partitions.c
+++ b/libblkid/src/partitions/partitions.c
@@ -381,8 +381,8 @@ static blkid_partlist partitions_init_data(struct blkid_chain *chn)

reset_partlist(ls);

reset_partlist(ls);
- DBG(LOWPROBE, blkid_debug("parts: initialized partitions list (%p, size=%d)",
- ls, ls->nparts_max));
+ DBG(LOWPROBE, blkid_debug("parts: initialized partitions list (size=%d)",
+ ls->nparts_max));
return ls;
return ls;
}

@@ -417,7 +417,7 @@ blkid_parttable blkid_partlist_new_parttable(blkid_partlist ls,
list_add_tail(&tab->t_tabs, &ls->l_tabs);

DBG(LOWPROBE, blkid_debug("parts: create a new partition table "
list_add_tail(&tab->t_tabs, &ls->l_tabs);
DBG(LOWPROBE, blkid_debug("parts: create a new partition table "
- "(%p, type=%s, offset=%"PRId64")", tab, type, offset));
+ "(type=%s, offset=%"PRId64")", type, offset));
return tab;
return tab;
}

@@ -458,9 +458,9 @@ blkid_partition blkid_partlist_add_partition(blkid_partlist ls,
par->start = start;
par->size = size;

par->start = start;
par->size = size;
- DBG(LOWPROBE, blkid_debug("parts: add partition (%p start=%"
- PRId64 ", size=%" PRId64 ", table=%p)",
- par, par->start, par->size, tab));
+ DBG(LOWPROBE, blkid_debug("parts: add partition (start=%"
+ PRId64 ", size=%" PRId64 ")",
+ par->start, par->size));
return par;
return par;
}

@@ -662,8 +662,8 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent,
blkid_loff_t sz, off;

DBG(LOWPROBE, blkid_debug(
blkid_loff_t sz, off;
DBG(LOWPROBE, blkid_debug(
- "parts: ----> %s subprobe requested (parent=%p)",
- id->name, parent));
+ "parts: ----> %s subprobe requested)",
+ id->name));

if (!pr || !parent || !parent->size)
return -EINVAL;
if (!pr || !parent || !parent->size)
return -EINVAL;
@@ -709,8 +709,8 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent,
blkid_free_probe(prc); /* free cloned prober */

DBG(LOWPROBE, blkid_debug(
blkid_free_probe(prc); /* free cloned prober */
DBG(LOWPROBE, blkid_debug(
- "parts: <---- %s subprobe done (parent=%p, rc=%d)",
- id->name, parent, rc));
+ "parts: <---- %s subprobe done (rc=%d)",
+ id->name, rc));

return rc;
return rc;
}
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index 9cf099ae4..07b08441f 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -145,7 +145,7 @@ blkid_probe blkid_new_probe(void)
if (!pr)
return NULL;

if (!pr)
return NULL;
- DBG(LOWPROBE, blkid_debug("allocate a new probe %p", pr));
+ DBG(LOWPROBE, blkid_debug("allocate a new probe"));

/* initialize chains */
for (i = 0; i < BLKID_NCHAINS; i++) {
/* initialize chains */
for (i = 0; i < BLKID_NCHAINS; i++) {
@@ -260,7 +260,7 @@ void blkid_free_probe(blkid_probe pr)
blkid_probe_reset_buffer(pr);
blkid_free_probe(pr->disk_probe);

blkid_probe_reset_buffer(pr);
blkid_free_probe(pr->disk_probe);
- DBG(LOWPROBE, blkid_debug("free probe %p", pr));
+ DBG(LOWPROBE, blkid_debug("free probe"));
free(pr);
free(pr);
}

@@ -552,8 +552,8 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
list_entry(p, struct blkid_bufinfo, bufs);

if (x->off <= off && off + len <= x->off + x->len) {
list_entry(p, struct blkid_bufinfo, bufs);
if (x->off <= off && off + len <= x->off + x->len) {
- DBG(LOWPROBE, blkid_debug("\treuse buffer: off=%jd len=%jd pr=%p",
- x->off, x->len, pr));
+ DBG(LOWPROBE, blkid_debug("\treuse buffer: off=%jd len=%jd",
+ x->off, x->len));
bf = x;
break;
}
bf = x;
break;
}
@@ -584,8 +584,8 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
bf->off = off;
INIT_LIST_HEAD(&bf->bufs);

bf->off = off;
INIT_LIST_HEAD(&bf->bufs);
- DBG(LOWPROBE, blkid_debug("\tbuffer read: off=%jd len=%jd pr=%p",
- off, len, pr));
+ DBG(LOWPROBE, blkid_debug("\tbuffer read: off=%jd len=%jd",
+ off, len));

ret = read(pr->fd, bf->data, len);
if (ret != (ssize_t) len) {
ret = read(pr->fd, bf->data, len);
if (ret != (ssize_t) len) {
@@ -609,7 +609,7 @@ static void blkid_probe_reset_buffer(blkid_probe pr)
if (!pr || list_empty(&pr->buffers))
return;

if (!pr || list_empty(&pr->buffers))
return;
- DBG(LOWPROBE, blkid_debug("reseting probing buffers pr=%p", pr));
+ DBG(LOWPROBE, blkid_debug("reseting probing buffers"));

while (!list_empty(&pr->buffers)) {
struct blkid_bufinfo *bf = list_entry(pr->buffers.next,
while (!list_empty(&pr->buffers)) {
struct blkid_bufinfo *bf = list_entry(pr->buffers.next,
@@ -766,9 +766,8 @@ int blkid_probe_set_dimension(blkid_probe pr,
return -1;

DBG(LOWPROBE, blkid_debug(
return -1;
DBG(LOWPROBE, blkid_debug(
- "changing probing area pr=%p: size=%llu, off=%llu "
+ "changing probing area: size=%llu, off=%llu "
"-to-> size=%llu, off=%llu",
"-to-> size=%llu, off=%llu",
- pr,
(unsigned long long) pr->size,
(unsigned long long) pr->off,
(unsigned long long) size,
(unsigned long long) pr->size,
(unsigned long long) pr->off,
(unsigned long long) size,
@@ -840,7 +839,7 @@ int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
static inline void blkid_probe_start(blkid_probe pr)
{
if (pr) {
if (pr) {
- DBG(LOWPROBE, blkid_debug("%p: start probe", pr));
+ DBG(LOWPROBE, blkid_debug("start probe"));
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
@@ -850,7 +849,7 @@ static inline void blkid_probe_start(blkid_probe pr)
static inline void blkid_probe_end(blkid_probe pr)
{
if (pr) {
if (pr) {
- DBG(LOWPROBE, blkid_debug("%p: end probe", pr));
+ DBG(LOWPROBE, blkid_debug("end probe"));
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index 75e3bbb26..e46ee0c0e 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -1451,7 +1451,7 @@ int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file)
{
if (!fs || !file)
return -EINVAL;
if (!fs || !file)
return -EINVAL;
- fprintf(file, "------ fs: %p\n", fs);
+ fprintf(file, "------ fs\n");
fprintf(file, "source: %s\n", mnt_fs_get_source(fs));
fprintf(file, "target: %s\n", mnt_fs_get_target(fs));
fprintf(file, "fstype: %s\n", mnt_fs_get_fstype(fs));
fprintf(file, "source: %s\n", mnt_fs_get_source(fs));
fprintf(file, "target: %s\n", mnt_fs_get_target(fs));
fprintf(file, "fstype: %s\n", mnt_fs_get_fstype(fs));
diff --git a/libmount/src/init.c b/libmount/src/init.c
index 4e5f489c4..e5e6925f5 100644
--- a/libmount/src/init.c
+++ b/libmount/src/init.c
@@ -38,6 +38,11 @@ void mnt_init_debug(int mask)
} else
libmount_debug_mask = mask;

} else
libmount_debug_mask = mask;
+ if (libmount_debug_mask) {
+ if (getuid() != geteuid() || getgid() != getegid())
+ libmount_debug_mask |= MNT_DEBUG_FL_NOADDR;
+ }
+
libmount_debug_mask |= MNT_DEBUG_INIT;

if (libmount_debug_mask && libmount_debug_mask != MNT_DEBUG_INIT) {
libmount_debug_mask |= MNT_DEBUG_INIT;
if (libmount_debug_mask && libmount_debug_mask != MNT_DEBUG_INIT) {
diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h
index 8b3f92e17..dc3ed3f49 100644
--- a/libmount/src/mountP.h
@ -326,7 +326,7 @@ index 8b3f92e17..dc3ed3f49 100644 @@ -326,7 +326,7 @@ index 8b3f92e17..dc3ed3f49 100644
@@ -51,6 +51,8 @@
#define MNT_DEBUG_DIFF (1 << 11)
#define MNT_DEBUG_ALL 0xFFFF

+#define MNT_DEBUG_FL_NOADDR (1 << 24)
+
#ifdef CONFIG_LIBMOUNT_DEBUG
@ -334,45 +334,45 @@ index 8b3f92e17..dc3ed3f49 100644 @@ -334,45 +334,45 @@ index 8b3f92e17..dc3ed3f49 100644
# include <stdarg.h>
@@ -91,7 +93,7 @@ mnt_debug_h(void *handler, const char *mesg, ...)
{
va_list ap;

va_list ap;
- if (handler)
+ if (handler && !(libmount_debug_mask & MNT_DEBUG_FL_NOADDR))
fprintf(stderr, "[%p]: ", handler);
va_start(ap, mesg);
vfprintf(stderr, mesg, ap);
fprintf(stderr, "[%p]: ", handler);
va_start(ap, mesg);
vfprintf(stderr, mesg, ap);
diff --git a/libmount/src/tab_diff.c b/libmount/src/tab_diff.c
index f01f889f8..0a69f402c 100644
--- a/libmount/src/tab_diff.c
+++ b/libmount/src/tab_diff.c
@@ -229,9 +229,9 @@ int mnt_diff_tables(struct libmnt_tabdiff *df, struct libmnt_table *old_tab,
if (!no && !nn) /* both tables are empty */
return 0;

if (!no && !nn) /* both tables are empty */
return 0;
- DBG(DIFF, mnt_debug_h(df, "analyze new=%p (%d entries), "
- "old=%p (%d entries)",
- new_tab, nn, old_tab, no));
+ DBG(DIFF, mnt_debug_h(df, "analyze new (%d entries), "
+ "old (%d entries)",
+ nn, no));

mnt_reset_iter(&itr, MNT_ITER_FORWARD);

mnt_reset_iter(&itr, MNT_ITER_FORWARD);
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c
index 5f503cad7..b45c4a92c 100644
--- a/libmount/src/tab_update.c
+++ b/libmount/src/tab_update.c
@@ -173,8 +173,8 @@ int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags,
return -EINVAL;

DBG(UPDATE, mnt_debug_h(upd,
return -EINVAL;
DBG(UPDATE, mnt_debug_h(upd,
- "resetting FS [fs=0x%p, target=%s, flags=0x%08lx]",
- fs, target, mountflags));
+ "resetting FS [target=%s, flags=0x%08lx]",
+ target, mountflags));
if (fs) {
DBG(UPDATE, mnt_debug_h(upd, "FS template:"));
DBG(UPDATE, mnt_fs_print_debug(fs, stderr));
if (fs) {
DBG(UPDATE, mnt_debug_h(upd, "FS template:"));
DBG(UPDATE, mnt_fs_print_debug(fs, stderr));
diff --git a/libsmartcols/src/smartcolsP.h b/libsmartcols/src/smartcolsP.h
index 28246c14f..cea4f3101 100644
--- a/libsmartcols/src/smartcolsP.h
@ -380,7 +380,7 @@ index 28246c14f..cea4f3101 100644 @@ -380,7 +380,7 @@ index 28246c14f..cea4f3101 100644
@@ -43,6 +43,9 @@ UL_DEBUG_DECLARE_MASK(libsmartcols);
#define ON_DBG(m, x) __UL_DBG_CALL(libsmartcols, SCOLS_DEBUG_, m, x)
#define DBG_FLUSH __UL_DBG_FLUSH(libsmartcols, SCOLS_DEBUG_)

+#define UL_DEBUG_CURRENT_MASK UL_DEBUG_MASK(libsmartcols)
+#include "debugobj.h"
+
@ -394,12 +394,13 @@ index 5ee298172..fb53a16a4 100644 @@ -394,12 +394,13 @@ index 5ee298172..fb53a16a4 100644
@@ -55,6 +55,9 @@ UL_DEBUG_DEFINE_MASKNAMES(lsns) = UL_DEBUG_EMPTY_MASKNAMES;
#define DBG(m, x) __UL_DBG(lsns, LSNS_DEBUG_, m, x)
#define ON_DBG(m, x) __UL_DBG_CALL(lsns, LSNS_DEBUG_, m, x)

+#define UL_DEBUG_CURRENT_MASK UL_DEBUG_MASK(lsns)
+#include "debugobj.h"
+
struct idcache *uid_cache = NULL;

/* column IDs */
--
--
2.13.6


15
SOURCES/0148-mkswap-tolerate-ENOTSUP-when-failing-to-relabel.patch

@ -21,13 +21,14 @@ index ec6fc5f99..ff47f2038 100644 @@ -21,13 +21,14 @@ index ec6fc5f99..ff47f2038 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -656,7 +656,7 @@ main(int argc, char **argv) {
context_string = context_str(newcontext);

if (strcmp(context_string, oldcontext)!=0) {
context_string = context_str(newcontext);
if (strcmp(context_string, oldcontext)!=0) {
- if (fsetfilecon(DEV, context_string))
+ if (fsetfilecon(DEV, context_string) && errno != ENOTSUP)
err(EXIT_FAILURE, _("unable to relabel %s to %s"),
device_name, context_string);
}
--
err(EXIT_FAILURE, _("unable to relabel %s to %s"),
device_name, context_string);
}
--
2.13.6


13
SOURCES/0149-libmount-fix-debug-message.patch

@ -16,12 +16,13 @@ index e46ee0c0e..e5c38c1b6 100644 @@ -16,12 +16,13 @@ index e46ee0c0e..e5c38c1b6 100644
+++ b/libmount/src/fs.c
@@ -1451,7 +1451,7 @@ int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file)
{
if (!fs || !file)
return -EINVAL;
if (!fs || !file)
return -EINVAL;
- fprintf(file, "------ fs\n");
+ fprintf(file, "------ fs:\n");
fprintf(file, "source: %s\n", mnt_fs_get_source(fs));
fprintf(file, "target: %s\n", mnt_fs_get_target(fs));
fprintf(file, "fstype: %s\n", mnt_fs_get_fstype(fs));
--
fprintf(file, "source: %s\n", mnt_fs_get_source(fs));
fprintf(file, "target: %s\n", mnt_fs_get_target(fs));
fprintf(file, "fstype: %s\n", mnt_fs_get_fstype(fs));
--
2.14.3


14
SOURCES/2.17-kill-strtol.patch

@ -6,17 +6,17 @@ diff -up util-linux-2.23.2/misc-utils/kill.c.kzak util-linux-2.23.2/misc-utils/k @@ -6,17 +6,17 @@ diff -up util-linux-2.23.2/misc-utils/kill.c.kzak util-linux-2.23.2/misc-utils/k
#include <unistd.h>
#include <signal.h>
+#include <errno.h>

#include "c.h"
#include "nls.h"
@@ -279,8 +280,9 @@ int main (int argc, char *argv[])
the rest of the arguments should be process ids and names.
kill them. */
the rest of the arguments should be process ids and names.
kill them. */
for (errors = 0; (arg = *argv) != NULL; argv++) {
+ errno = 0;
pid = strtol (arg, &ep, 10);
pid = strtol (arg, &ep, 10);
- if (! *ep)
+ if (errno == 0 && ep && *ep == '\0' && arg < ep)
errors += kill_verbose (arg, pid, numsig);
else {
struct proc_processes *ps = proc_open_processes();
errors += kill_verbose (arg, pid, numsig);
else {
struct proc_processes *ps = proc_open_processes();

11
SOURCES/2.23-login-lastlog-create.patch

@ -2,10 +2,11 @@ diff -up util-linux-2.23.2/login-utils/login.c.kzak util-linux-2.23.2/login-util @@ -2,10 +2,11 @@ diff -up util-linux-2.23.2/login-utils/login.c.kzak util-linux-2.23.2/login-util
--- util-linux-2.23.2/login-utils/login.c.kzak 2013-07-30 10:39:26.222738397 +0200
+++ util-linux-2.23.2/login-utils/login.c 2013-09-09 09:01:39.923225757 +0200
@@ -502,7 +502,7 @@ static void log_lastlog(struct login_con
if (!cxt->pwd)
return;

if (!cxt->pwd)
return;
- fd = open(_PATH_LASTLOG, O_RDWR, 0);
+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
if (fd < 0)
return;
if (fd < 0)
return;

104
SOURCES/2.24-agetty-clocal.patch

@ -2,13 +2,13 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -2,13 +2,13 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
--- util-linux-2.23.2/term-utils/agetty.c.kzak 2013-07-30 11:14:18.124912322 +0200
+++ util-linux-2.23.2/term-utils/agetty.c 2013-09-09 09:07:46.406689270 +0200
@@ -132,13 +132,20 @@ struct options {
int delay; /* Sleep seconds before prompt */
int nice; /* Run login with this priority */
int numspeed; /* number of baud rates to try */
int delay; /* Sleep seconds before prompt */
int nice; /* Run login with this priority */
int numspeed; /* number of baud rates to try */
+ int clocal; /* CLOCAL_MODE_* */
speed_t speeds[MAX_SPEED]; /* baud rates to be tried */
speed_t speeds[MAX_SPEED]; /* baud rates to be tried */
};

+enum {
+ CLOCAL_MODE_AUTO = 0,
+ CLOCAL_MODE_ALWAYS,
@ -25,7 +25,7 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -25,7 +25,7 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
#define F_CUSTISSUE (1<<6) /* give alternative issue file */
@@ -235,10 +242,13 @@ static void login_options_to_argv(char *
static char *fakehost;

#ifdef DEBUGGING
-#define debug(s) do { fprintf(dbf,s); fflush(dbf); } while (0)
+# ifndef DEBUG_OUTPUT
@ -37,56 +37,56 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -37,56 +37,56 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
-#define debug(s) do { ; } while (0)
+# define debug(s) do { ; } while (0)
#endif

int main(int argc, char **argv)
@@ -270,7 +280,7 @@ int main(int argc, char **argv)
sigaction(SIGINT, &sa, &sa_int);

sigaction(SIGINT, &sa, &sa_int);
#ifdef DEBUGGING
- dbf = fopen("/dev/ttyp0", "w");
+ dbf = fopen(DEBUG_OUTPUT, "w");
for (int i = 1; i < argc; i++)
debug(argv[i]);
for (int i = 1; i < argc; i++)
debug(argv[i]);
#endif /* DEBUGGING */
@@ -311,8 +321,10 @@ int main(int argc, char **argv)
strlen(options.initstring));
}

strlen(options.initstring));
}
- if (!serial_tty_option(&options, F_LOCAL))
- /* Go to blocking write mode unless -L is specified. */
+ if (options.flags & F_VCONSOLE || options.clocal != CLOCAL_MODE_ALWAYS)
+ /* Go to blocking mode unless -L is specified, this change
+ * affects stdout, stdin and stderr as all the file descriptors
+ * are created by dup(). */
fcntl(STDOUT_FILENO, F_SETFL,
fcntl(STDOUT_FILENO, F_GETFL, 0) & ~O_NONBLOCK);

fcntl(STDOUT_FILENO, F_SETFL,
fcntl(STDOUT_FILENO, F_GETFL, 0) & ~O_NONBLOCK);
@@ -420,6 +432,12 @@ int main(int argc, char **argv)
options.tty);
}

options.tty);
}
+#ifdef DEBUGGING
+ fprintf(dbf, "read %c\n", ch);
+ if (close_stream(dbf) != 0)
+ log_err("write failed: %s", DEBUG_OUTPUT);
+#endif
+
/* Let the login program take care of password validation. */
execv(options.login, login_argv);
log_err(_("%s: can't exec %s: %m"), options.tty, login_argv[0]);
/* Let the login program take care of password validation. */
execv(options.login, login_argv);
log_err(_("%s: can't exec %s: %m"), options.tty, login_argv[0]);
@@ -534,7 +552,7 @@ static void parse_args(int argc, char **
{ "init-string", required_argument, 0, 'I' },
{ "noclear", no_argument, 0, 'J' },
{ "login-program", required_argument, 0, 'l' },
{ "init-string", required_argument, 0, 'I' },
{ "noclear", no_argument, 0, 'J' },
{ "login-program", required_argument, 0, 'l' },
- { "local-line", no_argument, 0, 'L' },
+ { "local-line", optional_argument, 0, 'L' },
{ "extract-baud", no_argument, 0, 'm' },
{ "skip-login", no_argument, 0, 'n' },
{ "nonewline", no_argument, 0, 'N' },
{ "extract-baud", no_argument, 0, 'm' },
{ "skip-login", no_argument, 0, 'n' },
{ "nonewline", no_argument, 0, 'N' },
@@ -603,7 +621,18 @@ static void parse_args(int argc, char **
op->login = optarg;
break;
case 'L':
op->login = optarg;
break;
case 'L':
- op->flags |= F_LOCAL;
+ /* -L and -L=always have the same meaning */
+ op->clocal = CLOCAL_MODE_ALWAYS;
@ -100,13 +100,13 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -100,13 +100,13 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
+ else
+ log_err(_("unssuported --local-line mode argument"));
+ }
break;
case 'm':
op->flags |= F_PARSE;
break;
case 'm':
op->flags |= F_PARSE;
@@ -1090,8 +1119,19 @@ static void termio_init(struct options *
cfsetispeed(tp, ispeed);
cfsetospeed(tp, ospeed);

cfsetispeed(tp, ispeed);
cfsetospeed(tp, ospeed);
- if (op->flags & F_LOCAL)
- tp->c_cflag |= CLOCAL;
+ /* The default is to follow setting from kernel, but it's possible
@ -123,27 +123,27 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -123,27 +123,27 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
+ }
+
#ifdef HAVE_STRUCT_TERMIOS_C_LINE
tp->c_line = 0;
tp->c_line = 0;
#endif
@@ -1412,9 +1452,10 @@ static char *get_logname(struct options

if (read(STDIN_FILENO, &c, 1) < 1) {

if (read(STDIN_FILENO, &c, 1) < 1) {
- /* Do not report trivial like EINTR/EIO errors. */
+ /* The terminal could be open with O_NONBLOCK when
+ * -L (force CLOCAL) is specified... */
if (errno == EINTR || errno == EAGAIN) {
if (errno == EINTR || errno == EAGAIN) {
- usleep(1000);
+ usleep(250000);
continue;
}
switch (errno) {
continue;
}
switch (errno) {
@@ -1648,7 +1689,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -i, --noissue do not display issue file\n"), out);
fputs(_(" -I, --init-string <string> set init string\n"), out);
fputs(_(" -l, --login-program <file> specify login program\n"), out);
fputs(_(" -i, --noissue do not display issue file\n"), out);
fputs(_(" -I, --init-string <string> set init string\n"), out);
fputs(_(" -l, --login-program <file> specify login program\n"), out);
- fputs(_(" -L, --local-line force local line\n"), out);
+ fputs(_(" -L, --local-line[=<mode>] cotrol local line flag\n"), out);
fputs(_(" -m, --extract-baud extract baud rate during connect\n"), out);
fputs(_(" -n, --skip-login do not prompt for login\n"), out);
fputs(_(" -o, --login-options <opts> options that are passed to login\n"), out);
fputs(_(" -m, --extract-baud extract baud rate during connect\n"), out);
fputs(_(" -n, --skip-login do not prompt for login\n"), out);
fputs(_(" -o, --login-options <opts> options that are passed to login\n"), out);

42
SOURCES/2.24-agetty-etc-os-release.patch

@ -2,12 +2,12 @@ diff -up util-linux-2.23.2/include/pathnames.h.kzak util-linux-2.23.2/include/pa @@ -2,12 +2,12 @@ diff -up util-linux-2.23.2/include/pathnames.h.kzak util-linux-2.23.2/include/pa
--- util-linux-2.23.2/include/pathnames.h.kzak 2013-07-30 10:39:26.201738190 +0200
+++ util-linux-2.23.2/include/pathnames.h 2013-09-12 13:05:35.928359383 +0200
@@ -63,6 +63,7 @@

/* used in term-utils/agetty.c */
#define _PATH_ISSUE "/etc/issue"
+#define _PATH_OS_RELEASE "/etc/os-release"
#define _PATH_NUMLOCK_ON _PATH_LOCALSTATEDIR "/numlock-on"

#define _PATH_LOGINDEFS "/etc/login.defs"
diff -up util-linux-2.23.2/term-utils/agetty.8.kzak util-linux-2.23.2/term-utils/agetty.8
--- util-linux-2.23.2/term-utils/agetty.8.kzak 2013-07-30 10:58:20.889261333 +0200
@ -47,27 +47,27 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -47,27 +47,27 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
--- util-linux-2.23.2/term-utils/agetty.c.kzak 2013-09-12 13:05:35.927359379 +0200
+++ util-linux-2.23.2/term-utils/agetty.c 2013-09-12 13:05:35.929359388 +0200
@@ -129,6 +129,7 @@ struct options {
char *issue; /* alternative issue file */
char *erasechars; /* string with erase chars */
char *killchars; /* string with kill chars */
char *issue; /* alternative issue file */
char *erasechars; /* string with erase chars */
char *killchars; /* string with kill chars */
+ char *osrelease; /* /etc/os-release data */
int delay; /* Sleep seconds before prompt */
int nice; /* Run login with this priority */
int numspeed; /* number of baud rates to try */
int delay; /* Sleep seconds before prompt */
int nice; /* Run login with this priority */
int numspeed; /* number of baud rates to try */
@@ -431,7 +432,8 @@ int main(int argc, char **argv)
log_warn(_("%s: can't change process priority: %m"),
options.tty);
}
log_warn(_("%s: can't change process priority: %m"),
options.tty);
}
-
+ if (options.osrelease)
+ free(options.osrelease);
#ifdef DEBUGGING
fprintf(dbf, "read %c\n", ch);
if (close_stream(dbf) != 0)
fprintf(dbf, "read %c\n", ch);
if (close_stream(dbf) != 0)
@@ -1279,6 +1281,84 @@ static char *xgetdomainname(void)
return NULL;
return NULL;
}

+static char *read_os_release(struct options *op, const char *varname)
+{
+ int fd = -1;
@ -150,9 +150,9 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -150,9 +150,9 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
static void do_prompt(struct options *op, struct termios *tp)
{
@@ -1968,6 +2048,24 @@ static void output_special_char(unsigned
}
break;
}
}
break;
}
+ case 'S':
+ {
+ char *var = NULL, varname[64];
@ -171,6 +171,6 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils @@ -171,6 +171,6 @@ diff -up util-linux-2.23.2/term-utils/agetty.c.kzak util-linux-2.23.2/term-utils
+ }
+ break;
+ }
case 'u':
case 'U':
{
case 'u':
case 'U':
{

15
SOURCES/2.24-blockdev-setbsz-hint.patch

@ -29,13 +29,14 @@ index 4543818..d030217 100644 @@ -29,13 +29,14 @@ index 4543818..d030217 100644
--- a/disk-utils/blockdev.c
+++ b/disk-utils/blockdev.c
@@ -127,7 +127,7 @@ static const struct bdc bdcms[] =
.argname = "<bytes>",
.argtype = ARG_INT,
.flags = FL_NORESULT,
.argname = "<bytes>",
.argtype = ARG_INT,
.flags = FL_NORESULT,
- .help = N_("set blocksize")
+ .help = N_("set blocksize on file descriptor opening the block device")
},{
IOCTL_ENTRY(BLKGETSIZE),
.name = "--getsize",
--
},{
IOCTL_ENTRY(BLKGETSIZE),
.name = "--getsize",
--
1.8.3.1


9
SOURCES/2.24-fsck-fstab.patch

@ -2,9 +2,9 @@ diff -up util-linux-2.23.2/disk-utils/fsck.c.kzak util-linux-2.23.2/disk-utils/f @@ -2,9 +2,9 @@ diff -up util-linux-2.23.2/disk-utils/fsck.c.kzak util-linux-2.23.2/disk-utils/f
--- util-linux-2.23.2/disk-utils/fsck.c.kzak 2013-06-13 09:46:10.377650254 +0200
+++ util-linux-2.23.2/disk-utils/fsck.c 2014-03-25 12:46:59.525939425 +0100
@@ -437,10 +437,14 @@ static void load_fs_info(void)
if (mnt_table_parse_fstab(fstab, path)) {
if (!path)
path = mnt_get_fstab_path();
if (mnt_table_parse_fstab(fstab, path)) {
if (!path)
path = mnt_get_fstab_path();
- if (errno)
- warn(_("%s: failed to parse fstab"), path);
- else
@ -17,5 +17,6 @@ diff -up util-linux-2.23.2/disk-utils/fsck.c.kzak util-linux-2.23.2/disk-utils/f @@ -17,5 +17,6 @@ diff -up util-linux-2.23.2/disk-utils/fsck.c.kzak util-linux-2.23.2/disk-utils/f
+ else
+ warnx(_("%s: failed to parse fstab"), path);
+ }
}
}
}

17
SOURCES/2.24-libfdisk-fix-SIGFPE.patch

@ -19,21 +19,22 @@ index ac44e73..4d4ab48 100644 @@ -19,21 +19,22 @@ index ac44e73..4d4ab48 100644
--- a/libfdisk/src/alignment.c
+++ b/libfdisk/src/alignment.c
@@ -193,11 +193,12 @@ int fdisk_discover_geometry(struct fdisk_context *cxt)

/* what the kernel/bios thinks the geometry is */
blkdev_get_geometry(cxt->dev_fd, &h, &s);
/* what the kernel/bios thinks the geometry is */
blkdev_get_geometry(cxt->dev_fd, &h, &s);
- if (!h && !s) {
- /* unable to discover geometry, use default values */
- s = 63;
+
+ /* defaults */
+ if (!h)
h = 255;
h = 255;
- }
+ if (!s)
+ s = 63;

/* obtained heads and sectors */
cxt->geom.heads = h;
--
/* obtained heads and sectors */
cxt->geom.heads = h;
--
1.8.1.4


82
SOURCES/2.24-libmount-3.14.patch

@ -4,77 +4,77 @@ diff -up util-linux-2.23.2/libmount/src/tab.c.kzak util-linux-2.23.2/libmount/sr @@ -4,77 +4,77 @@ diff -up util-linux-2.23.2/libmount/src/tab.c.kzak util-linux-2.23.2/libmount/sr
@@ -47,6 +47,8 @@
#include "strutils.h"
#include "loopdev.h"

+static int is_mountinfo(struct libmnt_table *tb);
+
/**
* mnt_new_table:
*
@@ -233,7 +235,7 @@ int mnt_table_get_root_fs(struct libmnt_
assert(tb);
assert(root);

assert(tb);
assert(root);
- if (!tb || !root)
+ if (!tb || !root || !is_mountinfo(tb))
return -EINVAL;

DBG(TAB, mnt_debug_h(tb, "lookup root fs"));
return -EINVAL;
DBG(TAB, mnt_debug_h(tb, "lookup root fs"));
@@ -241,8 +243,6 @@ int mnt_table_get_root_fs(struct libmnt_
mnt_reset_iter(&itr, MNT_ITER_FORWARD);
while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
int id = mnt_fs_get_parent_id(fs);
mnt_reset_iter(&itr, MNT_ITER_FORWARD);
while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
int id = mnt_fs_get_parent_id(fs);
- if (!id)
- break; /* @tab is not mountinfo file? */

if (!*root || id < root_id) {
*root = fs;
if (!*root || id < root_id) {
*root = fs;
@@ -250,7 +250,7 @@ int mnt_table_get_root_fs(struct libmnt_
}
}

}
}
- return root_id ? 0 : -EINVAL;
+ return *root ? 0 : -EINVAL;
}

/**
@@ -271,15 +271,13 @@ int mnt_table_next_child_fs(struct libmn
struct libmnt_fs *fs;
int parent_id, lastchld_id = 0, chld_id = 0;

struct libmnt_fs *fs;
int parent_id, lastchld_id = 0, chld_id = 0;
- if (!tb || !itr || !parent)
+ if (!tb || !itr || !parent || !is_mountinfo(tb))
return -EINVAL;

DBG(TAB, mnt_debug_h(tb, "lookup next child of '%s'",
mnt_fs_get_target(parent)));

parent_id = mnt_fs_get_id(parent);
return -EINVAL;
DBG(TAB, mnt_debug_h(tb, "lookup next child of '%s'",
mnt_fs_get_target(parent)));
parent_id = mnt_fs_get_id(parent);
- if (!parent_id)
- return -EINVAL;

/* get ID of the previously returned child */
if (itr->head && itr->p != itr->head) {
/* get ID of the previously returned child */
if (itr->head && itr->p != itr->head) {
@@ -310,7 +308,7 @@ int mnt_table_next_child_fs(struct libmn
}
}

}
}
- if (!chld_id)
+ if (!*chld)
return 1; /* end of iterator */

/* set the iterator to the @chld for the next call */
return 1; /* end of iterator */
/* set the iterator to the @chld for the next call */
diff -up util-linux-2.23.2/misc-utils/findmnt.c.kzak util-linux-2.23.2/misc-utils/findmnt.c
--- util-linux-2.23.2/misc-utils/findmnt.c.kzak 2013-07-30 11:07:35.138395654 +0200
+++ util-linux-2.23.2/misc-utils/findmnt.c 2014-09-25 10:49:50.953050560 +0200
@@ -826,8 +826,9 @@ static int tab_is_tree(struct libmnt_tab
if (!itr)
return 0;

if (!itr)
return 0;
- if (mnt_table_next_fs(tb, itr, &fs) == 0)
- rc = mnt_fs_get_id(fs) > 0 && mnt_fs_get_parent_id(fs) > 0;
+ rc = (mnt_table_next_fs(tb, itr, &fs) == 0 &&
+ mnt_fs_is_kernel(fs) &&
+ mnt_fs_get_root(fs));

mnt_free_iter(itr);
return rc;
mnt_free_iter(itr);
return rc;

15
SOURCES/2.24-libmount-canonicalize-for-conversion-from-loopdev.patch

@ -22,9 +22,9 @@ index 2b791c4..b02902c 100644 @@ -22,9 +22,9 @@ index 2b791c4..b02902c 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -161,7 +161,12 @@ try_loopdev:
struct stat st;

if (stat(tgt, &st) == 0 && S_ISREG(st.st_mode)) {
struct stat st;
if (stat(tgt, &st) == 0 && S_ISREG(st.st_mode)) {
- int count = loopdev_count_by_backing_file(tgt, &loopdev);
+ int count;
+
@ -32,8 +32,9 @@ index 2b791c4..b02902c 100644 @@ -32,8 +32,9 @@ index 2b791c4..b02902c 100644
+ count = loopdev_count_by_backing_file(cn_tgt, &loopdev);
+ if (!cache)
+ free(cn_tgt);
if (count == 1) {
DBG(CXT, mnt_debug_h(cxt,
"umount: %s --> %s (retry)", tgt, loopdev));
--
if (count == 1) {
DBG(CXT, mnt_debug_h(cxt,
"umount: %s --> %s (retry)", tgt, loopdev));
--
1.8.1.4


24
SOURCES/2.24-libmount-mem.patch

@ -2,23 +2,23 @@ diff -up util-linux-2.23.2/libmount/src/context_umount.c.kzak util-linux-2.23.2/ @@ -2,23 +2,23 @@ diff -up util-linux-2.23.2/libmount/src/context_umount.c.kzak util-linux-2.23.2/
--- util-linux-2.23.2/libmount/src/context_umount.c.kzak 2013-10-07 11:43:10.990598629 +0200
+++ util-linux-2.23.2/libmount/src/context_umount.c 2013-10-07 11:46:01.051031431 +0200
@@ -423,6 +423,8 @@ static int evaluate_permissions(struct l
if (optstr && !mnt_optstr_get_option(optstr,
"user", &mtab_user, &sz) && sz)
ok = !strncmp(curr_user, mtab_user, sz);
if (optstr && !mnt_optstr_get_option(optstr,
"user", &mtab_user, &sz) && sz)
ok = !strncmp(curr_user, mtab_user, sz);
+
+ free(curr_user);
}

if (ok) {
}
if (ok) {
diff -up util-linux-2.23.2/libmount/src/utils.c.kzak util-linux-2.23.2/libmount/src/utils.c
--- util-linux-2.23.2/libmount/src/utils.c.kzak 2013-07-30 11:15:27.391515623 +0200
+++ util-linux-2.23.2/libmount/src/utils.c 2013-10-07 11:43:27.209924834 +0200
@@ -159,7 +159,7 @@ int mnt_chdir_to_parent(const char *targ
if (!last || !*last)
memcpy(*filename, ".", 2);
else
if (!last || !*last)
memcpy(*filename, ".", 2);
else
- memcpy(*filename, last, strlen(last) + 1);
+ memmove(*filename, last, strlen(last) + 1);
} else
free(buf);
return 0;
} else
free(buf);
return 0;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save