From 4859f7d8c89b753613e49b07ae98af01bdc248f6 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Aug 14 2022 00:03:14 +0000 Subject: Update to 1.47.1 --- diff --git a/.gitignore b/.gitignore index 2b38cae..e2c3bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,9 @@ /grpc-1.46.1.tar.gz /grpc-1.46.2.tar.gz /grpc-1.46.3.tar.gz +/grpc-1.47.0.tar.gz +/data-plane-api-df3b1ab2773147f292c4f175f790c35448328161.tar.gz +/googleapis-2f9af297c84c55c8b871ba4495e01ade42476c92.tar.gz +/opencensus-proto-0.3.0.tar.gz +/xds-cb28da3451f158a947dfc45090fe92b07b243bc1.tar.gz +/grpc-1.47.1.tar.gz diff --git a/29359.patch b/29359.patch deleted file mode 100644 index bf51b94..0000000 --- a/29359.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1988ebe6547df3a6b45d46a495ff5845cc9740d2 Mon Sep 17 00:00:00 2001 -From: "Benjamin A. Beasley" -Date: Fri, 8 Apr 2022 15:34:49 -0400 -Subject: [PATCH] Do not segfault when peer CN is absent - -In HostNameCertificateVerifier::Verify, do not use the -peer_info->common_name if it is a null pointer. ---- - .../security/credentials/tls/grpc_tls_certificate_verifier.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc b/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc -index 9bf92c6c0195..7651f17ffcb8 100644 ---- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc -+++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc -@@ -142,7 +142,8 @@ bool HostNameCertificateVerifier::Verify( - const char* common_name = request->peer_info.common_name; - // We are using the target name sent from the client as a matcher to match - // against identity name on the peer cert. -- if (VerifySubjectAlternativeName(common_name, std::string(target_host))) { -+ if (common_name != nullptr && -+ VerifySubjectAlternativeName(common_name, std::string(target_host))) { - return true; // synchronous check - } - } diff --git a/29568.patch b/29568.patch deleted file mode 100644 index e0f9cc4..0000000 --- a/29568.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e78ef29524ba8b7e197c8fe3cc8012096c87b928 Mon Sep 17 00:00:00 2001 -From: "Benjamin A. Beasley" -Date: Tue, 3 May 2022 12:59:51 -0400 -Subject: [PATCH] Fix a segfault in client_lb_end2end_test - -In the SubchannelStreamClient constructor, do not initialize an -absl::string_view with a null pointer; this leads to strlen() being -called on the null pointer. Let the absl::string_view be initialized -with the string literal "SubchannelStreamClient" in this case instead. - -Fixes #29567. ---- - .../ext/filters/client_channel/subchannel_stream_client.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/core/ext/filters/client_channel/subchannel_stream_client.cc b/src/core/ext/filters/client_channel/subchannel_stream_client.cc -index a596e044568e..1079948bc3a4 100644 ---- a/src/core/ext/filters/client_channel/subchannel_stream_client.cc -+++ b/src/core/ext/filters/client_channel/subchannel_stream_client.cc -@@ -50,7 +50,8 @@ SubchannelStreamClient::SubchannelStreamClient( - call_allocator_( - ResourceQuotaFromChannelArgs(connected_subchannel_->args()) - ->memory_quota() -- ->CreateMemoryAllocator(tracer)), -+ ->CreateMemoryAllocator( -+ (tracer != nullptr) ? tracer : "SubchannelStreamClient")), - event_handler_(std::move(event_handler)), - retry_backoff_( - BackOff::Options() diff --git a/grpc-1.40.0-python-grpcio-use-system-abseil.patch b/grpc-1.40.0-python-grpcio-use-system-abseil.patch deleted file mode 100644 index bf3d5f3..0000000 --- a/grpc-1.40.0-python-grpcio-use-system-abseil.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff -Naur grpc-1.40.0-original/setup.py grpc-1.40.0/setup.py ---- grpc-1.40.0-original/setup.py 2021-09-03 19:20:52.000000000 -0400 -+++ grpc-1.40.0/setup.py 2021-09-07 14:57:55.247990450 -0400 -@@ -29,6 +29,7 @@ - from distutils import util - import os - import os.path -+import pathlib - import platform - import re - import shlex -@@ -154,6 +155,11 @@ - # runtime, the shared library must be installed - BUILD_WITH_SYSTEM_RE2 = _env_bool_value('GRPC_PYTHON_BUILD_SYSTEM_RE2', 'False') - -+# Export this variable to use the system installation of abseil. You need to -+# have the header files installed (in /usr/include/absl) and during -+# runtime, the shared library must be installed -+BUILD_WITH_SYSTEM_ABSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ABSL', '0') in ('1', 'True') -+ - # Export this variable to force building the python extension with a statically linked libstdc++. - # At least on linux, this is normally not needed as we can build manylinux-compatible wheels on linux just fine - # without statically linking libstdc++ (which leads to a slight increase in the wheel size). -@@ -296,6 +302,10 @@ - CORE_C_FILES = filter(lambda x: 'third_party/re2' not in x, CORE_C_FILES) - RE2_INCLUDE = (os.path.join('/usr', 'include', 're2'),) - -+if BUILD_WITH_SYSTEM_ABSL: -+ CORE_C_FILES = filter(lambda x: 'third_party/abseil-cpp' not in x, CORE_C_FILES) -+ ABSL_INCLUDE = (os.path.join('/usr', 'include'),) -+ - EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE + ABSL_INCLUDE + - ADDRESS_SORTING_INCLUDE + CARES_INCLUDE + - RE2_INCLUDE + SSL_INCLUDE + UPB_INCLUDE + -@@ -325,6 +335,10 @@ - EXTENSION_LIBRARIES += ('cares',) - if BUILD_WITH_SYSTEM_RE2: - EXTENSION_LIBRARIES += ('re2',) -+if BUILD_WITH_SYSTEM_ABSL: -+ EXTENSION_LIBRARIES += tuple( -+ lib.stem[3:] for lib in pathlib.Path('/usr').glob('lib*/libabsl_*.so') -+ ) - - DEFINE_MACROS = (('_WIN32_WINNT', 0x600),) - asm_files = [] diff --git a/grpc.spec b/grpc.spec index 81f7991..526d9e9 100644 --- a/grpc.spec +++ b/grpc.spec @@ -10,10 +10,58 @@ # is used only at build time, and contributes nothing to the installed files. # We take measures to verify this in %%check. As long as we are using our own # copy, we use the exact same version as upstream. +%global gtest_url https://github.com/google/googletest +%global gtest_dir googletest-%{gtest_commit} %global gtest_commit 0e402173c97aea7a00749e825b194bfede4f2e45 #global gtest_version 1.11.0 +#global gtest_dir googletest-release-#{gtest_version} %bcond_with system_gtest +# ===== + +# Parameters for third-party sources needed for their .proto files, which +# upstream expects to download at build time. +# +# See https://github.com/grpc/grpc/pull/29254 “[xDS Proto] Enhence gRPC +# buildgen for 3rd party proto compilation” and +# https://github.com/grpc/grpc/commit/99752b173cfa2fba81dedb482ee4fd74b2a46bb0, +# in which the download mechanism was added. +# +# Check CMakeLists.txt (search for “download_archive”) for a list of these +# third-party sources and the commit hashes used in the grpc release. +# +# Note that we do not treat these additional sources as bundled dependencies, +# since (provably) only the .proto files are used. +# +# In practice, it seems the generated binding code for these protos is not +# re-generated when building this package, so we could get by with creating the +# appropriate directories and touching an empty file within each. We include +# these archives in the source RPM anyway, since they are in some sense part of +# the original sources for the generated proto code. + +# This will probably never be separately packaged in Fedora, since upstream can +# only build with Bazel (and Bazel is such a mess of bundled dependencies that +# it is unlikely to every be successfully packaged under the Fedora packaging +# guidelines. Note that the URL is a read-only mirror based on +# https://github.com/envoyproxy/envoy, with different commit hashes. +%global envoy_api_commit df3b1ab2773147f292c4f175f790c35448328161 +%global envoy_api_url https://github.com/envoyproxy/data-plane-api +%global envoy_api_dir data-plane-api-%{envoy_api_commit} + +%global googleapis_commit 2f9af297c84c55c8b871ba4495e01ade42476c92 +%global googleapis_url https://github.com/googleapis/googleapis +%global googleapis_dir googleapis-%{googleapis_commit} + +%global opencensus_proto_version 0.3.0 +%global opencensus_proto_url https://github.com/census-instrumentation/opencensus-proto +%global opencensus_proto_dir opencensus-proto-%{opencensus_proto_version} + +%global xds_commit cb28da3451f158a947dfc45090fe92b07b243bc1 +%global xds_url https://github.com/cncf/xds +%global xds_dir xds-%{xds_commit} + +# ===== + # Bootstrapping breaks the circular dependency on python3dist(xds-protos), # which is packaged separately but ultimately generated from grpc sources using # the proto compilers in this package; the consequence is that we cannot build @@ -64,7 +112,7 @@ # documentation. Instead, we have just dropped all documentation. Name: grpc -Version: 1.46.3 +Version: 1.47.1 Release: %autorelease Summary: RPC library and framework @@ -72,11 +120,11 @@ Summary: RPC library and framework %global pyversion %(echo '%{version}' | tr -d '~') # CMakeLists.txt: gRPC_CORE_SOVERSION -%global c_so_version 24 +%global c_so_version 25 # CMakeLists.txt: gRPC_CPP_SOVERSION # See https://github.com/abseil/abseil-cpp/issues/950#issuecomment-843169602 # regarding unusual C++ SOVERSION style (not a single number). -%global cpp_so_version 1.46 +%global cpp_so_version 1.47 # The entire source is Apache-2.0 except the following: # @@ -120,14 +168,13 @@ Summary: RPC library and framework License: Apache-2.0 AND BSD-3-Clause AND MIT URL: https://www.grpc.io %global forgeurl https://github.com/grpc/grpc/ -# Used only at build time (not a bundled library); see notes at definition of -# gtest_commit/gtest_version macro for explanation and justification. -%global gtest_url https://github.com/google/googletest -%global gtest_archivename googletest-%{gtest_commit} -#global gtest_archivename googletest-release-#{gtest_version} Source0: %{forgeurl}/archive/v%{srcversion}/grpc-%{srcversion}.tar.gz -Source1: %{gtest_url}/archive/%{gtest_commit}/%{gtest_archivename}.tar.gz -#Source1: #{gtest_url}/archive/release-#{gtest_version}/#{gtest_archivename}.tar.gz +Source1: %{gtest_url}/archive/%{gtest_commit}/%{gtest_dir}.tar.gz +#Source1: #{gtest_url}/archive/release-#{gtest_version}/#{gtest_dir}.tar.gz +Source2: %{envoy_api_url}/archive/%{envoy_api_commit}/%{envoy_api_dir}.tar.gz +Source3: %{googleapis_url}/archive/%{googleapis_commit}/%{googleapis_dir}.tar.gz +Source4: %{opencensus_proto_url}/archive/v%{opencensus_proto_version}/%{opencensus_proto_dir}.tar.gz +Source5: %{xds_url}/archive/%{xds_commit}/%{xds_dir}.tar.gz # Downstream grpc_cli man pages; hand-written based on “grpc_cli help” output. Source100: grpc_cli.1 @@ -268,10 +315,6 @@ BuildRequires: symlinks # # In fact, this may not be needed, since only testing code is patched. Patch: grpc-1.39.0-system-crypto-policies.patch -# Add an option GRPC_PYTHON_BUILD_SYSTEM_ABSL to go with the gRPC_ABSL_PROVIDER -# option already provided upstream. See -# https://github.com/grpc/grpc/issues/25559. -Patch: grpc-1.40.0-python-grpcio-use-system-abseil.patch # Fix errors like: # TypeError: super(type, obj): obj must be an instance or subtype of type # It is not clear why these occur. @@ -293,20 +336,6 @@ Patch: grpc-1.37.0-grpc_cli-do-not-link-gtest-gmock.patch # suppose that the unpatched code must be correct for how upstream runs the # tests, somehow. Patch: grpc-1.45.0-python_wrapper-path.patch -# Do not segfault when peer CN is absent -Patch: %{forgeurl}/pull/29359.patch -# Fix a segfault in client_lb_end2end_test -# -# In the SubchannelStreamClient constructor, do not initialize an -# absl::string_view with a null pointer; this lead to strlen() being -# called on the null pointer. Let the absl::string_view be empty in this -# case instead. -# -# Fixes #29567. -# -# “Segfault in client_lb_end2end_test due to absl::string_view(nullptr)” -# https://github.com/grpc/grpc/issues/29567 -Patch: %{forgeurl}/pull/29568.patch # Use gRPC_INSTALL_LIBDIR for pkgconfig files # https://github.com/grpc/grpc/pull/29826 # @@ -701,7 +730,7 @@ echo '===== Preparing gtest/gmock =====' 2>&1 # Copy in the needed gtest/gmock implementations. %setup -q -T -D -b 1 -n grpc-%{srcversion} rm -rvf 'third_party/googletest' -mv '../%{gtest_archivename}' 'third_party/googletest' +mv '../%{gtest_dir}' 'third_party/googletest' %else # Patch CMakeLists for external gtest/gmock. # @@ -724,6 +753,31 @@ sed -r -i 's/^([[:blank:]]*)(\$\{_gRPC_GFLAGS_LIBRARIES\})/'\ '\1\2\n\1gtest\n\1gmock/' CMakeLists.txt %endif +# Extract the source tarballs needed for their .proto files, which upstream +# expects to download at build time. +%setup -q -T -D -b 2 -n grpc-%{srcversion} +%setup -q -T -D -b 3 -n grpc-%{srcversion} +%setup -q -T -D -b 4 -n grpc-%{srcversion} +%setup -q -T -D -b 5 -n grpc-%{srcversion} +{ + awk '$1 ~ /^(#|$)/ { next }; 1' <<'EOF' +../%{envoy_api_dir}/ third_party/envoy-api/ +../%{googleapis_dir}/ third_party/googleapis/ +../%{opencensus_proto_dir}/ third_party/opencensus-proto/ +../%{xds_dir}/ third_party/xds/ +EOF +} | while read -r fromdir todir +do + # Remove everything from the external source tree except the .proto files, to + # prove that none of it is bundled. + find "${fromdir}" -type f ! -name '*.proto' -print -delete + # Remove the empty directory corresponding to the git submodule + rm -rvf "${todir}" + # Move the extracted source, to the location where the git submodule would be + # in a git checkout that included it. + mv "${fromdir}" "${todir}" +done + echo '===== Removing bundled xxhash =====' 2>&1 # Remove bundled xxhash rm -rvf third_party/xxhash @@ -783,7 +837,7 @@ echo '===== Fixing hard-coded C++ standard =====' 2>&1 # We need to adjust the C++ standard to avoid abseil-related linker errors. For # the main C++ build, we can use CMAKE_CXX_STANDARD. For extensions, examples, # etc., we must patch. -sed -r -i 's/(std=c\+\+)11/\1%{cpp_std}/g' \ +sed -r -i 's/(std=c\+\+)14/\1%{cpp_std}/g' \ setup.py grpc.gyp Rakefile \ examples/cpp/*/Makefile \ examples/cpp/*/CMakeLists.txt \ @@ -843,7 +897,6 @@ PYTHONPATH="${PYTHONPATH}:${PYROOT}%{python3_sitearch}" export PYTHONPATH # ~~ grpcio ~~ -# Note that we had to patch in the GRPC_PYTHON_BUILD_SYSTEM_ABSL option. export GRPC_PYTHON_BUILD_WITH_CYTHON='True' export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL='True' export GRPC_PYTHON_BUILD_SYSTEM_ZLIB='True' @@ -852,17 +905,19 @@ export GRPC_PYTHON_BUILD_SYSTEM_RE2='True' export GRPC_PYTHON_BUILD_SYSTEM_ABSL='True' export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY='True' export GRPC_PYTHON_ENABLE_DOCUMENTATION_BUILD='False' -# We must set GRPC_PYTHON_CFLAGS to avoid unwanted defaults. We take the -# upstream flags except that we remove -std=c99, which is inapplicable to the -# C++ parts of the extension. +# Use the upstream defaults for GRPC_PYTHON_CFLAGS adn GRPC_PYTHON_LDFLAGS, +# except: +# +# - Add any flags necessary for using the system protobuf library. +# - Drop -lpthread and -lrt, since these are not needed on glibc 2.34 and +# later. +# - Do not link libgcc statically (-static-libgcc). # -# We must set GRPC_PYTHON_LDFLAGS to avoid unwanted defaults. The upstream -# flags attempt to statically link libgcc, so we do not need any of them. Since -# we forcibly unbundle protobuf, we need to add linker flags for protobuf -# ourselves. -export GRPC_PYTHON_CFLAGS="-fvisibility=hidden -fno-wrapv -fno-exceptions $( +# See also: +# https://developers.redhat.com/articles/2021/12/17/why-glibc-234-removed-libpthread +export GRPC_PYTHON_CFLAGS="$( pkg-config --cflags protobuf -)" +) -std=c++%{cpp_std} -fvisibility=hidden -fno-wrapv -fno-exceptions" export GRPC_PYTHON_LDFLAGS="$(pkg-config --libs protobuf)" %py3_build %{__python3} %{py_setup} %{?py_setup_args} install \ diff --git a/sources b/sources index c313f09..f29ee4b 100644 --- a/sources +++ b/sources @@ -1,2 +1,6 @@ -SHA512 (grpc-1.46.3.tar.gz) = e80322b65c6f8d64dc91bce9f612119191e8d329cac2fbc5da6dad9a2a7ccaa7a501470ed483e555c3ba596e8aff796fbda2747f09e9c4329aed3de4d9b6b666 +SHA512 (grpc-1.47.1.tar.gz) = 4b7affab165137f8c9453cd162b9862227901ea86de77eb57489663e009a077c581c71104dc8e3910618c7ec786836243d4ad80aa52c0912c951881cba5bc70a SHA512 (googletest-0e402173c97aea7a00749e825b194bfede4f2e45.tar.gz) = 5c5eaf6ff9f3c1bca025b7ef0234ba97232ba85b43e6354a92f49b7208f5c47581ebaf18bf58618498e5d264f2620c2b6676e81bb0f7df77112b96ba271ececf +SHA512 (data-plane-api-df3b1ab2773147f292c4f175f790c35448328161.tar.gz) = 4225ab6e4d2fb24d18934edbfbc4104c1ffbdd24f800929aff49a2ff196f2c2bb44d80927383807c1076eafd0a507d83d75e8a751a58674a72b16f552d12b646 +SHA512 (googleapis-2f9af297c84c55c8b871ba4495e01ade42476c92.tar.gz) = cdeefae807df7097174b4bb28c0900b06a68d424c00ebba4ff5add260c9c651351d5e429bfc5de42f95ebb75dadec313f7bd3991c2fa476c9104f9ea656acad4 +SHA512 (opencensus-proto-0.3.0.tar.gz) = 39231a495dfdccfc8267d1e6af2ac624feea611a8691c10ec570de2194b352e4a9c3b0ce1606414fb98e5d77c66873bed4a9e56512efa12b267b8a91e0c5851e +SHA512 (xds-cb28da3451f158a947dfc45090fe92b07b243bc1.tar.gz) = eb5878764503872c18b8750b20e2c2e2224e73d9601197752cea7e1e4171899474ad4f39aacc80d6c1b57a50b2161d39f219df64ffb250d045af482dae01ea79