From 02b70174363ae50196573e881cc10ee5fd154427 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 11:13:37 +0000 Subject: import coreutils-8.22-24.el7 --- diff --git a/SOURCES/coreutils-8.22-date-example-typo.patch b/SOURCES/coreutils-8.22-date-example-typo.patch new file mode 100644 index 0000000..b5835ab --- /dev/null +++ b/SOURCES/coreutils-8.22-date-example-typo.patch @@ -0,0 +1,30 @@ +From f29a7fb5907c09c53784886997899d5f36c37e86 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Thu, 1 Sep 2016 16:39:04 +0100 +Subject: [PATCH] doc: fix typo in date example + +* doc/coreutils.texi (date invocation): Add a missing quotation mark. +Fixes http://bugs.gnu.org/24349 + +Upstream-commit: 22d188e2991ce64445ba89dbb32e3c6bec42e235 +Signed-off-by: Kamil Dudka +--- + doc/coreutils.texi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/coreutils.texi b/doc/coreutils.texi +index a58339a..88d6506 100644 +--- a/doc/coreutils.texi ++++ b/doc/coreutils.texi +@@ -15467,7 +15467,7 @@ of the month, you can use the (GNU extension) + the padding altogether: + + @example +-date -d 1may '+%B %-d ++date -d 1may '+%B %-d' + @end example + + @item +-- +2.17.2 + diff --git a/SOURCES/coreutils-8.22-df-bind-mount.patch b/SOURCES/coreutils-8.22-df-bind-mount.patch new file mode 100644 index 0000000..9b2be3e --- /dev/null +++ b/SOURCES/coreutils-8.22-df-bind-mount.patch @@ -0,0 +1,975 @@ +From e82cfd53cfd127e5877aefa5ea1d50bfe71d1788 Mon Sep 17 00:00:00 2001 +From: Fridolin Pokorny +Date: Wed, 27 Aug 2014 15:25:30 +0200 +Subject: [PATCH 1/9] mountlist: use /proc/self/mountinfo when available + +Use libmount to propagate device IDs provided by Linux in +/proc/self/mountinfo. This will give more accurate output when +using df in chroot'ed environments as the device IDs are not +determined by stat() which may be inaccurate within the chroot. + +* lib/mountlist.c (read_file_system_list): Use the libmount routines +from util-linux to parse "/proc/self/mountinfo" or fall back to +standard getmntent() processing. +* m4/ls-mntd-fs.m4: Check for libmount only when 1-argument +getmntent() is used, as is the case on GNU/Linux. +* DEPENDENCIES: Mention the optional util-linux dependency. + +Upstream-commit: 3ea43e02541ece750ffc6cd1dfe34195421b4ef3 +Signed-off-by: Kamil Dudka +--- + lib/mountlist.c | 82 ++++++++++++++++++++++++++++++++++++------------ + m4/ls-mntd-fs.m4 | 15 ++++++++- + 2 files changed, 76 insertions(+), 21 deletions(-) + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index 17779f6..617fa88 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -128,6 +128,12 @@ + # include + #endif + ++#ifdef MOUNTED_PROC_MOUNTINFO ++/* Use /proc/self/mountinfo instead of /proc/self/mounts (/etc/mtab) ++ * on Linux, if available */ ++# include ++#endif ++ + #ifndef HAVE_HASMNTOPT + # define hasmntopt(mnt, opt) ((char *) 0) + #endif +@@ -430,32 +436,68 @@ read_file_system_list (bool need_fs_type) + + #ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ + { +- struct mntent *mnt; +- char const *table = MOUNTED; +- FILE *fp; ++#ifdef MOUNTED_PROC_MOUNTINFO ++ struct libmnt_table *fstable = NULL; + +- fp = setmntent (table, "r"); +- if (fp == NULL) +- return NULL; ++ fstable = mnt_new_table_from_file ("/proc/self/mountinfo"); + +- while ((mnt = getmntent (fp))) ++ if (fstable != NULL) + { +- me = xmalloc (sizeof *me); +- me->me_devname = xstrdup (mnt->mnt_fsname); +- me->me_mountdir = xstrdup (mnt->mnt_dir); +- me->me_type = xstrdup (mnt->mnt_type); +- me->me_type_malloced = 1; +- me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt); +- me->me_remote = ME_REMOTE (me->me_devname, me->me_type); +- me->me_dev = dev_from_mount_options (mnt->mnt_opts); ++ struct libmnt_fs *fs; ++ struct libmnt_iter *iter; + +- /* Add to the linked list. */ +- *mtail = me; +- mtail = &me->me_next; ++ iter = mnt_new_iter (MNT_ITER_FORWARD); ++ ++ while (iter && mnt_table_next_fs (fstable, iter, &fs) == 0) ++ { ++ me = xmalloc (sizeof *me); ++ ++ me->me_devname = xstrdup (mnt_fs_get_source (fs)); ++ me->me_mountdir = xstrdup (mnt_fs_get_target (fs)); ++ me->me_type = xstrdup (mnt_fs_get_fstype (fs)); ++ me->me_type_malloced = 1; ++ me->me_dev = mnt_fs_get_devno (fs); ++ me->me_dummy = mnt_fs_is_pseudofs (fs); ++ me->me_remote = mnt_fs_is_netfs (fs); ++ ++ /* Add to the linked list. */ ++ *mtail = me; ++ mtail = &me->me_next; ++ } ++ ++ mnt_free_iter (iter); ++ mnt_free_table (fstable); + } ++ else /* fallback to /proc/self/mounts (/etc/mtab) if anything failed */ ++#endif /* MOUNTED_PROC_MOUNTINFO */ ++ { ++ FILE * fp; ++ struct mntent *mnt; ++ char const *table = MOUNTED; + +- if (endmntent (fp) == 0) +- goto free_then_fail; ++ fp = setmntent (table, "r"); ++ if (fp == NULL) ++ return NULL; ++ ++ while ((mnt = getmntent (fp))) ++ { ++ me = xmalloc (sizeof *me); ++ me->me_devname = xstrdup (mnt->mnt_fsname); ++ me->me_mountdir = xstrdup (mnt->mnt_dir); ++ me->me_type = xstrdup (mnt->mnt_type); ++ me->me_type_malloced = 1; ++ me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt); ++ me->me_remote = ME_REMOTE (me->me_devname, me->me_type); ++ me->me_dev = dev_from_mount_options (mnt->mnt_opts); ++ ++ /* Add to the linked list. */ ++ *mtail = me; ++ mtail = &me->me_next; ++ } ++ ++ if (endmntent (fp) == 0) ++ goto free_then_fail; ++ } + } + #endif /* MOUNTED_GETMNTENT1. */ + +diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 +index fb116c8..bc5ed82 100644 +--- a/m4/ls-mntd-fs.m4 ++++ b/m4/ls-mntd-fs.m4 +@@ -1,4 +1,4 @@ +-# serial 30 ++# serial 31 + # How to list mounted file systems. + + # Copyright (C) 1998-2004, 2006, 2009-2013 Free Software Foundation, Inc. +@@ -168,6 +168,19 @@ if test $ac_cv_func_getmntent = yes; then + [Define if there is a function named getmntent for reading the list of + mounted file systems, and that function takes two arguments. (SVR4)]) + AC_CHECK_FUNCS([hasmntopt]) ++ ++ # Check for libmount to support /proc/self/mountinfo on Linux ++ AC_CACHE_VAL([ac_cv_lib_libmount_mnt_table_parse_stream], ++ [AC_CHECK_LIB([mount], [mnt_new_table_from_file], ++ ac_cv_lib_mount_mnt_table_parse_stream=yes, ++ ac_cv_lib_mount_mnt_table_parse_stream=no)]) ++ if test $ac_cv_lib_mount_mnt_table_parse_stream = yes; then ++ AC_DEFINE([MOUNTED_PROC_MOUNTINFO], [1], ++ [Define if want to use /proc/self/mountinfo on Linux.]) ++ LIBS="-lmount $LIBS" ++ elif test -f /proc/self/mountinfo; then ++ AC_MSG_WARN([/proc/self/mountinfo present but libmount is missing.]) ++ fi + fi + fi + +-- +2.17.2 + + +From 7e5e39933b60761dbd5ad1b0e2d8c075d72ef322 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Thu, 30 Oct 2014 04:08:50 +0000 +Subject: [PATCH 2/9] mountlist: don't use libmount to decide on dummy/remote + +* lib/mountlist.c (read_file_system_list): Don't use the libmount +routines to determine whether a file system is dummy or remote, +as they're not currently compatible. For example the remoteness +is determined on file system type (for which the list seems incomplete), +rather than simply checking for a ':' in the device name. +Also libmount currently determines that 'tmpfs' is a dummy file system +even though it has associated storage. + +Upstream-commit: 2768ceb7994506e2cfba88be3b6bd13ef5440a90 +Signed-off-by: Kamil Dudka +--- + lib/mountlist.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index 617fa88..b01846c 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -182,10 +182,9 @@ + we grant an exception to any with "bind" in its list of mount options. + I.e., those are *not* dummy entries. */ + #ifdef MOUNTED_GETMNTENT1 +-# define ME_DUMMY(Fs_name, Fs_type, Fs_ent) \ ++# define ME_DUMMY(Fs_name, Fs_type, Bind) \ + (ME_DUMMY_0 (Fs_name, Fs_type) \ +- || (strcmp (Fs_type, "none") == 0 \ +- && !hasmntopt (Fs_ent, "bind"))) ++ || (strcmp (Fs_type, "none") == 0 && !Bind)) + #else + # define ME_DUMMY(Fs_name, Fs_type) \ + (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0) +@@ -457,8 +456,14 @@ read_file_system_list (bool need_fs_type) + me->me_type = xstrdup (mnt_fs_get_fstype (fs)); + me->me_type_malloced = 1; + me->me_dev = mnt_fs_get_devno (fs); +- me->me_dummy = mnt_fs_is_pseudofs (fs); +- me->me_remote = mnt_fs_is_netfs (fs); ++ /* Note we don't use mnt_fs_is_pseudofs() or mnt_fs_is_netfs() here ++ as libmount's classification is non-compatible currently. ++ Also we pass "false" for the "Bind" option as that's only ++ significant when the Fs_type is "none" which will not be ++ the case when parsing "/proc/self/mountinfo", and only ++ applies for static /etc/mtab files. */ ++ me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, false); ++ me->me_remote = ME_REMOTE (me->me_devname, me->me_type); + + /* Add to the linked list. */ + *mtail = me; +@@ -481,12 +486,14 @@ read_file_system_list (bool need_fs_type) + + while ((mnt = getmntent (fp))) + { ++ bool bind = hasmntopt (mnt, "bind"); ++ + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (mnt->mnt_fsname); + me->me_mountdir = xstrdup (mnt->mnt_dir); + me->me_type = xstrdup (mnt->mnt_type); + me->me_type_malloced = 1; +- me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt); ++ me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, bind); + me->me_remote = ME_REMOTE (me->me_devname, me->me_type); + me->me_dev = dev_from_mount_options (mnt->mnt_opts); + +-- +2.17.2 + + +From e51d88d267c5222ed2bd852bc4701dfe87d8360a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Thu, 2 Apr 2015 04:18:02 +0100 +Subject: [PATCH 3/9] mountlist: remove dependency on libmount + +* lib/mountlist.c (read_file_system_list): Parse /proc/self/mountinfo +directly, rather than depending on libmount, which has many +dependencies due to its dependence on libselinux, as detailed at: +http://lists.gnu.org/archive/html/bug-gnulib/2015-01/msg00063.html +Note we restrict this to __linux__ as that's probably where this +interface will remain. If ever porting, it would be best +to first pull the makedev() wrapper from coreutils to a gnulib module. +Note also we don't add a getline dependency to the mountlist module, +as all Linux versions are sufficient. + +Upstream-commit: 3fb6e360363744462ce15c381f0b116c6fc4ce82 +Signed-off-by: Kamil Dudka +--- + lib/mountlist.c | 128 ++++++++++++++++++++++++++++++++++++----------- + m4/ls-mntd-fs.m4 | 17 +------ + 2 files changed, 102 insertions(+), 43 deletions(-) + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index b01846c..2dbb245 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -58,6 +58,7 @@ + + #ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ + # include ++# include + # if !defined MOUNTED + # if defined _PATH_MOUNTED /* GNU libc */ + # define MOUNTED _PATH_MOUNTED +@@ -128,12 +129,6 @@ + # include + #endif + +-#ifdef MOUNTED_PROC_MOUNTINFO +-/* Use /proc/self/mountinfo instead of /proc/self/mounts (/etc/mtab) +- * on Linux, if available */ +-# include +-#endif +- + #ifndef HAVE_HASMNTOPT + # define hasmntopt(mnt, opt) ((char *) 0) + #endif +@@ -389,6 +384,34 @@ dev_from_mount_options (char const *mount_options) + + #endif + ++#if defined MOUNTED_GETMNTENT1 && defined __linux__ ++ ++/* Unescape the paths in mount tables. ++ STR is updated in place. */ ++ ++static void ++unescape_tab (char *str) ++{ ++ size_t i, j = 0; ++ size_t len = strlen (str) + 1; ++ for (i = 0; i < len; i++) ++ { ++ if (str[i] == '\\' && (i + 4 < len) ++ && str[i + 1] >= '0' && str[i + 1] <= '3' ++ && str[i + 2] >= '0' && str[i + 2] <= '7' ++ && str[i + 3] >= '0' && str[i + 3] <= '7') ++ { ++ str[j++] = (str[i + 1] - '0') * 64 + ++ (str[i + 2] - '0') * 8 + ++ (str[i + 3] - '0'); ++ i += 3; ++ } ++ else ++ str[j++] = str[i]; ++ } ++} ++#endif ++ + /* Return a list of the currently mounted file systems, or NULL on error. + Add each entry to the tail of the list so that they stay in order. + If NEED_FS_TYPE is true, ensure that the file system type fields in +@@ -435,30 +458,70 @@ read_file_system_list (bool need_fs_type) + + #ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ + { +-#ifdef MOUNTED_PROC_MOUNTINFO +- struct libmnt_table *fstable = NULL; +- +- fstable = mnt_new_table_from_file ("/proc/self/mountinfo"); ++ FILE *fp; + +- if (fstable != NULL) ++#ifdef __linux__ ++ /* Try parsing mountinfo first, as that make device IDs available. ++ Note we could use libmount routines to simplify this parsing a little ++ (and that code is in previous versions of this function), however ++ libmount depends on libselinux which pulls in many dependencies. */ ++ char const *mountinfo = "/proc/self/mountinfo"; ++ fp = fopen (mountinfo, "r"); ++ if (fp != NULL) + { +- struct libmnt_fs *fs; +- struct libmnt_iter *iter; ++ char *line = NULL; ++ size_t buf_size = 0; + +- iter = mnt_new_iter (MNT_ITER_FORWARD); +- +- while (iter && mnt_table_next_fs (fstable, iter, &fs) == 0) ++ while (getline (&line, &buf_size, fp) != -1) + { ++ unsigned int devmaj, devmin; ++ int target_s, target_e, type_s, type_e, source_s, source_e; ++ char test; ++ char *dash; ++ int rc; ++ ++ rc = sscanf(line, "%*u " /* id - discarded */ ++ "%*u " /* parent - discarded */ ++ "%u:%u " /* dev major:minor */ ++ "%*s " /* mountroot - discarded */ ++ "%n%*s%n" /* target, start and end */ ++ "%c", /* more data... */ ++ &devmaj, &devmin, ++ &target_s, &target_e, ++ &test); ++ if (rc != 3 && rc != 5) /* 5 if %n included in count. */ ++ continue; ++ ++ /* skip optional fields, terminated by " - " */ ++ dash = strstr (line + target_e, " - "); ++ if (! dash) ++ continue; ++ ++ rc = sscanf(dash, " - " ++ "%n%*s%n " /* FS type, start and end */ ++ "%n%*s%n " /* source, start and end */ ++ "%c", /* more data... */ ++ &type_s, &type_e, ++ &source_s, &source_e, ++ &test); ++ if (rc != 1 && rc != 5) /* 5 if %n included in count. */ ++ continue; ++ ++ /* manipulate the sub-strings in place. */ ++ line[target_e] = '\0'; ++ dash[type_e] = '\0'; ++ dash[source_e] = '\0'; ++ unescape_tab (dash + source_s); ++ unescape_tab (line + target_s); ++ + me = xmalloc (sizeof *me); + +- me->me_devname = xstrdup (mnt_fs_get_source (fs)); +- me->me_mountdir = xstrdup (mnt_fs_get_target (fs)); +- me->me_type = xstrdup (mnt_fs_get_fstype (fs)); ++ me->me_devname = xstrdup (dash + source_s); ++ me->me_mountdir = xstrdup (line + target_s); ++ me->me_type = xstrdup (dash + type_s); + me->me_type_malloced = 1; +- me->me_dev = mnt_fs_get_devno (fs); +- /* Note we don't use mnt_fs_is_pseudofs() or mnt_fs_is_netfs() here +- as libmount's classification is non-compatible currently. +- Also we pass "false" for the "Bind" option as that's only ++ me->me_dev = makedev (devmaj, devmin); ++ /* we pass "false" for the "Bind" option as that's only + significant when the Fs_type is "none" which will not be + the case when parsing "/proc/self/mountinfo", and only + applies for static /etc/mtab files. */ +@@ -470,13 +533,22 @@ read_file_system_list (bool need_fs_type) + mtail = &me->me_next; + } + +- mnt_free_iter (iter); +- mnt_free_table (fstable); ++ free (line); ++ ++ if (ferror (fp)) ++ { ++ int saved_errno = errno; ++ fclose (fp); ++ errno = saved_errno; ++ goto free_then_fail; ++ } ++ ++ if (fclose (fp) == EOF) ++ goto free_then_fail; + } +- else /* fallback to /proc/self/mounts (/etc/mtab) if anything failed */ +-#endif /* MOUNTED_PROC_MOUNTINFO */ ++ else /* fallback to /proc/self/mounts (/etc/mtab). */ ++#endif /* __linux __ */ + { +- FILE * fp; + struct mntent *mnt; + char const *table = MOUNTED; + +diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 +index bc5ed82..412fbfc 100644 +--- a/m4/ls-mntd-fs.m4 ++++ b/m4/ls-mntd-fs.m4 +@@ -1,4 +1,4 @@ +-# serial 31 ++# serial 32 + # How to list mounted file systems. + + # Copyright (C) 1998-2004, 2006, 2009-2013 Free Software Foundation, Inc. +@@ -120,7 +120,7 @@ if test $ac_cv_func_getmntent = yes; then + # Determine whether it's the one-argument variant or the two-argument one. + + if test -z "$ac_list_mounted_fs"; then +- # 4.3BSD, SunOS, HP-UX, Dynix, Irix ++ # GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix + AC_MSG_CHECKING([for one-argument getmntent function]) + AC_CACHE_VAL([fu_cv_sys_mounted_getmntent1], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +@@ -168,19 +168,6 @@ if test $ac_cv_func_getmntent = yes; then + [Define if there is a function named getmntent for reading the list of + mounted file systems, and that function takes two arguments. (SVR4)]) + AC_CHECK_FUNCS([hasmntopt]) +- +- # Check for libmount to support /proc/self/mountinfo on Linux +- AC_CACHE_VAL([ac_cv_lib_libmount_mnt_table_parse_stream], +- [AC_CHECK_LIB([mount], [mnt_new_table_from_file], +- ac_cv_lib_mount_mnt_table_parse_stream=yes, +- ac_cv_lib_mount_mnt_table_parse_stream=no)]) +- if test $ac_cv_lib_mount_mnt_table_parse_stream = yes; then +- AC_DEFINE([MOUNTED_PROC_MOUNTINFO], [1], +- [Define if want to use /proc/self/mountinfo on Linux.]) +- LIBS="-lmount $LIBS" +- elif test -f /proc/self/mountinfo; then +- AC_MSG_WARN([/proc/self/mountinfo present but libmount is missing.]) +- fi + fi + fi + +-- +2.17.2 + + +From a6a7c39b36699fdbbb57679f2f71fc3ae08e8ba2 Mon Sep 17 00:00:00 2001 +From: Dave Chiluk +Date: Mon, 31 Aug 2015 16:07:58 -0500 +Subject: [PATCH 4/9] mountlist: add me_mntroot field on Linux machines + +* lib/mountlist.c (read_file_system_list): Populate me_mntroot in +mount_entry so Linux machines based on /proc/self/mountinfo can +distinguish between bind mounts and original mounts. In reality bind +mounts aren't treated differently than mountroot=/ mounts by the +kernel, but the user often wants these bind mounts distinguished. +* lib/mountlist.h (struct mount_entry): Add me_mntroot element. +More details at https://pad.lv/1432871 + +Upstream-commit: c6148bca89e9465fd6ba3a10d273ec4cb58c2dbe +Signed-off-by: Kamil Dudka +--- + lib/mountlist.c | 25 ++++++++++++++++++++++--- + lib/mountlist.h | 2 ++ + 2 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index 2dbb245..f4d285a 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -444,6 +444,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (mnt->mnt_fsname); + me->me_mountdir = xstrdup (mnt->mnt_dir); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (mnt->mnt_type); + me->me_type_malloced = 1; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); +@@ -475,7 +476,8 @@ read_file_system_list (bool need_fs_type) + while (getline (&line, &buf_size, fp) != -1) + { + unsigned int devmaj, devmin; +- int target_s, target_e, type_s, type_e, source_s, source_e; ++ int target_s, target_e, type_s, type_e; ++ int source_s, source_e, mntroot_s, mntroot_e; + char test; + char *dash; + int rc; +@@ -483,13 +485,15 @@ read_file_system_list (bool need_fs_type) + rc = sscanf(line, "%*u " /* id - discarded */ + "%*u " /* parent - discarded */ + "%u:%u " /* dev major:minor */ +- "%*s " /* mountroot - discarded */ ++ "%n%*s%n " /* mountroot */ + "%n%*s%n" /* target, start and end */ + "%c", /* more data... */ + &devmaj, &devmin, ++ &mntroot_s, &mntroot_e, + &target_s, &target_e, + &test); +- if (rc != 3 && rc != 5) /* 5 if %n included in count. */ ++ ++ if (rc != 3 && rc != 7) /* 7 if %n included in count. */ + continue; + + /* skip optional fields, terminated by " - " */ +@@ -508,16 +512,19 @@ read_file_system_list (bool need_fs_type) + continue; + + /* manipulate the sub-strings in place. */ ++ line[mntroot_e] = '\0'; + line[target_e] = '\0'; + dash[type_e] = '\0'; + dash[source_e] = '\0'; + unescape_tab (dash + source_s); + unescape_tab (line + target_s); ++ unescape_tab (line + mntroot_s); + + me = xmalloc (sizeof *me); + + me->me_devname = xstrdup (dash + source_s); + me->me_mountdir = xstrdup (line + target_s); ++ me->me_mntroot = xstrdup (line + mntroot_s); + me->me_type = xstrdup (dash + type_s); + me->me_type_malloced = 1; + me->me_dev = makedev (devmaj, devmin); +@@ -563,6 +570,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (mnt->mnt_fsname); + me->me_mountdir = xstrdup (mnt->mnt_dir); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (mnt->mnt_type); + me->me_type_malloced = 1; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, bind); +@@ -595,6 +603,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (fsp->f_mntfromname); + me->me_mountdir = xstrdup (fsp->f_mntonname); ++ me->me_mntroot = NULL; + me->me_type = fs_type; + me->me_type_malloced = 0; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); +@@ -621,6 +630,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (fsp->f_mntfromname); + me->me_mountdir = xstrdup (fsp->f_mntonname); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (fsp->f_fstypename); + me->me_type_malloced = 1; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); +@@ -647,6 +657,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (fsd.fd_req.devname); + me->me_mountdir = xstrdup (fsd.fd_req.path); ++ me->me_mntroot = NULL; + me->me_type = gt_names[fsd.fd_req.fstype]; + me->me_type_malloced = 0; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); +@@ -745,6 +756,7 @@ read_file_system_list (bool need_fs_type) + me->me_devname = xstrdup (fi.device_name[0] != '\0' + ? fi.device_name : fi.fsh_name); + me->me_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (fi.fsh_name); + me->me_type_malloced = 1; + me->me_dev = fi.dev; +@@ -794,6 +806,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (stats[counter].f_mntfromname); + me->me_mountdir = xstrdup (stats[counter].f_mntonname); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (FS_TYPE (stats[counter])); + me->me_type_malloced = 1; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); +@@ -830,6 +843,7 @@ read_file_system_list (bool need_fs_type) + strcpy (me->me_devname + 5, mnt.mt_dev); + # endif + me->me_mountdir = xstrdup (mnt.mt_filsys); ++ me->me_mntroot = NULL; + me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ + me->me_type = ""; + me->me_type_malloced = 0; +@@ -877,6 +891,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup ((*ent)->mt_resource); + me->me_mountdir = xstrdup ((*ent)->mt_directory); ++ me->me_mntroot = NULL; + me->me_type = xstrdup ((*ent)->mt_fstype); + me->me_type_malloced = 1; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); +@@ -939,6 +954,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (mnt.mnt_special); + me->me_mountdir = xstrdup (mnt.mnt_mountp); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (mnt.mnt_fstype); + me->me_type_malloced = 1; + me->me_dummy = MNT_IGNORE (&mnt) != 0; +@@ -1015,6 +1031,7 @@ read_file_system_list (bool need_fs_type) + vmp->vmt_data[VMT_OBJECT].vmt_off); + } + me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype)); + me->me_type_malloced = 1; + options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off; +@@ -1058,6 +1075,7 @@ read_file_system_list (bool need_fs_type) + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (dev.f_mntfromname); + me->me_mountdir = xstrdup (dev.f_mntonname); ++ me->me_mntroot = NULL; + me->me_type = xstrdup (dev.f_fstypename); + me->me_type_malloced = 1; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); +@@ -1100,6 +1118,7 @@ void free_mount_entry (struct mount_entry *me) + { + free (me->me_devname); + free (me->me_mountdir); ++ free (me->me_mntroot); + if (me->me_type_malloced) + free (me->me_type); + free (me); +diff --git a/lib/mountlist.h b/lib/mountlist.h +index 55877e2..1872b2b 100644 +--- a/lib/mountlist.h ++++ b/lib/mountlist.h +@@ -27,6 +27,8 @@ struct mount_entry + { + char *me_devname; /* Device node name, including "/dev/". */ + char *me_mountdir; /* Mount point directory name. */ ++ char *me_mntroot; /* Directory on filesystem of device used */ ++ /* as root for the (bind) mount. */ + char *me_type; /* "nfs", "4.2", etc. */ + dev_t me_dev; /* Device number of me_mountdir. */ + unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */ +-- +2.17.2 + + +From 6b301e5f89d4555e33b267e3ea5a709a4b584038 Mon Sep 17 00:00:00 2001 +From: Andrew Borodin +Date: Sun, 27 Sep 2015 11:41:17 +0300 +Subject: [PATCH 5/9] mountlist: clean up of variable duplication + +* lib/mountlist.c (read_file_system_list) [MOUNTED_LISTMNTENT]: +the 'me' variable is already declared above. Remove it here. + +Upstream-commit: 1eda6d17e93fa496368f82cac6317b8045cc9373 +Signed-off-by: Kamil Dudka +--- + lib/mountlist.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index f4d285a..6f66996 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -429,7 +429,6 @@ read_file_system_list (bool need_fs_type) + { + struct tabmntent *mntlist, *p; + struct mntent *mnt; +- struct mount_entry *me; + + /* the third and fourth arguments could be used to filter mounts, + but Crays doesn't seem to have any mounts that we want to +-- +2.17.2 + + +From b2063df8d13fc279f3fa38d1315e3ff3f66c70e5 Mon Sep 17 00:00:00 2001 +From: Eric Blake +Date: Wed, 14 Sep 2016 19:21:42 -0500 +Subject: [PATCH 6/9] mountlist: include sysmacros.h for glibc + +On Fedora rawhide (glibc 2.25), './gnulib-tool --test mountlist' +reports: +../../gllib/mountlist.c: In function 'read_file_system_list': +../../gllib/mountlist.c:534:13: warning: '__makedev_from_sys_types' is deprecated: + In the GNU C Library, `makedev' is defined by . + For historical compatibility, it is currently defined by + as well, but we plan to remove this soon. + To use `makedev', include directly. + If you did not intend to use a system-defined macro `makedev', + you should #undef it after including . + [-Wdeprecated-declarations] + me->me_dev = makedev (devmaj, devmin); + ^~ +In file included from /usr/include/features.h:397:0, + from /usr/include/sys/types.h:25, + from ./sys/types.h:28, + from ../../gllib/mountlist.h:23, + from ../../gllib/mountlist.c:20: +/usr/include/sys/sysmacros.h:89:1: note: declared here + __SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_FST_IMPL_TEMPL) + ^ + +Fix it by including the right headers. We also need a fix to +autoconf's AC_HEADER_MAJOR, but that's a separate patch. + +* m4/mountlist.m4 (gl_PREREQ_MOUTLIST_EXTRA): Include +AC_HEADER_MAJOR. +* lib/mountlist.c (includes): Use correct headers. + +Signed-off-by: Eric Blake + +Upstream-commit: 4da63c5881f60f71999a943612da9112232b9161 +Signed-off-by: Kamil Dudka +--- + lib/mountlist.c | 6 ++++++ + m4/mountlist.m4 | 3 ++- + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index 6f66996..40338ac 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -37,6 +37,12 @@ + # include + #endif + ++#if MAJOR_IN_MKDEV ++# include ++#elif MAJOR_IN_SYSMACROS ++# include ++#endif ++ + #if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */ + # if HAVE_SYS_UCRED_H + # include /* needed on OSF V4.0 for definition of NGROUPS, +diff --git a/m4/mountlist.m4 b/m4/mountlist.m4 +index cd137c9..2f47ce2 100644 +--- a/m4/mountlist.m4 ++++ b/m4/mountlist.m4 +@@ -1,4 +1,4 @@ +-# serial 11 ++# serial 12 + dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, +@@ -15,5 +15,6 @@ AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], + [ + dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h. + AC_CHECK_HEADERS([sys/mntent.h]) ++ AC_HEADER_MAJOR()dnl for use of makedev () + gl_FSTYPENAME + ]) +-- +2.17.2 + + +From 472ef28870dce7ca7505fa2ca477040da347a567 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Thu, 2 Apr 2015 05:34:07 +0100 +Subject: [PATCH 7/9] df: fix use of uninitialized variable reported by + valgrind + + Conditional jump or move depends on uninitialised value(s) + at 0x40380C: get_field_values (df.c:840) + by 0x403E16: get_dev (df.c:994) + by 0x404D65: get_all_entries (df.c:1364) + by 0x405926: main (df.c:1714) + +* src/df.c (get_dev): Initialize the fsu.fsu_bavail_top_bit_set +member, when adding placeholder entries. +(main): Avoid a "definitely lost" memory leak warning from valgrind, +reported by Bernhard Voelker. + +Upstream-commit: bf180f8f5a53eb82054e85e26dcd1ea7c43dbdfe +Signed-off-by: Kamil Dudka +--- + src/df.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/df.c b/src/df.c +index ce11b50..5ffd0a5 100644 +--- a/src/df.c ++++ b/src/df.c +@@ -935,6 +935,7 @@ get_dev (char const *disk, char const *mount_point, char const* file, + return; + + fstype = "-"; ++ fsu.fsu_bavail_top_bit_set = false; + fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree = + fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX; + } +@@ -959,6 +960,7 @@ get_dev (char const *disk, char const *mount_point, char const* file, + && (! dev_me->me_remote || ! me_remote)) + { + fstype = "-"; ++ fsu.fsu_bavail_top_bit_set = false; + fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree = + fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX; + } +@@ -1736,6 +1738,8 @@ main (int argc, char **argv) + for (i = optind; i < argc; ++i) + if (argv[i]) + get_entry (argv[i], &stats[i - optind]); ++ ++ IF_LINT (free (stats)); + } + else + get_all_entries (); +-- +2.17.2 + + +From fc6104cc9d8d2908b3225b035def82d3a95bdfd0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Sun, 5 Apr 2015 18:21:38 +0100 +Subject: [PATCH 8/9] df: fix --local hanging with inaccessible remote mounts + +* src/df.c (filter_mount_list): With -l, avoid stating remote mounts. +* init.cfg: Avoid test hangs with inaccessible remote mounts. +* tests/df/no-mtab-status.sh: Skip with inaccessible remote mounts. +* tests/df/skip-rootfs.sh: Likewise. +* tests/df/total-verify.sh: Likewise. +* NEWS: Mention the bug fix. +Reported at http://bugzilla.redhat.com/1199679 + +Upstream-commit: 1b1c40e1d6f8cf30b6c7c9d31bbddbc3d5cc72e6 +Signed-off-by: Kamil Dudka +--- + init.cfg | 2 +- + tests/df/no-mtab-status.sh | 3 ++- + tests/df/skip-rootfs.sh | 3 ++- + tests/df/total-verify.sh | 3 ++- + 4 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/init.cfg b/init.cfg +index 3364a73..d5a80bb 100644 +--- a/init.cfg ++++ b/init.cfg +@@ -79,7 +79,7 @@ is_local_dir_() + require_mount_list_() + { + local mount_list_fail='cannot read table of mounted file systems' +- df 2>&1 | grep -F "$mount_list_fail" >/dev/null && ++ df --local 2>&1 | grep -F "$mount_list_fail" >/dev/null && + skip_ "$mount_list_fail" + } + +diff --git a/tests/df/no-mtab-status.sh b/tests/df/no-mtab-status.sh +index 2e6b61b..9b6b9d3 100755 +--- a/tests/df/no-mtab-status.sh ++++ b/tests/df/no-mtab-status.sh +@@ -21,7 +21,8 @@ + print_ver_ df + require_gcc_shared_ + +-df || skip_ "df fails" ++# Protect against inaccessible remote mounts etc. ++timeout 10 df || skip_ "df fails" + + # Simulate "mtab" failure. + cat > k.c <<'EOF' || framework_failure_ +diff --git a/tests/df/skip-rootfs.sh b/tests/df/skip-rootfs.sh +index 9c5d0a9..b79751e 100755 +--- a/tests/df/skip-rootfs.sh ++++ b/tests/df/skip-rootfs.sh +@@ -19,7 +19,8 @@ + . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src + print_ver_ df + +-df || skip_ "df fails" ++# Protect against inaccessible remote mounts etc. ++timeout 10 df || skip_ "df fails" + + # Verify that rootfs is in mtab (and shown when the -a option is specified). + df -a >out || fail=1 +diff --git a/tests/df/total-verify.sh b/tests/df/total-verify.sh +index a045ccf..f05a91e 100755 +--- a/tests/df/total-verify.sh ++++ b/tests/df/total-verify.sh +@@ -20,7 +20,8 @@ + print_ver_ df + require_perl_ + +-df || skip_ "df fails" ++# Protect against inaccessible remote mounts etc. ++timeout 10 df || skip_ "df fails" + + cat <<\EOF > check-df || framework_failure_ + my ($total, $used, $avail) = (0, 0, 0); +-- +2.17.2 + + +From 9a52ebdc70071076a1b7263b64b118972d203778 Mon Sep 17 00:00:00 2001 +From: Dave Chiluk +Date: Mon, 21 Sep 2015 15:04:11 -0500 +Subject: [PATCH 9/9] df: prioritize mounts nearer the device root + +In the presence of bind mounts of a device, the 4th "mount root" field +from /proc/self/mountinfo is now considered, so as to prefer mount +points closer to the root of the device. Note on older systems with +an /etc/mtab file, the source device was listed as the originating +directory, and so this was not an issue. +Details at http://pad.lv/1432871 + +* src/df.c (filter_mount_list): When deduplicating mount entries, +only prefer sources nearer or at the root of the device, when the +target is nearer the root of the device. +* NEWS: Mention the change in behavior. + +Upstream-commit: 3babaf83875ceac896c8dd3a64248e955dfecef9 +Signed-off-by: Kamil Dudka +--- + src/df.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/df.c b/src/df.c +index 5ffd0a5..c50aa80 100644 +--- a/src/df.c ++++ b/src/df.c +@@ -649,6 +649,13 @@ filter_mount_list (bool devices_only) + + if (devlist) + { ++ bool target_nearer_root = strlen (devlist->me->me_mountdir) ++ > strlen (me->me_mountdir); ++ /* With bind mounts, prefer items nearer the root of the source */ ++ bool source_below_root = devlist->me->me_mntroot != NULL ++ && me->me_mntroot != NULL ++ && (strlen (devlist->me->me_mntroot) ++ < strlen (me->me_mntroot)); + if (! print_grand_total && me->me_remote && devlist->me->me_remote + && ! STREQ (devlist->me->me_devname, me->me_devname)) + { +@@ -660,9 +667,8 @@ filter_mount_list (bool devices_only) + else if ((strchr (me->me_devname, '/') + /* let "real" devices with '/' in the name win. */ + && ! strchr (devlist->me->me_devname, '/')) +- /* let a shorter mountdir win. */ +- || (strlen (devlist->me->me_mountdir) +- > strlen (me->me_mountdir)) ++ /* let points towards the root of the device win. */ ++ || (target_nearer_root && ! source_below_root) + /* let an entry overmounted on a new device win... */ + || (! STREQ (devlist->me->me_devname, me->me_devname) + /* ... but only when matching an existing mnt point, +-- +2.17.2 + diff --git a/SOURCES/coreutils-8.22-df-dummy-local.patch b/SOURCES/coreutils-8.22-df-dummy-local.patch new file mode 100644 index 0000000..07b971f --- /dev/null +++ b/SOURCES/coreutils-8.22-df-dummy-local.patch @@ -0,0 +1,45 @@ +From 20e22775051d4392b9e41b717711535178395ec4 Mon Sep 17 00:00:00 2001 +From: Josef Cejka +Date: Tue, 1 Aug 2017 01:50:34 +0200 +Subject: [PATCH] df: avoid stat() for dummy file systems with -l + +When systemd is configured to automount a remote file system - see +'man systemd.automount(5)', then the mount point is initially +mounted by systemd with the file system type "autofs". +When the resource is used later on, then the wanted file system is +mounted over that mount point on demand. +'df -l' triggered systemd to mount the file system because it called +stat() on the mount point. +Instead of single-casing "autofs" targets, we can avoid stat()ing +all dummy file systems (which includes "autofs"), because those are +skipped later on in get_dev() anyway. + +*src/df.c (filter_mount_list): Also skip dummy file systems unless +the -a option or a specific target are given. +* NEWS: Mention the fix. + +Co-authored-by: Bernhard Voelker + +Fixes http://bugzilla.suse.com/show_bug.cgi?id=1043059 + +Upstream-commit: a19ff5d8179a7de38109fc78278229fd96f3941a +Signed-off-by: Kamil Dudka +--- + src/df.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/df.c b/src/df.c +index c50aa80..fa20493 100644 +--- a/src/df.c ++++ b/src/df.c +@@ -632,6 +632,7 @@ filter_mount_list (bool devices_only) + On Linux we probably have me_dev populated from /proc/self/mountinfo, + however we still stat() in case another device was mounted later. */ + if ((me->me_remote && show_local_fs) ++ || (me->me_dummy && !show_all_fs && !show_listed_fs) + || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type)) + || -1 == stat (me->me_mountdir, &buf)) + { +-- +2.17.2 + diff --git a/SOURCES/coreutils-8.22-df-stat.patch b/SOURCES/coreutils-8.22-df-stat.patch index bfa3381..fc49946 100644 --- a/SOURCES/coreutils-8.22-df-stat.patch +++ b/SOURCES/coreutils-8.22-df-stat.patch @@ -1,7 +1,7 @@ From 9c4641f42bbecf63ec0a0e05caacbccd5332b831 Mon Sep 17 00:00:00 2001 From: Philipp Thomas Date: Sun, 26 Mar 2017 22:34:00 -0700 -Subject: [PATCH 1/2] df: avoid querying excluded file systems +Subject: [PATCH] df: avoid querying excluded file systems * src/df.c (filter_mount_list): Avoid stat() on explicitly excluded file systems, which is especially @@ -33,40 +33,3 @@ index 5b9e8fd..e0ebed7 100644 } -- 2.13.6 - - -From a4a61effe74766cdf047d6af52cf63613057bd87 Mon Sep 17 00:00:00 2001 -From: Kamil Dudka -Date: Thu, 23 Nov 2017 17:30:09 +0100 -Subject: [PATCH 2/2] df: limit the stat() call optimization for dummy file - systems only - -Otherwise 'df -t rootfs' mistakenly shows a dummy file system without -using the -a option, because the dummy file system is shadowed by the -actual root file system entry, for which we optimize out the stat() -call. - -The problem fixed by this patch is not observable on Fedora because -/proc/self/mountinfo (which we do not use on RHEL) does not contain -the rootfs mount entry. ---- - src/df.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/df.c b/src/df.c -index adade6d..4c6131e 100644 ---- a/src/df.c -+++ b/src/df.c -@@ -632,7 +632,8 @@ filter_mount_list (bool devices_only) - On Linux we probably have me_dev populated from /proc/self/mountinfo, - however we still stat() in case another device was mounted later. */ - if ((me->me_remote && show_local_fs) -- || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type)) -+ || (me->me_dummy && (excluded_fstype (me->me_type) -+ || !selected_fstype (me->me_type))) - || -1 == stat (me->me_mountdir, &buf)) - { - /* If remote, and showing just local, or FS type is excluded, --- -2.13.6 - diff --git a/SOURCES/coreutils-8.22-doc-ls-kibibytes.patch b/SOURCES/coreutils-8.22-doc-ls-kibibytes.patch new file mode 100644 index 0000000..207fa12 --- /dev/null +++ b/SOURCES/coreutils-8.22-doc-ls-kibibytes.patch @@ -0,0 +1,32 @@ +From c6418e3a5cb3a65af79117162a93a66026cc8c36 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Thu, 6 Dec 2018 14:28:00 +0100 +Subject: [PATCH] doc: improve wording of the --kibibytes option description + +Bug: https://bugzilla.redhat.com/1527391 +--- + doc/coreutils.texi | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/doc/coreutils.texi b/doc/coreutils.texi +index 88d6506..772aab6 100644 +--- a/doc/coreutils.texi ++++ b/doc/coreutils.texi +@@ -7615,9 +7615,11 @@ Append @samp{*} for executable regular files, otherwise behave as for + @opindex --kibibytes + Set the default block size to its normal value of 1024 bytes, + overriding any contrary specification in environment variables +-(@pxref{Block size}). This option is in turn overridden by the +-@option{--block-size}, @option{-h} or @option{--human-readable}, and +-@option{--si} options. ++(@pxref{Block size}). If @option{--block-size}, @option{-h}, ++@option{--human-readable}, or @option{--si} options are used, ++they take precedence over @option{-k} or @option{--kibibytes} ++even if @option{-k} or @option{--kibibytes} is placed after ++the other options. + + The @option{-k} or @option{--kibibytes} option affects the + per-directory block count written by the @option{-l} and similar +-- +2.17.2 + diff --git a/SOURCES/coreutils-8.22-newfilesystems.patch b/SOURCES/coreutils-8.22-newfilesystems.patch index f8f0726..60c3f06 100644 --- a/SOURCES/coreutils-8.22-newfilesystems.patch +++ b/SOURCES/coreutils-8.22-newfilesystems.patch @@ -1,15 +1,25 @@ -diff -urNp coreutils-8.22-orig/src/fs-is-local.h coreutils-8.22/src/fs-is-local.h ---- coreutils-8.22-orig/src/fs-is-local.h 2016-06-24 10:59:08.545965484 +0200 -+++ coreutils-8.22/src/fs-is-local.h 2016-06-24 11:08:47.435944633 +0200 -@@ -6,6 +6,7 @@ is_local_fs_type (unsigned long int magi + src/fs-is-local.h | 23 ++++++++++++++++++++ + src/stat.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++------ + src/tail.c | 2 ++ + 3 files changed, 83 insertions(+), 6 deletions(-) + +diff --git a/src/fs-is-local.h b/src/fs-is-local.h +index 61849da..5f73488 100644 +--- a/src/fs-is-local.h ++++ b/src/fs-is-local.h +@@ -6,30 +6,39 @@ is_local_fs_type (unsigned long int magic) { switch (magic) { ++ case S_MAGIC_AAFS: return 1; + case S_MAGIC_ACFS: return 0; case S_MAGIC_ADFS: return 1; case S_MAGIC_AFFS: return 1; case S_MAGIC_AFS: return 0; -@@ -15,13 +16,16 @@ is_local_fs_type (unsigned long int magi + case S_MAGIC_ANON_INODE_FS: return 1; + case S_MAGIC_AUFS: return 0; + case S_MAGIC_AUTOFS: return 1; ++ case S_MAGIC_BALLOON_KVM: return 1; case S_MAGIC_BEFS: return 1; case S_MAGIC_BDEVFS: return 1; case S_MAGIC_BFS: return 1; @@ -19,14 +29,25 @@ diff -urNp coreutils-8.22-orig/src/fs-is-local.h coreutils-8.22/src/fs-is-local. + case S_MAGIC_BTRFS_TEST: return 1; case S_MAGIC_CEPH: return 0; case S_MAGIC_CGROUP: return 1; ++ case S_MAGIC_CGROUP2: return 1; case S_MAGIC_CIFS: return 0; case S_MAGIC_CODA: return 0; case S_MAGIC_COH: return 1; + case S_MAGIC_CONFIGFS: return 1; case S_MAGIC_CRAMFS: return 1; case S_MAGIC_CRAMFS_WEND: return 1; ++ case S_MAGIC_DAXFS: return 1; case S_MAGIC_DEBUGFS: return 1; -@@ -43,10 +47,13 @@ is_local_fs_type (unsigned long int magi + case S_MAGIC_DEVFS: return 1; + case S_MAGIC_DEVPTS: return 1; + case S_MAGIC_ECRYPTFS: return 1; + case S_MAGIC_EFIVARFS: return 1; + case S_MAGIC_EFS: return 1; ++ case S_MAGIC_EXFS: return 1; + case S_MAGIC_EXOFS: return 1; + case S_MAGIC_EXT: return 1; + case S_MAGIC_EXT2: return 1; +@@ -43,10 +52,13 @@ is_local_fs_type (unsigned long int magic) case S_MAGIC_GFS: return 0; case S_MAGIC_GPFS: return 0; case S_MAGIC_HFS: return 1; @@ -40,7 +61,7 @@ diff -urNp coreutils-8.22-orig/src/fs-is-local.h coreutils-8.22/src/fs-is-local. case S_MAGIC_INOTIFYFS: return 1; case S_MAGIC_ISOFS: return 1; case S_MAGIC_ISOFS_R_WIN: return 1; -@@ -55,7 +62,9 @@ is_local_fs_type (unsigned long int magi +@@ -55,7 +67,9 @@ is_local_fs_type (unsigned long int magic) case S_MAGIC_JFFS2: return 1; case S_MAGIC_JFS: return 1; case S_MAGIC_KAFS: return 0; @@ -50,7 +71,7 @@ diff -urNp coreutils-8.22-orig/src/fs-is-local.h coreutils-8.22/src/fs-is-local. case S_MAGIC_MINIX: return 1; case S_MAGIC_MINIX_30: return 1; case S_MAGIC_MINIX_V2: return 1; -@@ -67,11 +75,14 @@ is_local_fs_type (unsigned long int magi +@@ -67,23 +81,29 @@ is_local_fs_type (unsigned long int magic) case S_MAGIC_NFS: return 0; case S_MAGIC_NFSD: return 0; case S_MAGIC_NILFS: return 1; @@ -65,7 +86,22 @@ diff -urNp coreutils-8.22-orig/src/fs-is-local.h coreutils-8.22/src/fs-is-local. case S_MAGIC_PROC: return 1; case S_MAGIC_PSTOREFS: return 1; case S_MAGIC_QNX4: return 1; -@@ -91,6 +101,7 @@ is_local_fs_type (unsigned long int magi + case S_MAGIC_QNX6: return 1; + case S_MAGIC_RAMFS: return 1; ++ case S_MAGIC_RDTGROUP: return 1; + case S_MAGIC_REISERFS: return 1; + case S_MAGIC_ROMFS: return 1; + case S_MAGIC_RPC_PIPEFS: return 1; ++ case S_MAGIC_SDCARDFS: return 1; + case S_MAGIC_SECURITYFS: return 1; + case S_MAGIC_SELINUX: return 1; + case S_MAGIC_SMACK: return 1; + case S_MAGIC_SMB: return 0; ++ case S_MAGIC_SMB2: return 0; + case S_MAGIC_SNFS: return 0; + case S_MAGIC_SOCKFS: return 1; + case S_MAGIC_SQUASHFS: return 1; +@@ -91,6 +111,7 @@ is_local_fs_type (unsigned long int magic) case S_MAGIC_SYSV2: return 1; case S_MAGIC_SYSV4: return 1; case S_MAGIC_TMPFS: return 1; @@ -73,10 +109,88 @@ diff -urNp coreutils-8.22-orig/src/fs-is-local.h coreutils-8.22/src/fs-is-local. case S_MAGIC_UBIFS: return 1; case S_MAGIC_UDF: return 1; case S_MAGIC_UFS: return 1; -diff -urNp coreutils-8.22-orig/src/stat.c coreutils-8.22/src/stat.c ---- coreutils-8.22-orig/src/stat.c 2013-12-13 15:12:46.000000000 +0100 -+++ coreutils-8.22/src/stat.c 2016-06-24 11:16:37.853990792 +0200 -@@ -311,13 +311,13 @@ human_fstype (STRUCT_STATVFS const *stat +@@ -100,11 +121,13 @@ is_local_fs_type (unsigned long int magic) + case S_MAGIC_VMHGFS: return 0; + case S_MAGIC_VXFS: return 0; + case S_MAGIC_VZFS: return 1; ++ case S_MAGIC_WSLFS: return 1; + case S_MAGIC_XENFS: return 1; + case S_MAGIC_XENIX: return 1; + case S_MAGIC_XFS: return 1; + case S_MAGIC_XIAFS: return 1; + case S_MAGIC_ZFS: return 1; ++ case S_MAGIC_ZSMALLOC: return 1; + default: return -1; + } + } +diff --git a/src/stat.c b/src/stat.c +index ba491f4..718b32a 100644 +--- a/src/stat.c ++++ b/src/stat.c +@@ -240,6 +240,10 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + a comment. The S_MAGIC_... name and constant are automatically + combined to produce the #define directives in fs.h. */ + ++ case S_MAGIC_AAFS: /* 0x5A3C69F0 local */ ++ return "aafs"; ++ case S_MAGIC_ACFS: /* 0x61636673 remote */ ++ return "acfs"; + case S_MAGIC_ADFS: /* 0xADF5 local */ + return "adfs"; + case S_MAGIC_AFFS: /* 0xADFF local */ +@@ -255,30 +259,42 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "aufs"; + case S_MAGIC_AUTOFS: /* 0x0187 local */ + return "autofs"; ++ case S_MAGIC_BALLOON_KVM: /* 0x13661366 local */ ++ return "balloon-kvm-fs"; + case S_MAGIC_BEFS: /* 0x42465331 local */ + return "befs"; + case S_MAGIC_BDEVFS: /* 0x62646576 local */ + return "bdevfs"; + case S_MAGIC_BFS: /* 0x1BADFACE local */ + return "bfs"; ++ case S_MAGIC_BPF_FS: /* 0xCAFE4A11 local */ ++ return "bpf_fs"; + case S_MAGIC_BINFMTFS: /* 0x42494E4D local */ + return "binfmt_misc"; + case S_MAGIC_BTRFS: /* 0x9123683E local */ + return "btrfs"; ++ case S_MAGIC_BTRFS_TEST: /* 0x73727279 local */ ++ return "btrfs_test"; + case S_MAGIC_CEPH: /* 0x00C36400 remote */ + return "ceph"; + case S_MAGIC_CGROUP: /* 0x0027E0EB local */ + return "cgroupfs"; ++ case S_MAGIC_CGROUP2: /* 0x63677270 local */ ++ return "cgroup2fs"; + case S_MAGIC_CIFS: /* 0xFF534D42 remote */ + return "cifs"; + case S_MAGIC_CODA: /* 0x73757245 remote */ + return "coda"; + case S_MAGIC_COH: /* 0x012FF7B7 local */ + return "coh"; ++ case S_MAGIC_CONFIGFS: /* 0x62656570 local */ ++ return "configfs"; + case S_MAGIC_CRAMFS: /* 0x28CD3D45 local */ + return "cramfs"; + case S_MAGIC_CRAMFS_WEND: /* 0x453DCD28 local */ + return "cramfs-wend"; ++ case S_MAGIC_DAXFS: /* 0x64646178 local */ ++ return "daxfs"; + case S_MAGIC_DEBUGFS: /* 0x64626720 local */ + return "debugfs"; + case S_MAGIC_DEVFS: /* 0x1373 local */ +@@ -291,6 +307,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "efivarfs"; + case S_MAGIC_EFS: /* 0x00414A53 local */ + return "efs"; ++ case S_MAGIC_EXFS: /* 0x45584653 local */ ++ return "exfs"; + case S_MAGIC_EXOFS: /* 0x5DF5 local */ + return "exofs"; + case S_MAGIC_EXT: /* 0x137D local */ +@@ -311,13 +329,17 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) return "fusectl"; case S_MAGIC_FUTEXFS: /* 0x0BAD1DEA local */ return "futexfs"; @@ -88,72 +202,134 @@ diff -urNp coreutils-8.22-orig/src/stat.c coreutils-8.22/src/stat.c case S_MAGIC_HFS: /* 0x4244 local */ return "hfs"; - case S_MAGIC_HOSTFS: /* 0xC0FFEE local */ ++ case S_MAGIC_HFS_PLUS: /* 0x482B local */ ++ return "hfs+"; ++ case S_MAGIC_HFS_X: /* 0x4858 local */ ++ return "hfsx"; + case S_MAGIC_HOSTFS: /* 0x00C0FFEE local */ return "hostfs"; case S_MAGIC_HPFS: /* 0xF995E849 local */ return "hpfs"; -@@ -369,7 +369,7 @@ human_fstype (STRUCT_STATVFS const *stat +@@ -325,6 +347,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "hugetlbfs"; + case S_MAGIC_MTD_INODE_FS: /* 0x11307854 local */ + return "inodefs"; ++ case S_MAGIC_IBRIX: /* 0x013111A8 remote */ ++ return "ibrix"; + case S_MAGIC_INOTIFYFS: /* 0x2BAD1DEA local */ + return "inotifyfs"; + case S_MAGIC_ISOFS: /* 0x9660 local */ +@@ -341,8 +365,12 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "jfs"; + case S_MAGIC_KAFS: /* 0x6B414653 remote */ + return "k-afs"; ++ case S_MAGIC_LOGFS: /* 0xC97E8168 local */ ++ return "logfs"; + case S_MAGIC_LUSTRE: /* 0x0BD00BD0 remote */ + return "lustre"; ++ case S_MAGIC_M1FS: /* 0x5346314D local */ ++ return "m1fs"; + case S_MAGIC_MINIX: /* 0x137F local */ + return "minix"; + case S_MAGIC_MINIX_30: /* 0x138F local */ +@@ -365,19 +393,28 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "nfsd"; + case S_MAGIC_NILFS: /* 0x3434 local */ + return "nilfs"; ++ case S_MAGIC_NSFS: /* 0x6E736673 local */ ++ return "nsfs"; + case S_MAGIC_NTFS: /* 0x5346544E local */ return "ntfs"; case S_MAGIC_OPENPROM: /* 0x9FA1 local */ return "openprom"; - case S_MAGIC_OCFS2: /* 0x7461636f remote */ + case S_MAGIC_OCFS2: /* 0x7461636F remote */ return "ocfs2"; ++ case S_MAGIC_OVERLAYFS: /* 0x794C7630 remote */ ++ /* This may overlay remote file systems. ++ Also there have been issues reported with inotify and overlayfs, ++ so mark as "remote" so that polling is used. */ ++ return "overlayfs"; case S_MAGIC_PANFS: /* 0xAAD7AAEA remote */ return "panfs"; -@@ -430,7 +430,9 @@ human_fstype (STRUCT_STATVFS const *stat + case S_MAGIC_PIPEFS: /* 0x50495045 remote */ + /* FIXME: change syntax or add an optional attribute like "inotify:no". +- The above is labeled as "remote" so that tail always uses polling, +- but this isn't really a remote file system type. */ ++ pipefs and prlfs are labeled as "remote" so that tail always polls, ++ but these aren't really remote file system types. */ + return "pipefs"; ++ case S_MAGIC_PRL_FS: /* 0x7C7C6673 remote */ ++ return "prl_fs"; + case S_MAGIC_PROC: /* 0x9FA0 local */ + return "proc"; + case S_MAGIC_PSTOREFS: /* 0x6165676C local */ +@@ -388,12 +425,16 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "qnx6"; + case S_MAGIC_RAMFS: /* 0x858458F6 local */ + return "ramfs"; ++ case S_MAGIC_RDTGROUP: /* 0x07655821 local */ ++ return "rdt"; + case S_MAGIC_REISERFS: /* 0x52654973 local */ + return "reiserfs"; + case S_MAGIC_ROMFS: /* 0x7275 local */ + return "romfs"; + case S_MAGIC_RPC_PIPEFS: /* 0x67596969 local */ + return "rpc_pipefs"; ++ case S_MAGIC_SDCARDFS: /* 0x5DCA2DF5 local */ ++ return "sdcardfs"; + case S_MAGIC_SECURITYFS: /* 0x73636673 local */ + return "securityfs"; + case S_MAGIC_SELINUX: /* 0xF97CFF8C local */ +@@ -402,6 +443,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "smackfs"; + case S_MAGIC_SMB: /* 0x517B remote */ + return "smb"; ++ case S_MAGIC_SMB2: /* 0xFE534D42 remote */ ++ return "smb2"; + case S_MAGIC_SNFS: /* 0xBEEFDEAD remote */ + return "snfs"; + case S_MAGIC_SOCKFS: /* 0x534F434B local */ +@@ -416,6 +459,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) + return "sysv4"; + case S_MAGIC_TMPFS: /* 0x01021994 local */ + return "tmpfs"; ++ case S_MAGIC_TRACEFS: /* 0x74726163 local */ ++ return "tracefs"; + case S_MAGIC_UBIFS: /* 0x24051905 local */ + return "ubifs"; + case S_MAGIC_UDF: /* 0x15013346 local */ +@@ -430,10 +475,14 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) return "v9fs"; case S_MAGIC_VMHGFS: /* 0xBACBACBC remote */ return "vmhgfs"; - case S_MAGIC_VXFS: /* 0xA501FCF5 local */ + case S_MAGIC_VXFS: /* 0xA501FCF5 remote */ -+ /* Veritas File System can run in single instance or clustered mode, -+ so mark as remote to cater for the latter case. */ ++ /* Veritas File System can run in single instance or clustered mode, ++ so mark as remote to cater for the latter case. */ return "vxfs"; case S_MAGIC_VZFS: /* 0x565A4653 local */ return "vzfs"; -@@ -444,6 +446,37 @@ human_fstype (STRUCT_STATVFS const *stat ++ case S_MAGIC_WSLFS: /* 0x53464846 local */ ++ return "wslfs"; + case S_MAGIC_XENFS: /* 0xABBA1974 local */ + return "xenfs"; + case S_MAGIC_XENIX: /* 0x012FF7B4 local */ +@@ -444,6 +493,9 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) return "xia"; case S_MAGIC_ZFS: /* 0x2FC12FC1 local */ return "zfs"; -+/* Refresh from coreutils-8.25 bellow */ -+ case S_MAGIC_ACFS: /* 0x61636673 remote */ -+ return "acfs"; -+ case S_MAGIC_BPF_FS: /* 0xCAFE4A11 local */ -+ return "bpf_fs"; -+ case S_MAGIC_BTRFS_TEST: /* 0x73727279 local */ -+ return "btrfs_test"; -+ case S_MAGIC_CONFIGFS: /* 0x62656570 local */ -+ return "configfs"; -+ case S_MAGIC_HFS_PLUS: /* 0x482B local */ -+ return "hfs+"; -+ case S_MAGIC_HFS_X: /* 0x4858 local */ -+ return "hfsx"; -+ case S_MAGIC_IBRIX: /* 0x013111A8 remote */ -+ return "ibrix"; -+ case S_MAGIC_LOGFS: /* 0xC97E8168 local */ -+ return "logfs"; -+ case S_MAGIC_M1FS: /* 0x5346314D local */ -+ return "m1fs"; -+ case S_MAGIC_NSFS: /* 0x6E736673 local */ -+ return "nsfs"; -+ case S_MAGIC_OVERLAYFS: /* 0x794C7630 remote */ -+ /* This may overlay remote file systems. -+ Also there have been issues reported with inotify and overlayfs, -+ so mark as "remote" so that polling is used. */ -+ return "overlayfs"; -+ case S_MAGIC_PRL_FS: /* 0x7C7C6673 remote */ -+ return "prl_fs"; -+ case S_MAGIC_TRACEFS: /* 0x74726163 local */ -+ return "tracefs"; ++ case S_MAGIC_ZSMALLOC: /* 0x58295829 local */ ++ return "zsmallocfs"; + # elif __GNU__ case FSTYPE_UFS: -diff -urNp coreutils-8.22-orig/src/tail.c coreutils-8.22/src/tail.c ---- coreutils-8.22-orig/src/tail.c 2013-12-09 14:40:46.000000000 +0100 -+++ coreutils-8.22/src/tail.c 2016-06-24 11:03:10.268044584 +0200 -@@ -898,13 +898,15 @@ fremote (int fd, const char *name) +diff --git a/src/tail.c b/src/tail.c +index dc4e10d..f4575d8 100644 +--- a/src/tail.c ++++ b/src/tail.c +@@ -898,6 +898,7 @@ fremote (int fd, const char *name) case 0: break; case -1: @@ -161,7 +337,7 @@ diff -urNp coreutils-8.22-orig/src/tail.c coreutils-8.22/src/tail.c { unsigned long int fs_type = buf.f_type; error (0, 0, _("unrecognized file system type 0x%08lx for %s. " - "please report this to %s. reverting to polling"), +@@ -905,6 +906,7 @@ fremote (int fd, const char *name) fs_type, quote (name), PACKAGE_BUGREPORT); /* Treat as "remote", so caller polls. */ } diff --git a/SPECS/coreutils.spec b/SPECS/coreutils.spec index 5e9534d..2573878 100644 --- a/SPECS/coreutils.spec +++ b/SPECS/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.22 -Release: 23%{?dist} +Release: 24%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -52,6 +52,18 @@ Patch17: coreutils-8.22-df-stat.patch # http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.29-9-g29baf25aa Patch18: coreutils-8.22-mv-n-noreplace.patch +# df: prioritize mounts nearer the device root (#1042840) +Patch19: coreutils-8.22-df-bind-mount.patch + +# df: avoid stat() for dummy file systems with -l (#1668137) +Patch20: coreutils-8.22-df-dummy-local.patch + +# doc: fix typo in date example (#1620624) +Patch21: coreutils-8.22-date-example-typo.patch + +# doc: improve description of the --kibibytes option of ls (#1527391) +Patch22: coreutils-8.22-doc-ls-kibibytes.patch + # Our patches #general patch to workaround koji build system issues Patch100: coreutils-6.10-configuration.patch @@ -233,6 +245,12 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch18 -p1 %patch802 -p1 +# patches added in RHEL-7.7 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 + chmod a+x tests/misc/sort-mb-tests.sh tests/df/direct.sh tests/cp/no-ctx.sh tests/dd/stats.sh || : #fix typos/mistakes in localized documentation(#439410, #440056) @@ -455,6 +473,13 @@ fi %{_sbindir}/chroot %changelog +* Fri Mar 15 2019 Kamil Dudka - 8.22-24 +- doc: improve description of the --kibibytes option of ls (#1527391) +- doc: fix typo in date example (#1620624) +- stat,tail: sync the list of file systems with coreutils-8.31 (#1659530) +- df: avoid stat() for dummy file systems with -l (#1668137) +- df: prioritize mounts nearer the device root (#1042840) + * Fri Jun 15 2018 Kamil Dudka - 8.22-23 - update description of the -a/--all option in df.1 man page (#1553212) - sort -M: fix memory leak when using multibyte locale (#1540059)