Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

18 changed files with 528 additions and 247 deletions

24
.gitignore vendored
View File

@ -1,3 +1,21 @@
SOURCES/googlemock-1.7.0.tar.gz
SOURCES/googletest-1.7.0.tar.gz
SOURCES/protobuf-3.5.0.tar.gz
protobuf-2.3.0.tar.bz2
/protobuf-2.4.1.tar.bz2
/protobuf-2.5.0.tar.bz2
/protobuf-2.6.0.tar.bz2
/protobuf-2.6.1.tar.bz2
/protobuf-3.1.0.tar.gz
/googlemock-1.7.0.tar.gz
/googletest-1.7.0.tar.gz
/protobuf-3.2.0rc2.tar.gz
/protobuf-3.2.0.tar.gz
/protobuf-3.3.1.tar.gz
/protobuf-3.4.1.tar.gz
/protobuf-3.5.0.tar.gz
/protobuf-3.6.1-all.tar.gz
/googletest-1.8.1.tar.gz
/protobuf-3.11.2-all.tar.gz
/5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip
/protobuf-3.11.4-all.tar.gz
/protobuf-3.12.3-all.tar.gz
/protobuf-3.13.0-all.tar.gz
/protobuf-3.14.0-all.tar.gz

View File

@ -1,3 +1,2 @@
2dbd904c1c0eadbe7250854fa8a2b8695a930e34 SOURCES/googlemock-1.7.0.tar.gz
d7aa4b8536f3a007b480cf016be8a4333dbf4768 SOURCES/googletest-1.7.0.tar.gz
41eaae1c0ae5fdc7fcb18916bf8fd22a4e3438a3 SOURCES/protobuf-3.5.0.tar.gz
fe843a3a69583fa23f1e77722c6d25ad3be61703 5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip
b613ab3057c8a7400e7b7d3004824274d964a196 protobuf-3.14.0-all.tar.gz

77
CVE-2021-22570.patch Normal file
View File

