Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Kamil Dudka | 0a82158b71 | |
Kamil Dudka | 964f7a01a5 | |
Kamil Dudka | a2b6f809ab | |
Kamil Dudka | 91a6a7d065 | |
Kamil Dudka | e3fe7ff6cc | |
Kamil Dudka | 43fd3f3390 | |
Kamil Dudka | 6b81b6dfa7 | |
Kamil Dudka | 0c463b6364 | |
Kamil Dudka | 0872cc71cc | |
Kamil Dudka | 5985282d05 | |
Kamil Dudka | 226a4e673f |
|
@ -1,7 +1,7 @@
|
|||
From 5f2dac18054d9d9b3d84e7fba8c2a6e750d2c245 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Wed, 1 Apr 2020 12:51:34 +0100
|
||||
Subject: [PATCH 1/6] cp: ensure --attributes-only doesn't remove files
|
||||
Subject: [PATCH 01/12] cp: ensure --attributes-only doesn't remove files
|
||||
|
||||
* src/copy.c (copy_internal): Ensure we don't unlink the destination
|
||||
unless explicitly requested.
|
||||
|
@ -77,7 +77,7 @@ index 59ce641..14fc844 100755
|
|||
From c728747b06e71894c96d1f27434f2484af992c75 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Tue, 23 Jun 2020 19:18:04 -0700
|
||||
Subject: [PATCH 2/6] cp: refactor extent_copy
|
||||
Subject: [PATCH 02/12] cp: refactor extent_copy
|
||||
|
||||
* src/copy.c (extent_copy): New arg SCAN, replacing
|
||||
REQUIRE_NORMAL_COPY. All callers changed.
|
||||
|
@ -320,7 +320,7 @@ index 54601ce..f694f91 100644
|
|||
From ed7ff81de507bef46991f4caac550f41ab65e3ed Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Wed, 24 Jun 2020 17:05:20 -0700
|
||||
Subject: [PATCH 3/6] cp: avoid copy_reg goto
|
||||
Subject: [PATCH 03/12] cp: avoid copy_reg goto
|
||||
|
||||
* src/copy.c (copy_reg): Redo to avoid label and goto.
|
||||
|
||||
|
@ -390,7 +390,7 @@ index f694f91..b382cfa 100644
|
|||
From 5631bded3a385ca0bbd77456b50767fe5580240c Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Thu, 25 Jun 2020 16:31:44 -0700
|
||||
Subject: [PATCH 4/6] cp: use SEEK_DATA/SEEK_HOLE if available
|
||||
Subject: [PATCH 04/12] cp: use SEEK_DATA/SEEK_HOLE if available
|
||||
|
||||
If it works, prefer lseek with SEEK_DATA and SEEK_HOLE to FIEMAP,
|
||||
as lseek is simpler and more portable (will be in next POSIX).
|
||||
|
@ -701,7 +701,7 @@ index b382cfa..d88f8cf 100644
|
|||
From be7466be92d779cfbece418d4de33191ae52ab4a Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Wed, 24 Mar 2021 16:06:53 +0100
|
||||
Subject: [PATCH 5/6] import the copy-file-range module from gnulib
|
||||
Subject: [PATCH 05/12] import the copy-file-range module from gnulib
|
||||
|
||||
---
|
||||
aclocal.m4 | 1 +
|
||||
|
@ -718,7 +718,7 @@ diff --git a/aclocal.m4 b/aclocal.m4
|
|||
index 713f7c5..09a7ea8 100644
|
||||
--- a/aclocal.m4
|
||||
+++ b/aclocal.m4
|
||||
@@ -1163,6 +1163,7 @@ m4_include([m4/closedir.m4])
|
||||
@@ -1165,6 +1165,7 @@ m4_include([m4/closedir.m4])
|
||||
m4_include([m4/codeset.m4])
|
||||
m4_include([m4/config-h.m4])
|
||||
m4_include([m4/configmake.m4])
|
||||
|
@ -896,7 +896,7 @@ index dead90e..953e7f0 100644
|
|||
From 48370c95bcf7c25ce021fbd2145062d3d29ae6d5 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Thu, 25 Jun 2020 17:34:23 -0700
|
||||
Subject: [PATCH 6/6] cp: use copy_file_range if available
|
||||
Subject: [PATCH 06/12] cp: use copy_file_range if available
|
||||
|
||||
* NEWS: Mention this.
|
||||
* bootstrap.conf (gnulib_modules): Add copy-file-range.
|
||||
|
@ -976,3 +976,364 @@ index d88f8cf..4050f69 100644
|
|||
--
|
||||
2.26.3
|
||||
|
||||
|
||||
From 23ea1ba463d33e268f35847059e637a5935e4581 Mon Sep 17 00:00:00 2001
|
||||
From: Zorro Lang <zlang@redhat.com>
|
||||
Date: Mon, 26 Apr 2021 17:25:18 +0200
|
||||
Subject: [PATCH 07/12] copy: do not refuse to copy a swap file
|
||||
|
||||
* src/copy.c (sparse_copy): Fallback to read() if copy_file_range()
|
||||
fails with ETXTBSY. Otherwise it would be impossible to copy files
|
||||
that are being used as swap. This used to work before introducing
|
||||
the support for copy_file_range() in coreutils. (Bug#48036)
|
||||
|
||||
Upstream-commit: 785478013b416cde50794be35475c0c4fdbb48b4
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/copy.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index 4050f69..1798bb7 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -290,7 +290,7 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
if (n_copied < 0)
|
||||
{
|
||||
if (errno == ENOSYS || errno == EINVAL
|
||||
- || errno == EBADF || errno == EXDEV)
|
||||
+ || errno == EBADF || errno == EXDEV || errno == ETXTBSY)
|
||||
break;
|
||||
if (errno == EINTR)
|
||||
n_copied = 0;
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From cd7c7a6b5ad89ef0a61722552d532901fc1bed05 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Sun, 2 May 2021 21:27:17 +0100
|
||||
Subject: [PATCH 08/12] copy: ensure we enforce --reflink=never
|
||||
|
||||
* src/copy.c (sparse_copy): Don't use copy_file_range()
|
||||
with --reflink=never as copy_file_range() may implicitly
|
||||
use acceleration techniques like reflinking.
|
||||
(extent_copy): Pass through whether we allow reflinking.
|
||||
(lseek_copy): Likewise.
|
||||
Fixes https://bugs.gnu.org/48164
|
||||
|
||||
Upstream-commit: ea9af99234031ab8d5169c8a669434e2a6b4f864
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/copy.c | 20 +++++++++++++-------
|
||||
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index 4050f69..0337538 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -258,7 +258,7 @@ create_hole (int fd, char const *name, bool punch_holes, off_t size)
|
||||
bytes read. */
|
||||
static bool
|
||||
sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
- size_t hole_size, bool punch_holes,
|
||||
+ size_t hole_size, bool punch_holes, bool allow_reflink,
|
||||
char const *src_name, char const *dst_name,
|
||||
uintmax_t max_n_read, off_t *total_n_read,
|
||||
bool *last_write_made_hole)
|
||||
@@ -266,8 +266,9 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
*last_write_made_hole = false;
|
||||
*total_n_read = 0;
|
||||
|
||||
- /* If not looking for holes, use copy_file_range if available. */
|
||||
- if (!hole_size)
|
||||
+ /* If not looking for holes, use copy_file_range if available,
|
||||
+ but don't use if reflink disallowed as that may be implicit. */
|
||||
+ if ((! hole_size) && allow_reflink)
|
||||
while (max_n_read)
|
||||
{
|
||||
/* Copy at most COPY_MAX bytes at a time; this is min
|
||||
@@ -466,6 +467,7 @@ static bool
|
||||
extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
size_t hole_size, off_t src_total_size,
|
||||
enum Sparse_type sparse_mode,
|
||||
+ bool allow_reflink,
|
||||
char const *src_name, char const *dst_name,
|
||||
struct extent_scan *scan)
|
||||
{
|
||||
@@ -579,8 +581,8 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
|
||||
if ( ! sparse_copy (src_fd, dest_fd, buf, buf_size,
|
||||
sparse_mode == SPARSE_ALWAYS ? hole_size: 0,
|
||||
- true, src_name, dst_name, ext_len, &n_read,
|
||||
- &read_hole))
|
||||
+ true, allow_reflink, src_name, dst_name,
|
||||
+ ext_len, &n_read, &read_hole))
|
||||
goto fail;
|
||||
|
||||
dest_pos = ext_start + n_read;
|
||||
@@ -655,6 +657,7 @@ static bool
|
||||
lseek_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
size_t hole_size, off_t ext_start, off_t src_total_size,
|
||||
enum Sparse_type sparse_mode,
|
||||
+ bool allow_reflink,
|
||||
char const *src_name, char const *dst_name)
|
||||
{
|
||||
off_t last_ext_start = 0;
|
||||
@@ -729,8 +732,8 @@ lseek_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
bool read_hole;
|
||||
if ( ! sparse_copy (src_fd, dest_fd, buf, buf_size,
|
||||
sparse_mode == SPARSE_NEVER ? 0 : hole_size,
|
||||
- true, src_name, dst_name, ext_len, &n_read,
|
||||
- &read_hole))
|
||||
+ true, allow_reflink, src_name, dst_name,
|
||||
+ ext_len, &n_read, &read_hole))
|
||||
return false;
|
||||
|
||||
dest_pos = ext_start + n_read;
|
||||
@@ -1527,17 +1530,20 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
? extent_copy (source_desc, dest_desc, buf, buf_size, hole_size,
|
||||
src_open_sb.st_size,
|
||||
make_holes ? x->sparse_mode : SPARSE_NEVER,
|
||||
+ x->reflink_mode != REFLINK_NEVER,
|
||||
src_name, dst_name, &scan_inference.extent_scan)
|
||||
#ifdef SEEK_HOLE
|
||||
: scantype == LSEEK_SCANTYPE
|
||||
? lseek_copy (source_desc, dest_desc, buf, buf_size, hole_size,
|
||||
scan_inference.ext_start, src_open_sb.st_size,
|
||||
make_holes ? x->sparse_mode : SPARSE_NEVER,
|
||||
+ x->reflink_mode != REFLINK_NEVER,
|
||||
src_name, dst_name)
|
||||
#endif
|
||||
: sparse_copy (source_desc, dest_desc, buf, buf_size,
|
||||
make_holes ? hole_size : 0,
|
||||
x->sparse_mode == SPARSE_ALWAYS,
|
||||
+ x->reflink_mode != REFLINK_NEVER,
|
||||
src_name, dst_name, UINTMAX_MAX, &n_read,
|
||||
&wrote_hole_at_eof)))
|
||||
{
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
||||
From 7978f1de88dcdb17b67db9268038930e9c71154f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Sat, 8 May 2021 17:18:54 +0100
|
||||
Subject: [PATCH 09/12] copy: handle ENOTSUP from copy_file_range()
|
||||
|
||||
* src/copy.c (sparse_copy): Ensure we fall back to
|
||||
a standard copy if copy_file_range() returns ENOTSUP.
|
||||
This generally is best checked when checking ENOSYS,
|
||||
but it also seems to be a practical concern on Centos 7,
|
||||
as a quick search gave https://bugzilla.redhat.com/1840284
|
||||
|
||||
Upstream-commit: 8ec0d1799e19a079b8a661c6bb69f6c58e52f1aa
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/copy.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index 9977193..e3977cd 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -290,8 +290,9 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
}
|
||||
if (n_copied < 0)
|
||||
{
|
||||
- if (errno == ENOSYS || errno == EINVAL
|
||||
- || errno == EBADF || errno == EXDEV || errno == ETXTBSY)
|
||||
+ if (errno == ENOSYS || is_ENOTSUP (errno)
|
||||
+ || errno == EINVAL || errno == EBADF
|
||||
+ || errno == EXDEV || errno == ETXTBSY)
|
||||
break;
|
||||
if (errno == EINTR)
|
||||
n_copied = 0;
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From d8d3edbfc13ff13c185f23436209b788f906aa41 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Sun, 9 May 2021 21:55:22 +0100
|
||||
Subject: [PATCH 10/12] copy: handle EOPNOTSUPP from SEEK_DATA
|
||||
|
||||
* src/copy.c (infer_scantype): Ensure we don't error out
|
||||
if SEEK_DATA returns EOPNOTSUPP, on systems where this value
|
||||
is distinct from ENOTSUP. Generally both of these should be checked.
|
||||
|
||||
Upstream-commit: 017877bd088284d515753d78b81ca6e6a88c1350
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/copy.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index e3977cd..de8030d 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -1246,7 +1246,7 @@ infer_scantype (int fd, struct stat const *sb,
|
||||
scan_inference->ext_start = lseek (fd, 0, SEEK_DATA);
|
||||
if (0 <= scan_inference->ext_start)
|
||||
return LSEEK_SCANTYPE;
|
||||
- else if (errno != EINVAL && errno != ENOTSUP)
|
||||
+ else if (errno != EINVAL && !is_ENOTSUP (errno))
|
||||
return errno == ENXIO ? LSEEK_SCANTYPE : ERROR_SCANTYPE;
|
||||
#endif
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 1daf8c0fc9a5766c22b7ea84bea8c88c86a0c495 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Sat, 8 May 2021 19:23:20 +0100
|
||||
Subject: [PATCH 11/12] copy: handle system security config issues with
|
||||
copy_file_range()
|
||||
|
||||
* src/copy.c (sparse_copy): Upon EPERM from copy_file_range(),
|
||||
fall back to a standard copy, which will give a more accurate
|
||||
error as to whether the issue is with the source or destination.
|
||||
Also this will avoid the issue where seccomp or apparmor are
|
||||
not configured to handle copy_file_range(), in which case
|
||||
the fall back standard copy would succeed without issue.
|
||||
This specific issue with seccomp was noticed for example in:
|
||||
https://github.com/golang/go/issues/40900
|
||||
|
||||
Upstream-commit: 2e66e1732fced7af20fa76c60e636d39a1767d48
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/copy.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index de8030d..62eec7b 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -294,6 +294,15 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
|| errno == EINVAL || errno == EBADF
|
||||
|| errno == EXDEV || errno == ETXTBSY)
|
||||
break;
|
||||
+
|
||||
+ /* copy_file_range might not be enabled in seccomp filters,
|
||||
+ so retry with a standard copy. EPERM can also occur
|
||||
+ for immutable files, but that would only be in the edge case
|
||||
+ where the file is made immutable after creating/truncating,
|
||||
+ in which case the (more accurate) error is still shown. */
|
||||
+ if (errno == EPERM && *total_n_read == 0)
|
||||
+ break;
|
||||
+
|
||||
if (errno == EINTR)
|
||||
n_copied = 0;
|
||||
else
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From 42c9e598f61ba6bc27a615e39e40023a676a523b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Wed, 12 May 2021 23:47:38 +0100
|
||||
Subject: [PATCH 12/12] copy: disallow copy_file_range() on Linux kernels
|
||||
before 5.3
|
||||
|
||||
copy_file_range() before Linux kernel release 5.3 had many issues,
|
||||
as described at https://lwn.net/Articles/789527/, which was
|
||||
referenced from https://lwn.net/Articles/846403/; a more general
|
||||
article discussing the generality of copy_file_range().
|
||||
Linux kernel 5.3 was released in September 2019, which is new enough
|
||||
that we need to actively avoid older kernels.
|
||||
|
||||
* src/copy.c (functional_copy_file_range): A new function
|
||||
that returns false for Linux kernels before version 5.3.
|
||||
(sparse_copy): Call this new function to gate use of
|
||||
copy_file_range().
|
||||
|
||||
Upstream-commit: ba5e6885d2c255648cddb87b4e795659c1990374
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/copy.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 45 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/copy.c b/src/copy.c
|
||||
index 62eec7b..2e1699b 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <assert.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/utsname.h>
|
||||
#include <selinux/selinux.h>
|
||||
|
||||
#if HAVE_HURD_H
|
||||
@@ -64,6 +65,7 @@
|
||||
#include "write-any-file.h"
|
||||
#include "areadlink.h"
|
||||
#include "yesno.h"
|
||||
+#include "xstrtol.h"
|
||||
#include "selinux.h"
|
||||
|
||||
#if USE_XATTR
|
||||
@@ -244,6 +246,47 @@ create_hole (int fd, char const *name, bool punch_holes, off_t size)
|
||||
return true;
|
||||
}
|
||||
|
||||
+/* copy_file_range() before Linux kernel release 5.3 had many issues,
|
||||
+ as described at https://lwn.net/Articles/789527/,
|
||||
+ so return FALSE for Linux kernels earlier than that.
|
||||
+ This function can be removed when such kernels (released before Sep 2019)
|
||||
+ are no longer a consideration. */
|
||||
+
|
||||
+static bool
|
||||
+functional_copy_file_range (void)
|
||||
+{
|
||||
+#ifdef __linux__
|
||||
+ static int version_allowed = -1;
|
||||
+
|
||||
+ if (version_allowed == -1)
|
||||
+ version_allowed = 0;
|
||||
+ else
|
||||
+ return version_allowed;
|
||||
+
|
||||
+ struct utsname name;
|
||||
+ if (uname (&name) == -1)
|
||||
+ return version_allowed;
|
||||
+
|
||||
+ char *p = name.release;
|
||||
+ uintmax_t ver[2] = {0, 0};
|
||||
+ size_t iver = 0;
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ strtol_error err = xstrtoumax (p, &p, 10, &ver[iver], NULL);
|
||||
+ if (err != LONGINT_OK || *p++ != '.')
|
||||
+ break;
|
||||
+ }
|
||||
+ while (++iver < ARRAY_CARDINALITY (ver));
|
||||
+
|
||||
+ version_allowed = (ver[0] > 5 || (ver[0] == 5 && ver[1] >= 3));
|
||||
+
|
||||
+ return version_allowed;
|
||||
+#else
|
||||
+ return true;
|
||||
+#endif
|
||||
+
|
||||
+}
|
||||
|
||||
/* Copy the regular file open on SRC_FD/SRC_NAME to DST_FD/DST_NAME,
|
||||
honoring the MAKE_HOLES setting and using the BUF_SIZE-byte buffer
|
||||
@@ -266,9 +309,9 @@ sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
|
||||
*last_write_made_hole = false;
|
||||
*total_n_read = 0;
|
||||
|
||||
- /* If not looking for holes, use copy_file_range if available,
|
||||
+ /* If not looking for holes, use copy_file_range if functional,
|
||||
but don't use if reflink disallowed as that may be implicit. */
|
||||
- if ((! hole_size) && allow_reflink)
|
||||
+ if ((! hole_size) && allow_reflink && functional_copy_file_range ())
|
||||
while (max_n_read)
|
||||
{
|
||||
/* Copy at most COPY_MAX bytes at a time; this is min
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
From 0f053de4bc3ca0cfd88a42d236881dfdddb10ee9 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Wed, 30 Jun 2021 17:53:22 +0200
|
||||
Subject: [PATCH] df: fix duplicated remote entries due to bind mounts
|
||||
|
||||
As originally reported in <https://bugzilla.redhat.com/1962515>,
|
||||
df invoked without -a printed duplicated entries for NFS mounts
|
||||
of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99,
|
||||
which introduced the use of a hash table.
|
||||
|
||||
The proposed patch makes sure that the devlist entry seen the last time
|
||||
is used for comparison when eliminating duplicated mount entries. This
|
||||
way it worked before introducing the hash table.
|
||||
|
||||
Patch co-authored by Roberto Bergantinos.
|
||||
|
||||
* src/ls.c (struct devlist): Introduce the seen_last pointer.
|
||||
(devlist_for_dev): Return the devlist entry seen the last time if found.
|
||||
(filter_mount_list): Remember the devlist entry seen the last time for
|
||||
each hashed item.
|
||||
Fixes https://bugs.gnu.org/49298
|
||||
|
||||
Upstream-commit: d6125af095c9553f38cba0696f15158f5abe4ecc
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/df.c | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/df.c b/src/df.c
|
||||
index 7e01839..3e9247f 100644
|
||||
--- a/src/df.c
|
||||
+++ b/src/df.c
|
||||
@@ -54,6 +54,7 @@ struct devlist
|
||||
dev_t dev_num;
|
||||
struct mount_entry *me;
|
||||
struct devlist *next;
|
||||
+ struct devlist *seen_last; /* valid for hashed devlist entries only */
|
||||
};
|
||||
|
||||
/* Filled with device numbers of examined file systems to avoid
|
||||
@@ -689,7 +690,13 @@ devlist_for_dev (dev_t dev)
|
||||
return NULL;
|
||||
struct devlist dev_entry;
|
||||
dev_entry.dev_num = dev;
|
||||
- return hash_lookup (devlist_table, &dev_entry);
|
||||
+
|
||||
+ struct devlist *found = hash_lookup (devlist_table, &dev_entry);
|
||||
+ if (found == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* Return the last devlist entry we have seen with this dev_num */
|
||||
+ return found->seen_last;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -807,8 +814,12 @@ filter_mount_list (bool devices_only)
|
||||
devlist->dev_num = buf.st_dev;
|
||||
devlist->next = device_list;
|
||||
device_list = devlist;
|
||||
- if (hash_insert (devlist_table, devlist) == NULL)
|
||||
+
|
||||
+ struct devlist *hash_entry = hash_insert (devlist_table, devlist);
|
||||
+ if (hash_entry == NULL)
|
||||
xalloc_die ();
|
||||
+ /* Ensure lookups use this latest devlist. */
|
||||
+ hash_entry->seen_last = devlist;
|
||||
|
||||
me = me->me_next;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 602fb566468d3837b7871c17a0fab1a20228d119 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 7 Jun 2021 14:43:03 +0200
|
||||
Subject: [PATCH] mountlist: recognize fuse.portal as dummy file system
|
||||
|
||||
This was originally proposed at:
|
||||
|
||||
https://lists.gnu.org/archive/html/bug-gnulib/2021-02/msg00053.html
|
||||
|
||||
As the full review might take some time, would it be possible to apply
|
||||
at least the part related to fuse.portal file systems? They started to
|
||||
cause problems recently:
|
||||
|
||||
https://bugs.launchpad.net/ubuntu/+source/xdg-desktop-portal/+bug/1905623
|
||||
https://github.com/muesli/duf/issues/35
|
||||
https://bugzilla.redhat.com/1913358
|
||||
|
||||
Upstream-commit: 9a38d499ca16f2f4304992eb1ab0894cd0b478e1
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
lib/mountlist.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/mountlist.c b/lib/mountlist.c
|
||||
index e0227b7..e5f6b07 100644
|
||||
--- a/lib/mountlist.c
|
||||
+++ b/lib/mountlist.c
|
||||
@@ -170,6 +170,7 @@
|
||||
|| strcmp (Fs_type, "debugfs") == 0 \
|
||||
|| strcmp (Fs_type, "devpts") == 0 \
|
||||
|| strcmp (Fs_type, "fusectl") == 0 \
|
||||
+ || strcmp (Fs_type, "fuse.portal") == 0 \
|
||||
|| strcmp (Fs_type, "mqueue") == 0 \
|
||||
|| strcmp (Fs_type, "rpc_pipefs") == 0 \
|
||||
|| strcmp (Fs_type, "sysfs") == 0 \
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
From c7a04cef4075da864a3468e63a5bb79334d8f556 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Sat, 26 Jun 2021 18:23:52 -0700
|
||||
Subject: [PATCH] tail: use poll, not select
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes an unlikely stack out-of-bounds write reported by
|
||||
Stepan Broz via Kamil Dudka (Bug#49209).
|
||||
* src/tail.c: Do not include <sys/select.h>.
|
||||
[!_AIX]: Include poll.h.
|
||||
(check_output_alive) [!_AIX]: Use poll instead of select.
|
||||
(tail_forever_inotify): Likewise. Simplify logic, as there is no
|
||||
need for a ‘while (len <= evbuf_off)’ loop.
|
||||
|
||||
Upstream-commit: da0d448bca62c6305fc432f67e2c5ccc2da75346
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/tail.c | 100 +++++++++++++++++++++--------------------------------
|
||||
1 file changed, 39 insertions(+), 61 deletions(-)
|
||||
|
||||
diff --git a/src/tail.c b/src/tail.c
|
||||
index 1c88723..5b4f21a 100644
|
||||
--- a/src/tail.c
|
||||
+++ b/src/tail.c
|
||||
@@ -28,12 +28,9 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/select.h>
|
||||
+#include <poll.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
-#ifdef _AIX
|
||||
-# include <poll.h>
|
||||
-#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "argmatch.h"
|
||||
@@ -351,27 +348,12 @@ check_output_alive (void)
|
||||
if (! monitor_output)
|
||||
return;
|
||||
|
||||
-#ifdef _AIX
|
||||
- /* select on AIX was seen to give a readable event immediately. */
|
||||
struct pollfd pfd;
|
||||
pfd.fd = STDOUT_FILENO;
|
||||
pfd.events = POLLERR;
|
||||
|
||||
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
|
||||
die_pipe ();
|
||||
-#else
|
||||
- struct timeval delay;
|
||||
- delay.tv_sec = delay.tv_usec = 0;
|
||||
-
|
||||
- fd_set rfd;
|
||||
- FD_ZERO (&rfd);
|
||||
- FD_SET (STDOUT_FILENO, &rfd);
|
||||
-
|
||||
- /* readable event on STDOUT is equivalent to POLLERR,
|
||||
- and implies an error condition on output like broken pipe. */
|
||||
- if (select (STDOUT_FILENO + 1, &rfd, NULL, NULL, &delay) == 1)
|
||||
- die_pipe ();
|
||||
-#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -1612,7 +1594,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
|
||||
/* Wait for inotify events and handle them. Events on directories
|
||||
ensure that watched files can be re-added when following by name.
|
||||
This loop blocks on the 'safe_read' call until a new event is notified.
|
||||
- But when --pid=P is specified, tail usually waits via the select. */
|
||||
+ But when --pid=P is specified, tail usually waits via poll. */
|
||||
while (1)
|
||||
{
|
||||
struct File_spec *fspec;
|
||||
@@ -1629,54 +1611,51 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
|
||||
return false;
|
||||
}
|
||||
|
||||
- /* When watching a PID, ensure that a read from WD will not block
|
||||
- indefinitely. */
|
||||
- while (len <= evbuf_off)
|
||||
+ if (len <= evbuf_off)
|
||||
{
|
||||
- struct timeval delay; /* how long to wait for file changes. */
|
||||
+ /* Poll for inotify events. When watching a PID, ensure
|
||||
+ that a read from WD will not block indefinitely.
|
||||
+ If MONITOR_OUTPUT, also poll for a broken output pipe. */
|
||||
|
||||
- if (pid)
|
||||
+ int file_change;
|
||||
+ struct pollfd pfd[2];
|
||||
+ do
|
||||
{
|
||||
- if (writer_is_dead)
|
||||
- exit (EXIT_SUCCESS);
|
||||
+ /* How many ms to wait for changes. -1 means wait forever. */
|
||||
+ int delay = -1;
|
||||
|
||||
- writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
|
||||
-
|
||||
- if (writer_is_dead)
|
||||
- delay.tv_sec = delay.tv_usec = 0;
|
||||
- else
|
||||
+ if (pid)
|
||||
{
|
||||
- delay.tv_sec = (time_t) sleep_interval;
|
||||
- delay.tv_usec = 1000000 * (sleep_interval - delay.tv_sec);
|
||||
+ if (writer_is_dead)
|
||||
+ exit (EXIT_SUCCESS);
|
||||
+
|
||||
+ writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
|
||||
+
|
||||
+ if (writer_is_dead || sleep_interval <= 0)
|
||||
+ delay = 0;
|
||||
+ else if (sleep_interval < INT_MAX / 1000 - 1)
|
||||
+ {
|
||||
+ /* delay = ceil (sleep_interval * 1000), sans libm. */
|
||||
+ double ddelay = sleep_interval * 1000;
|
||||
+ delay = ddelay;
|
||||
+ delay += delay < ddelay;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ pfd[0].fd = wd;
|
||||
+ pfd[0].events = POLLIN;
|
||||
+ pfd[1].fd = STDOUT_FILENO;
|
||||
+ pfd[1].events = pfd[1].revents = 0;
|
||||
+ file_change = poll (pfd, monitor_output + 1, delay);
|
||||
}
|
||||
+ while (file_change == 0);
|
||||
|
||||
- fd_set rfd;
|
||||
- FD_ZERO (&rfd);
|
||||
- FD_SET (wd, &rfd);
|
||||
- if (monitor_output)
|
||||
- FD_SET (STDOUT_FILENO, &rfd);
|
||||
-
|
||||
- int file_change = select (MAX (wd, STDOUT_FILENO) + 1,
|
||||
- &rfd, NULL, NULL, pid ? &delay: NULL);
|
||||
-
|
||||
- if (file_change == 0)
|
||||
- continue;
|
||||
- else if (file_change == -1)
|
||||
- die (EXIT_FAILURE, errno,
|
||||
- _("error waiting for inotify and output events"));
|
||||
- else if (FD_ISSET (STDOUT_FILENO, &rfd))
|
||||
- {
|
||||
- /* readable event on STDOUT is equivalent to POLLERR,
|
||||
- and implies an error on output like broken pipe. */
|
||||
- die_pipe ();
|
||||
- }
|
||||
- else
|
||||
- break;
|
||||
- }
|
||||
+ if (file_change < 0)
|
||||
+ die (EXIT_FAILURE, errno,
|
||||
+ _("error waiting for inotify and output events"));
|
||||
+ if (pfd[1].revents)
|
||||
+ die_pipe ();
|
||||
|
||||
- if (len <= evbuf_off)
|
||||
- {
|
||||
len = safe_read (wd, evbuf, evlen);
|
||||
evbuf_off = 0;
|
||||
|
||||
@@ -2437,8 +2416,7 @@ main (int argc, char **argv)
|
||||
if (forever && ignore_fifo_and_pipe (F, n_files))
|
||||
{
|
||||
/* If stdout is a fifo or pipe, then monitor it
|
||||
- so that we exit if the reader goes away.
|
||||
- Note select() on a regular file is always readable. */
|
||||
+ so that we exit if the reader goes away. */
|
||||
struct stat out_stat;
|
||||
if (fstat (STDOUT_FILENO, &out_stat) < 0)
|
||||
die (EXIT_FAILURE, errno, _("standard output"));
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
From fc6318841f008dadc1e7c93e539f10d24aa83e90 Mon Sep 17 00:00:00 2001
|
||||
From: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||
Date: Wed, 21 Apr 2021 00:12:00 +0200
|
||||
Subject: [PATCH 1/2] tests: fix FP in ls/stat-free-color.sh
|
||||
|
||||
On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls
|
||||
newfstatat(STDOUT_FILENO, ...), but only when there is something to
|
||||
output.
|
||||
|
||||
* tests/ls/stat-free-color.sh: Add -a option to the reference invocation
|
||||
of ls, thus enforcing something gets output.
|
||||
|
||||
Upstream-commit: b7091093bb6505c33279f9bc940b2e94763a6e5d
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
tests/ls/stat-free-color.sh | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/ls/stat-free-color.sh b/tests/ls/stat-free-color.sh
|
||||
index 00942f7..87bed1c 100755
|
||||
--- a/tests/ls/stat-free-color.sh
|
||||
+++ b/tests/ls/stat-free-color.sh
|
||||
@@ -56,12 +56,14 @@ eval $(dircolors -b color-without-stat)
|
||||
# The system may perform additional stat-like calls before main.
|
||||
# Furthermore, underlying library functions may also implicitly
|
||||
# add an extra stat call, e.g. opendir since glibc-2.21-360-g46f894d.
|
||||
-# To avoid counting those, first get a baseline count for running
|
||||
-# ls with one empty directory argument. Then, compare that with the
|
||||
-# invocation under test.
|
||||
+# Finally, ls(1) makes a stat call for stdout, but only in the case
|
||||
+# when there is something to output.
|
||||
+# To get the comparison right, first get a baseline count for running
|
||||
+# 'ls -a' with one empty directory argument. Then, compare that with
|
||||
+# the invocation under test.
|
||||
mkdir d || framework_failure_
|
||||
|
||||
-strace -q -o log1 -e $stats ls --color=always d || fail=1
|
||||
+strace -q -o log1 -e $stats ls -a --color=always d || fail=1
|
||||
n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_
|
||||
|
||||
test $n_stat1 = 0 \
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From c16ca58f17a088e925c0d1c4015c48332c380a00 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Sun, 9 May 2021 23:41:00 +0100
|
||||
Subject: [PATCH 2/2] tests: fix tests/cp/sparse-2.sh false failure on some
|
||||
systems
|
||||
|
||||
* tests/cp/sparse-2.sh: Double check cp --sparse=always,
|
||||
with dd conv=sparse, in the case where the former didn't
|
||||
create a sparse file. Now that this test is being newly run
|
||||
on macos, we're seeing a failure due to seek() not creating
|
||||
holes on apfs unless the size is >= 16MiB.
|
||||
|
||||
Upstream-commit: 6b499720fecae935dc00e236d6aefe94d9010482
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
tests/cp/fiemap-2.sh | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tests/cp/fiemap-2.sh b/tests/cp/fiemap-2.sh
|
||||
index 548a376..e20ce54 100755
|
||||
--- a/tests/cp/fiemap-2.sh
|
||||
+++ b/tests/cp/fiemap-2.sh
|
||||
@@ -17,7 +17,7 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
-print_ver_ cp
|
||||
+print_ver_ cp stat dd
|
||||
|
||||
# Require a fiemap-enabled FS.
|
||||
touch fiemap_chk # check a file rather than current dir for best coverage
|
||||
@@ -46,10 +46,17 @@ dd bs=1k seek=1 of=k count=255 < /dev/zero || framework_failure_
|
||||
|
||||
# cp should detect the all-zero blocks and convert some of them to holes.
|
||||
# How many it detects/converts currently depends on io_blksize.
|
||||
-# Currently, on my F14/ext4 desktop, this K starts off with size 256KiB,
|
||||
+# Currently, on my F14/ext4 desktop, this K file starts off with size 256KiB,
|
||||
# (note that the K in the preceding test starts off with size 4KiB).
|
||||
# cp from coreutils-8.9 with --sparse=always reduces the size to 32KiB.
|
||||
cp --sparse=always k k2 || fail=1
|
||||
-test $(stat -c %b k2) -lt $(stat -c %b k) || fail=1
|
||||
+if test $(stat -c %b k2) -ge $(stat -c %b k); then
|
||||
+ # If not sparse, then double check by creating with dd
|
||||
+ # as we're not guaranteed that seek will create a hole.
|
||||
+ # apfs on darwin 19.2.0 for example was seen to not to create holes < 16MiB.
|
||||
+ hole_size=$(stat -c %o k2) || framework_failure_
|
||||
+ dd if=k of=k2.dd bs=$hole_size conv=sparse || framework_failure_
|
||||
+ test $(stat -c %b k2) -eq $(stat -c %b k2.dd) || fail=1
|
||||
+fi
|
||||
|
||||
Exit $fail
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
From f4422844dbcd839ce486bcbc15b7bd5b72c9198d Mon Sep 17 00:00:00 2001
|
||||
From: Rohan Sable <rsable@redhat.com>
|
||||
Date: Mon, 7 Mar 2022 14:14:13 +0000
|
||||
Subject: [PATCH 1/2] ls: avoid triggering automounts
|
||||
|
||||
statx() has different defaults wrt automounting
|
||||
compared to stat() or lstat(), so explicitly
|
||||
set the AT_NO_AUTOMOUNT flag to suppress that behavior,
|
||||
and avoid unintended operations or potential errors.
|
||||
|
||||
* src/ls.c (do_statx): Pass AT_NO_AUTOMOUNT to avoid this behavior.
|
||||
Fixes https://bugs.gnu.org/54286
|
||||
|
||||
Signed-off-by: Rohan Sable <rsable@redhat.com>
|
||||
|
||||
Upstream-commit: 85c975df2c25bd799370b04bb294e568e001102f
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/ls.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ls.c b/src/ls.c
|
||||
index 1047801..fe0e9f8 100644
|
||||
--- a/src/ls.c
|
||||
+++ b/src/ls.c
|
||||
@@ -1175,7 +1175,7 @@ do_statx (int fd, char const *name, struct stat *st, int flags,
|
||||
{
|
||||
struct statx stx;
|
||||
bool want_btime = mask & STATX_BTIME;
|
||||
- int ret = statx (fd, name, flags, mask, &stx);
|
||||
+ int ret = statx (fd, name, flags | AT_NO_AUTOMOUNT, mask, &stx);
|
||||
if (ret >= 0)
|
||||
{
|
||||
statx_to_stat (&stx, st);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
||||
From 3d227f9e4f3fe806064721e4b9451ee06526bc80 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Mon, 7 Mar 2022 23:29:20 +0000
|
||||
Subject: [PATCH 2/2] stat: only automount with --cached=never
|
||||
|
||||
Revert to the default behavior before the introduction of statx().
|
||||
|
||||
* src/stat.c (do_stat): Set AT_NO_AUTOMOUNT without --cached=never.
|
||||
* doc/coreutils.texi (stat invocation): Mention the automount
|
||||
behavior with --cached=never.
|
||||
|
||||
Fixes https://bugs.gnu.org/54287
|
||||
|
||||
Upstream-commit: 92cb8427c537f37edd43c5cef1909585201372ab
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
doc/coreutils.texi | 1 +
|
||||
src/stat.c | 3 +++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 19b535c..0f5c16a 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -12564,6 +12564,7 @@ Always read the already cached attributes if available.
|
||||
|
||||
@item never
|
||||
Always sychronize with the latest file system attributes.
|
||||
+This also mounts automounted files.
|
||||
|
||||
@item default
|
||||
Leave the caching behavior to the underlying file system.
|
||||
diff --git a/src/stat.c b/src/stat.c
|
||||
index 0c34501..803340a 100644
|
||||
--- a/src/stat.c
|
||||
+++ b/src/stat.c
|
||||
@@ -1381,6 +1381,9 @@ do_stat (char const *filename, char const *format, char const *format2)
|
||||
else if (force_sync)
|
||||
flags |= AT_STATX_FORCE_SYNC;
|
||||
|
||||
+ if (! force_sync)
|
||||
+ flags |= AT_NO_AUTOMOUNT;
|
||||
+
|
||||
fd = statx (fd, pathname, flags, format_to_mask (format), &stx);
|
||||
if (fd < 0)
|
||||
{
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||
Name: coreutils
|
||||
Version: 8.32
|
||||
Release: 22%{?dist}
|
||||
Release: 32%{?dist}
|
||||
License: GPLv3+
|
||||
Url: https://www.gnu.org/software/coreutils/
|
||||
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
|
||||
|
@ -52,6 +52,21 @@ Patch12: coreutils-8.32-mem-leaks.patch
|
|||
# utimens: fix confusing arg type in internal func
|
||||
Patch13: coreutils-8.32-coverity-utimens.patch
|
||||
|
||||
# fix false positives in the upstrem test-suite (#1960792)
|
||||
Patch14: coreutils-8.32-tests-false-positives.patch
|
||||
|
||||
# mountlist: recognize fuse.portal as dummy file system (#1913358)
|
||||
Patch15: coreutils-8.32-fuse-portal.patch
|
||||
|
||||
# tail: fix stack out-of-bounds write with --follow
|
||||
Patch16: coreutils-8.32-tail-use-poll.patch
|
||||
|
||||
# df: fix duplicated remote entries due to bind mounts (#1979814)
|
||||
Patch17: coreutils-8.32-df-duplicated-entries.patch
|
||||
|
||||
# ls, stat: avoid triggering automounts (#2044981)
|
||||
Patch18: coreutils-9.0-autofs-no-mount.patch
|
||||
|
||||
# disable the test-lock gnulib test prone to deadlock
|
||||
Patch100: coreutils-8.26-test-lock.patch
|
||||
|
||||
|
@ -309,6 +324,30 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
|||
%license COPYING
|
||||
|
||||
%changelog
|
||||
* Mon Mar 21 2022 Kamil Dudka <kdudka@redhat.com> - 8.32-32
|
||||
- ls, stat: avoid triggering automounts (#2044981)
|
||||
|
||||
* Tue Mar 01 2022 Kamil Dudka <kdudka@redhat.com> - 8.32-31
|
||||
- make `df --direct` work again (#2058686)
|
||||
|
||||
* Wed Jul 07 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-30
|
||||
- df: fix duplicated remote entries due to bind mounts (#1979814)
|
||||
|
||||
* Thu Jul 01 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-28
|
||||
- tail: fix stack out-of-bounds write with --follow
|
||||
|
||||
* Tue Jun 08 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-27
|
||||
- mountlist: recognize fuse.portal as dummy file system (#1913358)
|
||||
|
||||
* Mon May 17 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-26
|
||||
- cp: pick additional copy_file_range()-related fixes from upstream
|
||||
|
||||
* Mon May 03 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-24
|
||||
- copy: ensure we enforce --reflink=never (#1956080)
|
||||
|
||||
* Tue Apr 27 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-23
|
||||
- copy: do not refuse to copy a swap file
|
||||
|
||||
* Fri Apr 09 2021 Kamil Dudka <kdudka@redhat.com> - 8.32-22
|
||||
- utimens: fix confusing arg type in internal func
|
||||
|
||||
|
|
Loading…
Reference in New Issue