Resolves: #2059542 - make `df --direct` work again

This commit is contained in:
Kamil Dudka 2022-03-01 10:25:55 +01:00
parent 6f2d57f40f
commit e7b9f0f725
2 changed files with 30 additions and 14 deletions

View File

@ -1,8 +1,20 @@
From 6e36198f10a2f63b89c89ebb5d5c185b20fb3a63 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 29 Mar 2010 17:20:34 +0000
Subject: [PATCH] coreutils-df-direct.patch
---
doc/coreutils.texi | 7 ++++++
src/df.c | 34 ++++++++++++++++++++++++++--
tests/df/direct.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 2 deletions(-)
create mode 100755 tests/df/direct.sh
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index a507280..400e135 100644
index 5b9a597..6810c15 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -11303,6 +11303,13 @@ some systems (notably SunOS), doing this yields more up to date results,
@@ -11898,6 +11898,13 @@ some systems (notably SunOS), doing this yields more up to date results,
but in general this option makes @command{df} much slower, especially when
there are many or very busy file systems.
@ -17,10 +29,10 @@ index a507280..400e135 100644
@opindex --total
@cindex grand total of disk size, usage and available space
diff --git a/src/df.c b/src/df.c
index 8f760db..a7385fd 100644
index 48025b9..c8efa5b 100644
--- a/src/df.c
+++ b/src/df.c
@@ -120,6 +120,9 @@ static bool print_type;
@@ -125,6 +125,9 @@ static bool print_type;
/* If true, print a grand total at the end. */
static bool print_grand_total;
@ -30,7 +42,7 @@ index 8f760db..a7385fd 100644
/* Grand total data. */
static struct fs_usage grand_fsu;
@@ -247,13 +250,15 @@ enum
@@ -252,13 +255,15 @@ enum
NO_SYNC_OPTION = CHAR_MAX + 1,
SYNC_OPTION,
TOTAL_OPTION,
@ -47,7 +59,7 @@ index 8f760db..a7385fd 100644
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
@@ -509,7 +514,10 @@ get_header (void)
@@ -561,7 +566,10 @@ get_header (void)
for (col = 0; col < ncolumns; col++)
{
char *cell = NULL;
@ -59,7 +71,7 @@ index 8f760db..a7385fd 100644
if (columns[col]->field == SIZE_FIELD
&& (header_mode == DEFAULT_MODE
@@ -1397,6 +1405,19 @@ get_point (const char *point, const struct stat *statp)
@@ -1464,6 +1472,17 @@ get_point (const char *point, const struct stat *statp)
static void
get_entry (char const *name, struct stat const *statp)
{
@ -68,9 +80,7 @@ index 8f760db..a7385fd 100644
+ char *resolved = canonicalize_file_name (name);
+ if (resolved)
+ {
+ char *mp = find_mount_point (name, statp);
+ get_dev (NULL, mp, resolved, NULL, NULL, false, false, NULL, false);
+ free(mp);
+ get_dev (NULL, resolved, name, NULL, NULL, false, false, NULL, false);
+ free (resolved);
+ return;
+ }
@ -79,7 +89,7 @@ index 8f760db..a7385fd 100644
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
&& get_disk (name))
return;
@@ -1467,6 +1488,7 @@ or all file systems by default.\n\
@@ -1534,6 +1553,7 @@ or all file systems by default.\n\
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
'-BM' prints sizes in units of 1,048,576 bytes;\n\
see SIZE format below\n\
@ -87,7 +97,7 @@ index 8f760db..a7385fd 100644
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
"), stdout);
@@ -1557,6 +1579,9 @@ main (int argc, char **argv)
@@ -1624,6 +1644,9 @@ main (int argc, char **argv)
xstrtol_fatal (e, oi, c, long_options, optarg);
}
break;
@ -97,7 +107,7 @@ index 8f760db..a7385fd 100644
case 'i':
if (header_mode == OUTPUT_MODE)
{
@@ -1653,6 +1678,13 @@ main (int argc, char **argv)
@@ -1720,6 +1743,13 @@ main (int argc, char **argv)
}
}
@ -172,3 +182,6 @@ index 0000000..8e4cfb8
+compare file_out file_exp || fail=1
+
+Exit $fail
--
2.31.1

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.32
Release: 31%{?dist}
Release: 32%{?dist}
License: GPLv3+
Url: https://www.gnu.org/software/coreutils/
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
@ -320,6 +320,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%license COPYING
%changelog
* Tue Mar 01 2022 Kamil Dudka <kdudka@redhat.com> - 8.32-32
- make `df --direct` work again (#2058686)
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688