@ -0,0 +1,77 @@
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index 7af37c57f3..03c4e2b516 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -1090,7 +1090,7 @@ inline void DescriptorPool::Tables::FindAllExtensions(
bool DescriptorPool::Tables::AddSymbol(const std::string& full_name,
Symbol symbol) {
- if (InsertIfNotPresent(&symbols_by_name_, full_name.c_str(), symbol)) {
+ if (InsertIfNotPresent(&symbols_by_name_, full_name, symbol)) {
symbols_after_checkpoint_.push_back(full_name.c_str());
return true;
} else {
@@ -1106,7 +1106,7 @@ bool FileDescriptorTables::AddAliasUnderParent(const void* parent,
}
bool DescriptorPool::Tables::AddFile(const FileDescriptor* file) {
- if (InsertIfNotPresent(&files_by_name_, file->name().c_str(), file)) {
+ if (InsertIfNotPresent(&files_by_name_, file->name(), file)) {
files_after_checkpoint_.push_back(file->name().c_str());
return true;
} else {
@@ -2626,6 +2626,8 @@ void Descriptor::DebugString(int depth, std::string* contents,
const Descriptor::ReservedRange* range = reserved_range(i);
if (range->end == range->start + 1) {
strings::SubstituteAndAppend(contents, "$0, ", range->start);
+ } else if (range->end > FieldDescriptor::kMaxNumber) {
+ strings::SubstituteAndAppend(contents, "$0 to max, ", range->start);
} else {
strings::SubstituteAndAppend(contents, "$0 to $1, ", range->start,
range->end - 1);
@@ -2829,6 +2831,8 @@ void EnumDescriptor::DebugString(
const EnumDescriptor::ReservedRange* range = reserved_range(i);
if (range->end == range->start) {
strings::SubstituteAndAppend(contents, "$0, ", range->start);
+ } else if (range->end == INT_MAX) {
+ strings::SubstituteAndAppend(contents, "$0 to max, ", range->start);
} else {
strings::SubstituteAndAppend(contents, "$0 to $1, ", range->start,
range->end);
@@ -4019,6 +4023,11 @@ bool DescriptorBuilder::AddSymbol(const std::string& full_name,
// Use its file as the parent instead.
if (parent == nullptr) parent = file_;
+ if (full_name.find('\0') != std::string::npos) {
+ AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME,
+ "\"" + full_name + "\" contains null character.");
+ return false;
+ }
if (tables_->AddSymbol(full_name, symbol)) {
if (!file_tables_->AddAliasUnderParent(parent, name, symbol)) {
// This is only possible if there was already an error adding something of
@@ -4059,6 +4068,11 @@ bool DescriptorBuilder::AddSymbol(const std::string& full_name,
void DescriptorBuilder::AddPackage(const std::string& name,
const Message& proto,
const FileDescriptor* file) {
+ if (name.find('\0') != std::string::npos) {
+ AddError(name, proto, DescriptorPool::ErrorCollector::NAME,
+ "\"" + name + "\" contains null character.");
+ return;
+ }
if (tables_->AddSymbol(name, Symbol(file))) {
// Success. Also add parent package, if any.
std::string::size_type dot_pos = name.find_last_of('.');
@@ -4372,6 +4386,12 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl(
}
result->pool_ = pool_;
+ if (result->name().find('\0') != std::string::npos) {
+ AddError(result->name(), proto, DescriptorPool::ErrorCollector::NAME,
+ "\"" + result->name() + "\" contains null character.");
+ return nullptr;
+ }
+
// Add to tables.
if (!tables_->AddFile(result)) {
AddError(proto.name(), proto, DescriptorPool::ErrorCollector::OTHER,

View File

@ -1,26 +0,0 @@
From 3db1323d1d6132f08d0bafbd8602da7d71456745 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date: Tue, 28 Nov 2017 20:58:00 +0100
Subject: [PATCH] fix build on s390x
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
---
src/google/protobuf/stubs/atomicops.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/google/protobuf/stubs/atomicops.h b/src/google/protobuf/stubs/atomicops.h
index cb4553b1..34278f3a 100644
--- a/src/google/protobuf/stubs/atomicops.h
+++ b/src/google/protobuf/stubs/atomicops.h
@@ -214,7 +214,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
#elif defined(GOOGLE_PROTOBUF_ARCH_PPC)
#include <google/protobuf/stubs/atomicops_internals_ppc_gcc.h>
#elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
-#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
+#include <google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h>
#elif defined(__clang__)
#if __has_extension(c_atomic)
#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
--
2.15.0

View File

@ -1,57 +0,0 @@
--- a/src/google/protobuf/descriptor.cc.orig 2017-11-13 19:47:29.000000000 +0100
+++ b/src/google/protobuf/descriptor.cc 2022-03-08 17:00:19.057041566 +0100
@@ -2591,6 +2591,8 @@
const Descriptor::ReservedRange* range = reserved_range(i);
if (range->end == range->start + 1) {
strings::SubstituteAndAppend(contents, "$0, ", range->start);
+ } else if (range->end > FieldDescriptor::kMaxNumber) {
+ strings::SubstituteAndAppend(contents, "$0 to max, ", range->start);
} else {
strings::SubstituteAndAppend(contents, "$0 to $1, ",
range->start, range->end - 1);
@@ -2810,6 +2812,8 @@
const EnumDescriptor::ReservedRange* range = reserved_range(i);
if (range->end == range->start) {
strings::SubstituteAndAppend(contents, "$0, ", range->start);
+ } else if (range->end == INT_MAX) {
+ strings::SubstituteAndAppend(contents, "$0 to max, ", range->start);
} else {
strings::SubstituteAndAppend(contents, "$0 to $1, ",
range->start, range->end);
@@ -3983,6 +3987,11 @@
// Use its file as the parent instead.
if (parent == NULL) parent = file_;
+ if (full_name.find('\0') != std::string::npos) {
+ AddError(full_name, proto, DescriptorPool::ErrorCollector::NAME,
+ "\"" + full_name + "\" contains null character.");
+ return false;
+ }
if (tables_->AddSymbol(full_name, symbol)) {
if (!file_tables_->AddAliasUnderParent(parent, name, symbol)) {
// This is only possible if there was already an error adding something of
@@ -4020,6 +4029,11 @@
void DescriptorBuilder::AddPackage(
const string& name, const Message& proto, const FileDescriptor* file) {
+ if (name.find('\0') != std::string::npos) {
+ AddError(name, proto, DescriptorPool::ErrorCollector::NAME,
+ "\"" + name + "\" contains null character.");
+ return;
+ }
if (tables_->AddSymbol(name, Symbol(file))) {
// Success. Also add parent package, if any.
string::size_type dot_pos = name.find_last_of('.');
@@ -4288,6 +4302,12 @@
}
result->pool_ = pool_;
+ if (result->name().find('\0') != std::string::npos) {
+ AddError(result->name(), proto, DescriptorPool::ErrorCollector::NAME,
+ "\"" + result->name() + "\" contains null character.");
+ return nullptr;
+ }
+
// Add to tables.
if (!tables_->AddFile(result)) {
AddError(proto.name(), proto, DescriptorPool::ErrorCollector::OTHER,

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -0,0 +1,25 @@
--- a/src/google/protobuf/io/zero_copy_stream_unittest.cc.orig 2021-01-12 12:25:18.471517830 +0100
+++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc 2021-01-12 12:25:42.022696126 +0100
@@ -712,22 +712,6 @@
}
}
-// Verifies that outputs up to kint32max can be created.
-TEST_F(IoTest, LargeOutput) {
- std::string str;
- StringOutputStream output(&str);
- void* unused_data;
- int size;
- // Repeatedly calling Next should eventually grow the buffer to kint32max.
- do {
- EXPECT_TRUE(output.Next(&unused_data, &size));
- } while (str.size() < std::numeric_limits<int>::max());
- // Further increases should be possible.
- output.Next(&unused_data, &size);
- EXPECT_GT(size, 0);
-}
-
-
// To test files, we create a temporary file, write, read, truncate, repeat.
TEST_F(IoTest, FileIo) {
std::string filename = TestTempDir() + "/zero_copy_stream_test_file";

View File

@ -1,36 +1,37 @@
# Build -python2 subpackage
%bcond_with python2
# Build -python3 subpackage
%bcond_without python3
# Build -python subpackage
%bcond_without python
# Build -java subpackage
%bcond_with java
%global emacs_version %(pkg-config emacs --modversion)
%global emacs_lispdir %(pkg-config emacs --variable sitepkglispdir)
%global emacs_startdir %(pkg-config emacs --variable sitestartdir)
#global rcver rc2
# Disable LTO to work around annobin error messages
%global _lto_cflags %nil
Summary: Protocol Buffers - Google's data interchange format
Name: protobuf
Version: 3.5.0
Release: 15%{?dist}
Version: 3.14.0
Release: 13%{?dist}
License: BSD
URL: https://github.com/google/protobuf
Source: https://github.com/google/protobuf/archive/v%{version}%{?rcver}/%{name}-%{version}%{?rcver}.tar.gz
URL: https://github.com/protocolbuffers/protobuf
Source: https://github.com/protocolbuffers/protobuf/archive/v%{version}%{?rcver}/%{name}-%{version}%{?rcver}-all.tar.gz
Source1: ftdetect-proto.vim
Source2: protobuf-init.el
# For tests
Source3: https://github.com/google/googlemock/archive/release-1.7.0.tar.gz#/googlemock-1.7.0.tar.gz
Source4: https://github.com/google/googletest/archive/release-1.7.0.tar.gz#/googletest-1.7.0.tar.gz
# Might be upstreamable, but for now temporary workaround
Patch0: 0001-fix-build-on-s390x.patch
Patch1: CVE-2021-22570.rhel-8.patch
# For tests (using exactly the same version as the release)
Source3: https://github.com/google/googletest/archive/5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip
# https://github.com/protocolbuffers/protobuf/issues/8082
Patch1: protobuf-3.14-disable-IoTest.LargeOutput.patch
# Fix for CVE-2021-22570 "protobuf: Incorrect parsing of nullchar in the proto symbol leads to Nullptr dereference"
# https://bugzilla.redhat.com/show_bug.cgi?id=2050492
# Based on https://github.com/protocolbuffers/protobuf/commit/af95001202a035d78ff997e737bd67fca22ab32a
# As described in https://bugzilla.suse.com/show_bug.cgi?id=1195258
Patch2: CVE-2021-22570.patch
BuildRequires: make
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: emacs(bin)
BuildRequires: emacs-el >= 24.1
BuildRequires: emacs
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: pkgconfig
@ -110,37 +111,13 @@ The "optimize_for = LITE_RUNTIME" option causes the compiler to generate code
which only depends libprotobuf-lite, which is much smaller than libprotobuf but
lacks descriptors, reflection, and some other features.
%if %{with python2}
%package -n python2-%{name}
Summary: Python 2 bindings for Google Protocol Buffers
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?fedora}
# For tests
BuildRequires: python-google-apputils
%endif
Requires: python-six >= 1.9
Conflicts: %{name}-compiler > %{version}
Conflicts: %{name}-compiler < %{version}
Obsoletes: %{name}-python < 3.1.0-4
Provides: %{name}-python = %{version}-%{release}
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
This package contains Python 2 libraries for Google Protocol Buffers
%endif
%if %{with python3}
%if %{with python}
%package -n python%{python3_pkgversion}-%{name}
Summary: Python 3 bindings for Google Protocol Buffers
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%if 0%{?fedora}
# For tests
BuildRequires: python%{python3_pkgversion}-google-apputils
%endif
BuildRequires: python%{python3_pkgversion}-wheel
Requires: python%{python3_pkgversion}-six >= 1.9
Conflicts: %{name}-compiler > %{version}
Conflicts: %{name}-compiler < %{version}
@ -160,25 +137,6 @@ Requires: vim-enhanced
This package contains syntax highlighting for Google Protocol Buffers
descriptions in Vim editor
%package emacs
Summary: Emacs mode for Google Protocol Buffers descriptions
BuildArch: noarch
Requires: emacs(bin) >= 0%{emacs_version}
%description emacs
This package contains syntax highlighting for Google Protocol Buffers
descriptions in the Emacs editor.
%package emacs-el
Summary: Elisp source files for Google protobuf Emacs mode
BuildArch: noarch
Requires: protobuf-emacs = %{version}
%description emacs-el
This package contains the elisp source files for %{name}-emacs
under GNU Emacs. You do not need to install this package to use
%{name}-emacs.
%if %{with java}
%package java
@ -195,10 +153,18 @@ BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.easymock:easymock)
Conflicts: %{name}-compiler > %{version}
Conflicts: %{name}-compiler < %{version}
Obsoletes: %{name}-javanano < 3.6.0
%description java
This package contains Java Protocol Buffers runtime library.
%package javalite
Summary: Java Protocol Buffers lite runtime library
BuildArch: noarch
%description javalite
This package contains Java Protocol Buffers lite runtime library.
%package java-util
Summary: Utilities for Protocol Buffers
BuildArch: noarch
@ -214,15 +180,6 @@ BuildArch: noarch
%description javadoc
This package contains the API documentation for %{name}-java.
%package javanano
Summary: Protocol Buffer JavaNano API
BuildArch: noarch
%description javanano
JavaNano is a special code generator and runtime
library designed specially for resource-restricted
systems, like Android.
%package parent
Summary: Protocol Buffer Parent POM
BuildArch: noarch
@ -230,26 +187,49 @@ BuildArch: noarch
%description parent
Protocol Buffer Parent POM.
%package bom
Summary: Protocol Buffer BOM POM
BuildArch: noarch
%description bom
Protocol Buffer BOM POM.
%endif
%package emacs
Summary: Emacs mode for Google Protocol Buffers descriptions
BuildArch: noarch
Requires: emacs-filesystem >= %{_emacs_version}
Obsoletes: protobuf-emacs-el < 3.6.1-4
%description emacs
This package contains syntax highlighting for Google Protocol Buffers
descriptions in the Emacs editor.
%prep
%setup -q -n %{name}-%{version}%{?rcver} -a 3 -a 4
%autopatch -p1
mv googlemock-release-1.7.0 gmock
mv googletest-release-1.7.0 gmock/gtest
%setup -q -n %{name}-%{version}%{?rcver} -a 3
# IoTest.LargeOutput fails sometimes if not enough memory is available
# https://github.com/protocolbuffers/protobuf/issues/8082
%patch1 -p1
%patch2 -p1
mv googletest-5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081/* third_party/googletest/
find -name \*.cc -o -name \*.h | xargs chmod -x
chmod 644 examples/*
%if %{with java}
%pom_remove_parent java/pom.xml
%pom_remove_dep org.easymock:easymockclassextension java/pom.xml java/*/pom.xml
%pom_remove_dep org.easymock:easymockclassextension java/pom.xml java/core/pom.xml java/lite/pom.xml java/util/pom.xml
%pom_remove_dep com.google.truth:truth java/pom.xml java/core/pom.xml java/lite/pom.xml java/util/pom.xml
%pom_remove_dep com.google.errorprone:error_prone_annotations java/util/pom.xml
%pom_remove_dep com.google.guava:guava-testlib java/pom.xml java/util/pom.xml
# These use easymockclassextension
rm java/core/src/test/java/com/google/protobuf/ServiceTest.java
#rm -r java/core/src/test
# used by https://github.com/googlei18n/libphonenumber
%pom_xpath_inject "pom:project/pom:modules" "<module>../javanano</module>" java
%pom_remove_parent javanano
%pom_remove_dep org.easymock:easymockclassextension javanano
# These use truth or error_prone_annotations or guava-testlib
rm java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java
rm java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java
rm java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java
rm java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java
rm java/core/src/test/java/com/google/protobuf/TextFormatTest.java
rm -r java/util/src/test/java/com/google/protobuf/util
rm -r java/util/src/main/java/com/google/protobuf/util
# Make OSGi dependency on sun.misc package optional
%pom_xpath_inject "pom:configuration/pom:instructions" "<Import-Package>sun.misc;resolution:=optional,*</Import-Package>" java/core
@ -259,9 +239,11 @@ rm java/core/src/test/java/com/google/protobuf/ServiceTest.java
# This test is incredibly slow on arm
# https://github.com/google/protobuf/issues/2389
%ifarch %{arm}
%ifarch %{arm} s390x
mv java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java \
java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.slow
mv java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java \
java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java.slow
%endif
%endif
@ -274,53 +256,50 @@ export PTHREAD_LIBS="-lpthread"
./autogen.sh
%configure
make %{?_smp_mflags}
# -Wno-error=type-limits:
# https://bugzilla.redhat.com/show_bug.cgi?id=1838470
# https://github.com/protocolbuffers/protobuf/issues/7514
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95148
# (also set in %%check)
%make_build CXXFLAGS="%{build_cxxflags} -Wno-error=type-limits"
%if %{with python2}
pushd python
%py2_build
popd
%endif
%if %{with python3}
%if %{with python}
pushd python
%py3_build
popd
%endif
%if %{with java}
%ifarch s390x %{arm}
export MAVEN_OPTS=-Xmx1024m
%endif
%mvn_build -s -- -f java/pom.xml
%endif
emacs -batch -f batch-byte-compile editors/protobuf-mode.el
%{_emacs_bytecompile} editors/protobuf-mode.el
%check
# TODO: failures; get them fixed and remove || :
# https://github.com/google/protobuf/issues/631
make %{?_smp_mflags} check || :
# Java tests fail on s390x
%ifarch s390x
fail=0
%else
fail=1
%endif
%make_build check CXXFLAGS="%{build_cxxflags} -Wno-error=type-limits" || exit $fail
%install
make %{?_smp_mflags} install DESTDIR=%{buildroot} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p"
%make_install %{?_smp_mflags} STRIPBINARIES=no INSTALL="%{__install} -p" CPPROG="cp -p"
find %{buildroot} -type f -name "*.la" -exec rm -f {} \;
%if %{with python2}
%if %{with python}
pushd python
#python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1
%py2_install
find %{buildroot}%{python2_sitelib} -name \*.py |
xargs sed -i -e '1{\@^#!@d}'
popd
%endif
%if %{with python3}
pushd python
#python ./setup.py install --root=%{buildroot} --single-version-externally-managed --record=INSTALLED_FILES --optimize=1
%py3_install
find %{buildroot}%{python3_sitelib} -name \*.py |
xargs sed -i -e '1{\@^#!@d}'
popd
%endif
install -p -m 644 -D %{SOURCE1} %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/proto.vim
install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/proto.vim
@ -328,26 +307,26 @@ install -p -m 644 -D editors/proto.vim %{buildroot}%{_datadir}/vim/vimfiles/synt
%mvn_install
%endif
mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
mkdir -p $RPM_BUILD_ROOT%{emacs_startdir}
install -p -m 0644 editors/protobuf-mode.el $RPM_BUILD_ROOT%{emacs_lispdir}
install -p -m 0644 editors/protobuf-mode.elc $RPM_BUILD_ROOT%{emacs_lispdir}
install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir}
mkdir -p %{buildroot}%{_emacs_sitelispdir}/%{name}
install -p -m 0644 editors/protobuf-mode.el %{buildroot}%{_emacs_sitelispdir}/%{name}
install -p -m 0644 editors/protobuf-mode.elc %{buildroot}%{_emacs_sitelispdir}/%{name}
mkdir -p %{buildroot}%{_emacs_sitestartdir}
install -p -m 0644 %{SOURCE2} %{buildroot}%{_emacs_sitestartdir}
%ldconfig_scriptlets
%ldconfig_scriptlets lite
%ldconfig_scriptlets compiler
%files
%{_libdir}/libprotobuf.so.15*
%doc CHANGES.txt CONTRIBUTORS.txt README.md
%license LICENSE
%{_libdir}/libprotobuf.so.25*
%files compiler
%{_bindir}/protoc
%{_libdir}/libprotoc.so.15*
%doc README.md
%license LICENSE
%{_bindir}/protoc
%{_libdir}/libprotoc.so.25*
%files devel
%dir %{_includedir}/google
@ -357,12 +336,16 @@ install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir}
%{_libdir}/pkgconfig/protobuf.pc
%doc examples/add_person.cc examples/addressbook.proto examples/list_people.cc examples/Makefile examples/README.md
%files emacs
%{_emacs_sitelispdir}/%{name}/
%{_emacs_sitestartdir}/protobuf-init.el
%files static
%{_libdir}/libprotobuf.a
%{_libdir}/libprotoc.a
%files lite
%{_libdir}/libprotobuf-lite.so.15*
%{_libdir}/libprotobuf-lite.so.25*
%files lite-devel
%{_libdir}/libprotobuf-lite.so
@ -371,22 +354,12 @@ install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir}
%files lite-static
%{_libdir}/libprotobuf-lite.a
%if %{with python2}
%files -n python2-protobuf
%dir %{python2_sitelib}/google
%{python2_sitelib}/google/protobuf/
%{python2_sitelib}/protobuf-%{version}%{?rcver}-py2.?.egg-info/
%{python2_sitelib}/protobuf-%{version}%{?rcver}-py2.?-nspkg.pth
%doc python/README.md
%doc examples/add_person.py examples/list_people.py examples/addressbook.proto
%endif
%if %{with python3}
%if %{with python}
%files -n python%{python3_pkgversion}-protobuf
%dir %{python3_sitelib}/google
%{python3_sitelib}/google/protobuf/
%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.?.egg-info/
%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.?-nspkg.pth
%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.*.egg-info/
%{python3_sitelib}/protobuf-%{version}%{?rcver}-py3.*-nspkg.pth
%doc python/README.md
%doc examples/add_person.py examples/list_people.py examples/addressbook.proto
%endif
@ -395,13 +368,6 @@ install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir}
%{_datadir}/vim/vimfiles/ftdetect/proto.vim
%{_datadir}/vim/vimfiles/syntax/proto.vim
%files emacs
%{emacs_startdir}/protobuf-init.el
%{emacs_lispdir}/protobuf-mode.elc
%files emacs-el
%{emacs_lispdir}/protobuf-mode.el
%if %{with java}
%files java -f .mfiles-protobuf-java
%doc examples/AddPerson.java examples/ListPeople.java
@ -413,35 +379,122 @@ install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{emacs_startdir}
%files javadoc -f .mfiles-javadoc
%license LICENSE
%files javanano -f .mfiles-protobuf-javanano
%doc javanano/README.md
%files parent -f .mfiles-protobuf-parent
%license LICENSE
%files parent -f .mfiles-protobuf-parent
%files bom -f .mfiles-protobuf-bom
%license LICENSE
%files javalite -f .mfiles-protobuf-javalite
%license LICENSE
%endif
%changelog
* Mon Mar 21 2022 Adrian Reber <areber@redhat.com> - 3.5.0-15
- Applied patch for for CVE-2021-22570 (#2050494)
* Wed Mar 23 2022 Adrian Reber <areber@redhat.com> - 3.14.0-13
- Rebuilt for test fixes
* Thu May 28 2020 Adrian Reber <areber@redhat.com> - 3.5.0-13
- Rebuild
* Tue Mar 22 2022 Adrian Reber <areber@redhat.com> - 3.14.0-12
- Rebuilt for test fixes
* Tue May 26 2020 Adrian Reber <areber@redhat.com> - 3.5.0-10
- Rebuild
* Tue Mar 08 2022 Adrian Reber <areber@redhat.com> - 3.14.0-11
- Applied patch for for CVE-2021-22570 (#2055641)
* Thu Apr 09 2020 Adrian Reber <areber@redhat.com> - 3.5.0-8
- Rebuild
* Wed Feb 23 2022 Adrian Reber <areber@redhat.com> - 3.14.0-9
- Rebuilt for errata
* Thu Jul 12 2018 Adrian Reber <areber@redhat.com> - 3.5.0-7
- Build without python2 subpackage
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 3.14.0-8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Jun 20 2018 Adrian Reber <areber@redhat.com> - 3.5.0-6
- Only BR python-google-apputils on Fedora
* Mon Jul 26 2021 Adrian Reber <areber@redhat.com> - 3.14.0-7
- Disabled Java subpackages
* Wed May 30 2018 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5.0-5
- Build without -java supbackage
* Thu May 06 2021 Adrian Reber <adrian@lisas.de> - 3.14.0-6
- Reintroduce the emacs subpackage to avoid file conflicts between
protobuf-compiler.x86_64 and protobuf-compiler.i686
- Disable LTO to fix annobin errors
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.14.0-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Mar 30 2021 Jonathan Wakely <jwakely@redhat.com> - 3.14.0-3
- Rebuilt for removed libstdc++ symbol (#1937698)
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.14.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jan 04 2021 Adrian Reber <adrian@lisas.de> - 3.14.0-1
- Update to 3.14.0
* Wed Aug 26 2020 Charalampos Stratakis <cstratak@redhat.com> - 3.13.0-1
- Update to 3.13.0
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.3-4
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Sat Jul 11 2020 Jiri Vanek <jvanek@redhat.com> - 3.12.3-2
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
* Fri Jun 19 2020 Adrian Reber <adrian@lisas.de> - 3.12.3-2
- Update to 3.12.3
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.11.4-2
- Rebuilt for Python 3.9
* Tue Mar 31 2020 Adrian Reber <adrian@lisas.de> - 3.11.4-1
- Update to 3.11.4
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.11.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Dec 18 2019 Adrian Reber <adrian@lisas.de> - 3.11.2-1
- Update to 3.11.2
* Tue Nov 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.6.1-9
- Drop python2-protobuf (#1765879)
* Sat Oct 26 2019 Orion Poplawski <orion@nwra.com> - 3.6.1-8
- Drop obsolete BR on python-google-apputils
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 3.6.1-7
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.6.1-6
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed May 8 2019 Orion Poplawski <orion@nwra.com> - 3.6.1-4
- Update emacs packaging to comply with guidelines
* Wed Feb 27 2019 Orion Poplawski <orion@nwra.com> - 3.6.1-3
- Update googletest to 1.8.1 to re-enable tests
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Oct 23 2018 Felix Kaechele <heffer@fedoraproject.org> - 3.6.1-1
- update to 3.6.1
- obsolete javanano subpackage; discontinued upstream
* Fri Jul 27 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.5.0-8
- Rebuild for new binutils
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.0-6
- Rebuilt for Python 3.7
* Wed Feb 21 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.5.0-5
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.5.0-4
- Escape macros in %%changelog

4
rpminspect.yaml Normal file
View File

@ -0,0 +1,4 @@
---
annocheck:
jobs:
- hardened: --verbose --skip-lto

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081.zip) = ba904f3a0b606357873db938986b0abf37425a65501340fe81f73f9c5d05f542429662fe71c0b10e4796cb6335ae9a687fc9fb21084f2f5bfd2ede79977f5821
SHA512 (protobuf-3.14.0-all.tar.gz) = 9dabba81119cb6196ef5de382a1032c57f6e69038f4dce0156f8671b98e51bb5095915fb6d05bb5a8ad8b17b559e652e1e9a392dd30c7ed8dcf1d986c137be11

12
tests/Makefile Normal file
View File

@ -0,0 +1,12 @@
all: add_person_cpp
protoc_middleman: addressbook.proto
protoc --cpp_out=. --python_out=. addressbook.proto
add_person_cpp: add_person.cc protoc_middleman
pkg-config --cflags protobuf # fails if protobuf is not installed
c++ -std=c++11 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
clean:
rm -f addressbook_pb2.py addressbook.pb.cc addressbook.pb.h add_person_cpp data
rm -rf __pycache__

55
tests/add_person.cc Normal file
View File

@ -0,0 +1,55 @@
// Based on the examples from the protobuf release tarball
#include <ctime>
#include <fstream>
#include <google/protobuf/util/time_util.h>
#include <iostream>
#include <string>
#include "addressbook.pb.h"
using namespace std;
using google::protobuf::util::TimeUtil;
// Main function: Reads the entire address book from a file,
// adds one person based on user input, then writes it back out to the same
// file.
int main(int argc, char* argv[]) {
// Verify that the version of the library that we linked against is
// compatible with the version of the headers we compiled against.
GOOGLE_PROTOBUF_VERIFY_VERSION;
if (argc != 6) {
cerr << "Usage: " << argv[0] << " ADDRESS_BOOK_FILE ID NAME EMAIL PHONE" << endl;
return -1;
}
tutorial::AddressBook address_book;
fstream input(argv[1], ios::in | ios::binary);
tutorial::Person* person = address_book.add_people();
person->set_id(atoi(argv[2]));
person->set_name(argv[3]);
person->set_email(argv[4]);
tutorial::Person::PhoneNumber* phone_number = person->add_phones();
phone_number->set_number(argv[5]);
phone_number->set_type(tutorial::Person::HOME);
*person->mutable_last_updated() = TimeUtil::SecondsToTimestamp(42);
{
// Write the new address book back to disk.
fstream output(argv[1], ios::out | ios::trunc | ios::binary);
if (!address_book.SerializeToOstream(&output)) {
cerr << "Failed to write address book." << endl;
return -1;
}
}
// Optional: Delete all global objects allocated by libprotobuf.
google::protobuf::ShutdownProtobufLibrary();
return 0;
}

51
tests/addressbook.proto Normal file
View File

@ -0,0 +1,51 @@
// See README.txt for information and build instructions.
//
// Note: START and END tags are used in comments to define sections used in
// tutorials. They are not part of the syntax for Protocol Buffers.
//
// To get an in-depth walkthrough of this file and the related examples, see:
// https://developers.google.com/protocol-buffers/docs/tutorials
// [START declaration]
syntax = "proto3";
package tutorial;
import "google/protobuf/timestamp.proto";
// [END declaration]
// [START java_declaration]
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
// [END java_declaration]
// [START csharp_declaration]
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
// [END csharp_declaration]
// [START messages]
message Person {
string name = 1;
int32 id = 2; // Unique ID number for this person.
string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
string number = 1;
PhoneType type = 2;
}
repeated PhoneNumber phones = 4;
google.protobuf.Timestamp last_updated = 5;
}
// Our address book file is just one of these.
message AddressBook {
repeated Person people = 1;
}
// [END messages]

27
tests/list_people.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
# Based on the examples from the protobuf release tarball
import addressbook_pb2
import sys
# Iterates though all people in the AddressBook and prints info about them.
def ListPeople(address_book):
for person in address_book.people:
print(f'{person.id},{person.name},{person.email},{person.phones[0].number}')
# Main procedure: Reads the entire address book from a file and prints all
# the information inside.
if len(sys.argv) != 2:
print("Usage:", sys.argv[0], "ADDRESS_BOOK_FILE")
sys.exit(-1)
address_book = addressbook_pb2.AddressBook()
# Read the existing address book.
with open(sys.argv[1], "rb") as f:
address_book.ParseFromString(f.read())
ListPeople(address_book)

17
tests/run-simple-test.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -ex
uname -a
make clean all
./add_person_cpp data 13 JustName emailAddress 012344444
OUT=$(./list_people.py data)
if [ "$OUT" != "13,JustName,emailAddress,012344444" ]; then
echo "FAIL"
exit 1
fi
make clean
exit 0

18
tests/tests.yml Normal file
View File

@ -0,0 +1,18 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- make
- gcc-c++
- python3
- protobuf-devel
- protobuf-compiler
- python3-protobuf
- pkgconf-pkg-config
tests:
- simple:
dir: .
run: ./run-simple-test.sh