Compare commits

...
Sign in to create a new pull request.

7 commits

Author SHA1 Message Date
Jonathan Wakely
96e95e8479 Add boost-json to umbrella package 2022-07-14 16:05:42 +01:00
Jonathan Wakely
5117e662ba Add patch to fix filesystem::copy_file EXDEV handling
Resolves: #2106878
2022-07-14 16:05:42 +01:00
Jonathan Wakely
2844380e87 Add patch to fix Asio includes
Resolves: #2106441
2022-07-14 16:05:40 +01:00
Thomas W Rodgers
31d7f00edc Add BuildRequires: libzstd-devel (#2042336) 2022-07-14 16:05:16 +01:00
Jonathan Wakely
1d28049345 Add patch to fix XML validation errors in ptr_container docs 2022-07-14 16:00:54 +01:00
Jonathan Wakely
aa44edbed2 Add rpmlintrc file to suppress errors in Zuul checks 2022-07-14 15:59:59 +01:00
Jonathan Wakely
da0b56fe38 Add patch to fix CI failure 2022-07-14 15:59:58 +01:00
6 changed files with 1533 additions and 1 deletions

View file

@ -0,0 +1,34 @@
From 71964b22c7fade69cc4caa1c869a868e3a32cc97 Mon Sep 17 00:00:00 2001
From: Christopher Kohlhoff <chris@kohlhoff.com>
Date: Wed, 2 Mar 2022 21:41:04 +1100
Subject: [PATCH] Header <utility> is needed for std::exchange.
---
include/boost/asio/awaitable.hpp | 1 +
include/boost/asio/impl/awaitable.hpp | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/boost/asio/awaitable.hpp b/include/boost/asio/awaitable.hpp
index a9cc90d43..750198995 100644
--- a/include/boost/asio/awaitable.hpp
+++ b/include/boost/asio/awaitable.hpp
@@ -25,6 +25,7 @@
# include <experimental/coroutine>
#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
+#include <utility>
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/detail/push_options.hpp>
diff --git a/include/boost/asio/impl/awaitable.hpp b/include/boost/asio/impl/awaitable.hpp
index 49a47e29a..c66fa74c6 100644
--- a/include/boost/asio/impl/awaitable.hpp
+++ b/include/boost/asio/impl/awaitable.hpp
@@ -19,7 +19,6 @@
#include <exception>
#include <new>
#include <tuple>
-#include <utility>
#include <boost/asio/detail/thread_context.hpp>
#include <boost/asio/detail/thread_info_base.hpp>
#include <boost/asio/detail/type_traits.hpp>

View file

@ -0,0 +1,152 @@
From 4b9052f1e0b2acf625e8247582f44acdcc78a4ce Mon Sep 17 00:00:00 2001
From: Andrey Semashev <andrey.semashev@gmail.com>
Date: Tue, 18 May 2021 22:53:40 +0300
Subject: [PATCH] Fallback to read/write loop if sendfile/copy_file_range fail.
Since sendfile and copy_file_range can fail for some filesystems
(e.g. eCryptFS), we have to fallback to the read/write loop in copy_file
implementation. Additionally, since we implement the fallback now,
fallback to sendfile if copy_file_range fails with EXDEV and use
copy_file_range on older kernels that don't implement it for
cross-filesystem copying. This may be beneficial if copy_file_range
is used within a filesystem, and is performed on a remote server NFS or CIFS).
Also, it was discovered that copy_file_range can also fail with EOPNOTSUPP
when it is performed on an NFSv4 filesystem and the remote server does
not support COPY operation. This happens on some patched kernels in RHEL/CentOS.
Lastly, to make sure the copy_file_data pointer is accessed atomically,
it is now declared as an atomic value. If std::atomic is unavailable,
Boost.Atomic is used.
Fixes https://github.com/boostorg/filesystem/issues/184.
---
diff --git a/src/operations.cpp b/src/operations.cpp
index abc7e4f6e..8f1130f00 100644
--- a/libs/filesystem/src/operations.cpp
+++ b/libs/filesystem/src/operations.cpp
@@ -135,6 +135,8 @@ using std::time_t;
# endif // BOOST_WINDOWS_API
#include "error_handling.hpp"
+#include <atomic>
+namespace atomic_ns = std;
namespace fs = boost::filesystem;
using boost::filesystem::path;
@@ -521,6 +522,9 @@ int copy_file_data_read_write(int infile, int outfile, uintmax_t size)
if (BOOST_UNLIKELY(!buf.get()))
return ENOMEM;
+ // Don't use file size to limit the amount of data to copy since some filesystems, like procfs or sysfs,
+ // provide files with generated content and indicate that their size is zero or 4096. Just copy as much data
+ // as we can read from the input file.
while (true)
{
ssize_t sz_read = ::read(infile, buf.get(), buf_sz);
@@ -555,7 +559,7 @@ int copy_file_data_read_write(int infile, int outfile, uintmax_t size)
}
//! Pointer to the actual implementation of the copy_file_data implementation
-copy_file_data_t* copy_file_data = &copy_file_data_read_write;
+atomic_ns::atomic< copy_file_data_t* > copy_file_data(&copy_file_data_read_write);
#if defined(BOOST_FILESYSTEM_USE_SENDFILE)
@@ -577,6 +581,23 @@ int copy_file_data_sendfile(int infile, int outfile, uintmax_t size)
int err = errno;
if (err == EINTR)
continue;
+
+ if (offset == 0u)
+ {
+ // sendfile may fail with EINVAL if the underlying filesystem does not support it
+ if (err == EINVAL)
+ {
+ fallback_to_read_write:
+ return copy_file_data_read_write(infile, outfile, size);
+ }
+
+ if (err == ENOSYS)
+ {
+ copy_file_data.store(&copy_file_data_read_write, atomic_ns::memory_order_relaxed);
+ goto fallback_to_read_write;
+ }
+ }
+
return err;
}
@@ -611,6 +632,44 @@ int copy_file_data_copy_file_range(int infile, int outfile, uintmax_t size)
int err = errno;
if (err == EINTR)
continue;
+
+ if (offset == 0u)
+ {
+ // copy_file_range may fail with EINVAL if the underlying filesystem does not support it.
+ // In some RHEL/CentOS 7.7-7.8 kernel versions, copy_file_range on NFSv4 is also known to return EOPNOTSUPP
+ // if the remote server does not support COPY, despite that it is not a documented error code.
+ // See https://patchwork.kernel.org/project/linux-nfs/patch/20190411183418.4510-1-olga.kornievskaia@gmail.com/
+ // and https://bugzilla.redhat.com/show_bug.cgi?id=1783554.
+ if (err == EINVAL || err == EOPNOTSUPP)
+ {
+#if !defined(BOOST_FILESYSTEM_USE_SENDFILE)
+ fallback_to_read_write:
+#endif
+ return copy_file_data_read_write(infile, outfile, size);
+ }
+
+ if (err == EXDEV)
+ {
+#if defined(BOOST_FILESYSTEM_USE_SENDFILE)
+ fallback_to_sendfile:
+ return copy_file_data_sendfile(infile, outfile, size);
+#else
+ goto fallback_to_read_write;
+#endif
+ }
+
+ if (err == ENOSYS)
+ {
+#if defined(BOOST_FILESYSTEM_USE_SENDFILE)
+ copy_file_data.store(&copy_file_data_sendfile, atomic_ns::memory_order_relaxed);
+ goto fallback_to_sendfile;
+#else
+ copy_file_data.store(&copy_file_data_read_write, atomic_ns::memory_order_relaxed);
+ goto fallback_to_read_write;
+#endif
+ }
+ }
+
return err;
}
@@ -646,13 +705,14 @@ struct copy_file_data_initializer
#endif
#if defined(BOOST_FILESYSTEM_USE_COPY_FILE_RANGE)
- // Although copy_file_range appeared in Linux 4.5, it did not support cross-filesystem copying until 5.3
- if (major > 5u || (major == 5u && minor >= 3u))
+ // Although copy_file_range appeared in Linux 4.5, it did not support cross-filesystem copying until 5.3.
+ // copy_file_data_copy_file_range will fallback to copy_file_data_sendfile if copy_file_range returns EXDEV.
+ if (major > 4u || (major == 4u && minor >= 5u))
cfd = &copy_file_data_copy_file_range;
#endif
- copy_file_data = cfd;
+ copy_file_data.store(cfd, atomic_ns::memory_order_relaxed);
}
}
const copy_file_data_init;
@@ -1412,7 +1472,7 @@ bool copy_file(path const& from, path const& to, unsigned int options, error_cod
goto fail_errno;
}
- err = detail::copy_file_data(infile.fd, outfile.fd, get_size(from_stat));
+ err = detail::copy_file_data.load(atomic_ns::memory_order_relaxed)(infile.fd, outfile.fd, get_size(from_stat));
if (BOOST_UNLIKELY(err != 0))
goto fail; // err already contains the error code

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
From c3ada7a1b2b54f4b27585f72308a76984f8489b4 Mon Sep 17 00:00:00 2001
From: jzmaddock <john@johnmaddock.co.uk>
Date: Tue, 16 Mar 2021 10:47:16 +0000
Subject: [PATCH] Add missing #includes.
---
test/multiprecision_float_test.cpp | 1 +
test/multiprecision_int_test.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/test/multiprecision_float_test.cpp b/test/multiprecision_float_test.cpp
index 904c59d8f..bc2a9364d 100644
--- boost_1_76_0/libs/random/test/multiprecision_float_test.cpp
+++ boost_1_76_0/libs/random/test/multiprecision_float_test.cpp
@@ -20,6 +20,7 @@
#include <boost/multiprecision/debug_adaptor.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/random.hpp>
+#include <boost/mpl/list.hpp>
#include <sstream>
diff --git a/test/multiprecision_int_test.cpp b/test/multiprecision_int_test.cpp
index 577e52aff..41ec229b5 100644
--- boost_1_76_0/libs/random/test/multiprecision_int_test.cpp
+++ boost_1_76_0/libs/random/test/multiprecision_int_test.cpp
@@ -32,6 +32,7 @@
#include <boost/random/uniform_int.hpp>
#include <boost/random/uniform_smallint.hpp>
#include <boost/random/discrete_distribution.hpp>
+#include <boost/mpl/list.hpp>
#include <sstream>
typedef boost::mpl::list <

