From 8fd65748589bb1e0b671d4a291521bfba1664c5c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 21 Apr 2022 03:01:22 +0200 Subject: Remove unused public zlib include from libapt fileutl.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our public interface doesn't use zlib for quite a while now so lets drop the last remnants as hopefully nobody depends on us bringing it in… Unlike our own private lib for transitive provision of unistd.h. References: 680b916ce7203a40ebd0a3882b9a71ca77278a67 --- apt-pkg/contrib/fileutl.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index dd16aa754..f4eefd7c2 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -28,9 +28,6 @@ #include #include -#include - - /* Define this for python-apt */ #define APT_HAS_GZIP 1 -- cgit v1.2.3-70-g09d2 From 320245536a7ad21606286d9dcf54acf3bdf096c6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 22 Apr 2022 17:05:36 +0200 Subject: Include our config.h in all C++ files to avoid ODR violations Some of our headers use APT_COMPILING_APT trickery to avoid exposing too broadly details we don't want external clients to know and make use of. The flip-side is that this can lead to different compilation units seeing different definitions if they aren't all using the same config. --- apt-pkg/contrib/proxy.cc | 2 ++ apt-pkg/metaindex.cc | 2 ++ apt-pkg/statechanges.cc | 2 ++ apt-private/private-json-hooks.cc | 1 + ftparchive/sources.cc | 2 ++ prepare-release | 5 +++++ test/interactive-helper/createdeb-cve-2020-27350.cc | 2 ++ test/interactive-helper/test_fileutl.cc | 2 ++ test/libapt/extracttar_test.cc | 2 ++ test/libapt/file-helpers.cc | 2 ++ test/libapt/gtest_runner.cc | 4 +++- 11 files changed, 25 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/proxy.cc b/apt-pkg/contrib/proxy.cc index 6dc3b0686..a99f44f49 100644 --- a/apt-pkg/contrib/proxy.cc +++ b/apt-pkg/contrib/proxy.cc @@ -7,6 +7,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc index fc03f3db0..97996b3f1 100644 --- a/apt-pkg/metaindex.cc +++ b/apt-pkg/metaindex.cc @@ -1,4 +1,6 @@ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/statechanges.cc b/apt-pkg/statechanges.cc index 45468e462..bbcde71d3 100644 --- a/apt-pkg/statechanges.cc +++ b/apt-pkg/statechanges.cc @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/apt-private/private-json-hooks.cc b/apt-private/private-json-hooks.cc index a17204dda..ddf1c89d6 100644 --- a/apt-private/private-json-hooks.cc +++ b/apt-private/private-json-hooks.cc @@ -5,6 +5,7 @@ * * SPDX-License-Identifier: GPL-2.0+ */ +#include #include #include diff --git a/ftparchive/sources.cc b/ftparchive/sources.cc index ee6efda05..a59224395 100644 --- a/ftparchive/sources.cc +++ b/ftparchive/sources.cc @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/prepare-release b/prepare-release index 39e2250bc..988ccabad 100755 --- a/prepare-release +++ b/prepare-release @@ -142,6 +142,11 @@ elif [ "$1" = 'post-build' ]; then FAILED=true fi + if [ "$(find -name '*.cc' ! -name 'tagfile-keys.cc' -exec grep --files-without-match '^#include $' '{}' \+ | wc -l)" != '0' ]; then + echo >&2 'WARNING: C++ files not including our config.h can cause ODR violations!' + find -name '*.cc' ! -name 'tagfile-keys.cc' -exec grep --files-without-match '^#include $' '{}' \+ >&2 + FAILED=true + fi if $REPORT_FAILURE && $FAILED; then exit 1 fi diff --git a/test/interactive-helper/createdeb-cve-2020-27350.cc b/test/interactive-helper/createdeb-cve-2020-27350.cc index 7fc9b0e55..57c53ae91 100644 --- a/test/interactive-helper/createdeb-cve-2020-27350.cc +++ b/test/interactive-helper/createdeb-cve-2020-27350.cc @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/test/interactive-helper/test_fileutl.cc b/test/interactive-helper/test_fileutl.cc index 6c29b748f..5569af1bf 100644 --- a/test/interactive-helper/test_fileutl.cc +++ b/test/interactive-helper/test_fileutl.cc @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/test/libapt/extracttar_test.cc b/test/libapt/extracttar_test.cc index ae74341e6..c945a0c68 100644 --- a/test/libapt/extracttar_test.cc +++ b/test/libapt/extracttar_test.cc @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/test/libapt/file-helpers.cc b/test/libapt/file-helpers.cc index 85fc6838e..bb7052b2a 100644 --- a/test/libapt/file-helpers.cc +++ b/test/libapt/file-helpers.cc @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/test/libapt/gtest_runner.cc b/test/libapt/gtest_runner.cc index 5620aa0bd..09fc55d92 100644 --- a/test/libapt/gtest_runner.cc +++ b/test/libapt/gtest_runner.cc @@ -1,10 +1,12 @@ -#include +#include #include #include #include #include +#include + int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); if (pkgInitSystem(*_config, _system) == false) -- cgit v1.2.3-70-g09d2