24
boost.rpmlintrc Normal file
View file

@ -0,0 +1,24 @@
# The meta-package doesn't contain any files, this is intended.
addFilter("boost.x86_64: E: no-binary")
# All docs are in a separate boost-doc package
addFilter("boost.*: W: no-documentation")
addFilter("boost.*: W: description-shorter-than-summary")
# Upstream don't provide one
addFilter("boost-doctools.x86_64: W: no-manual-page-for-binary quickbook")
# Ignore these
addFilter("boost.*: W: spelling-error %description -l en_US foundational ")
addFilter("boost.*: W: spelling-error %description -l en_US invariants ")
addFilter("boost.*: W: spelling-error %description -l en_US postconditions ")
addFilter("boost.*: W: spelling-error %description -l en_US userland ")
addFilter("boost.*: W: spelling-error Summary(en_US) numpy ")
# The example code is useless without the headers
addFilter("boost-examples.x86_64: E: devel-dependency boost-devel")
# These libs are statically linked
addFilter("boost-date-time.x86_64: E: shared-lib-without-dependency-information /usr/lib64/libboost_date_time.so.*")
addFilter("boost-system.x86_64: E: shared-lib-without-dependency-information /usr/lib64/libboost_system.so.*")
addFilter("boost-stacktrace.x86_64: E: shared-lib-without-dependency-information /usr/lib64/libboost_stacktrace_noop.so.*")

View file

@ -85,6 +85,7 @@ Requires: %{name}-fiber%{?_isa} = %{version}-%{release}
Requires: %{name}-filesystem%{?_isa} = %{version}-%{release}
Requires: %{name}-graph%{?_isa} = %{version}-%{release}
Requires: %{name}-iostreams%{?_isa} = %{version}-%{release}
Requires: %{name}-json%{?_isa} = %{version}-%{release}
Requires: %{name}-locale%{?_isa} = %{version}-%{release}
Requires: %{name}-log%{?_isa} = %{version}-%{release}
Requires: %{name}-math%{?_isa} = %{version}-%{release}
@ -123,6 +124,7 @@ BuildRequires: libicu-devel
BuildRequires: libquadmath-devel
%endif
BuildRequires: bison
BuildRequires: libzstd-devel
# https://bugzilla.redhat.com/show_bug.cgi?id=828856
# https://bugzilla.redhat.com/show_bug.cgi?id=828857
@ -158,6 +160,19 @@ Patch100: boost-1.76.0-fix-include-inside-boost-namespace.patch
# https://github.com/boostorg/math/pull/671
Patch101: boost-1.76.0-fix-duplicate-typedef-in-mp.patch
# https://github.com/boostorg/random/issues/82
Patch102: boost-1.76.0-random-test.patch
# https://github.com/boostorg/ptr_container/pull/27
Patch105: boost-1.76.0-ptr_cont-xml.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2106441
Patch106: boost-1.76.0-asio-header.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2106878
# https://github.com/boostorg/filesystem/issues/184
Patch107: boost-1.76.0-filesystem-copy_file-exdev.patch
%bcond_with tests
%bcond_with docs_generated
@ -681,6 +696,10 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x
%patch98 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch105 -p1
%patch106 -p2
%patch107 -p1
%build
%set_build_flags
@ -1292,8 +1311,14 @@ fi
%{_mandir}/man1/b2.1*
%changelog
* Wed Sep 01 2021 Jonathan Wakely <jwakely@redhat.com> - 1.76.0-5
* Thu Jul 14 2022 Jonathan Wakely <jwakely@redhat.com> - 1.76.0-5
- Make boost-python3 depend on specific 3.X version (#1896713)
- Add patch to fix CI failure
- Add patch to fix XML validation errors in ptr_container docs
- Add BuildRequires: libzstd-devel (#2042336)
- Add patch to fix Asio includes (#2106441)
- Add patch to fix filesystem::copy_file EXDEV handling (#2106878)
- Add boost-json to umbrella package
* Thu Aug 05 2021 Thomas Rodgers <trodgers@redhat.com> - 1.76.0-4
- Third attempt at making the long double c99 and tr1 math libs conditional