commit 96f66abc818c2889e55aba2c3e41084621ee7f8a Author: MSVSphere Packaging Team Date: Wed Mar 15 18:11:03 2023 +0300 import libkeepalive-0.3-16.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fdad197 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libkeepalive-0.3.tar.gz diff --git a/.libkeepalive.metadata b/.libkeepalive.metadata new file mode 100644 index 0000000..566d9dd --- /dev/null +++ b/.libkeepalive.metadata @@ -0,0 +1 @@ +ab404ff0ef38a11ddba1a063ed831b166c61d2f3 SOURCES/libkeepalive-0.3.tar.gz diff --git a/SOURCES/0001-Add-vim-modelines-to-source-files.patch b/SOURCES/0001-Add-vim-modelines-to-source-files.patch new file mode 100644 index 0000000..8517b7f --- /dev/null +++ b/SOURCES/0001-Add-vim-modelines-to-source-files.patch @@ -0,0 +1,35 @@ +From 6b41a8a337db852ec47635fcd724d73c9e1046c1 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 25 Nov 2016 11:34:18 +0100 +Subject: [PATCH] Add vim modelines to source files + +This automatically sets up vim to use two space indenting if modelines +is active. + +Signed-off-by: Phil Sutter +--- + src/libkeepalive.c | 1 + + test/test.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/libkeepalive.c b/src/libkeepalive.c +index a08bd98abe7b8..06b66ca7a8ea5 100644 +--- a/src/libkeepalive.c ++++ b/src/libkeepalive.c +@@ -1,3 +1,4 @@ ++/* vim: set ts=2 sw=2 et: */ + /* + _ _ _ _ _ _ + | (_) |__ | | _____ ___ _ __ __ _| (_)_ _____ +diff --git a/test/test.c b/test/test.c +index 756d7ae631f4a..c793225eaa820 100644 +--- a/test/test.c ++++ b/test/test.c +@@ -1,3 +1,4 @@ ++/* vim: set ts=2 sw=2 et: */ + /* + _ _ _ _ _ _ + | (_) |__ | | _____ ___ _ __ __ _| (_)_ _____ +-- +2.10.0 + diff --git a/SOURCES/0002-test-test.c-Whitespace-cleanup.patch b/SOURCES/0002-test-test.c-Whitespace-cleanup.patch new file mode 100644 index 0000000..83ce786 --- /dev/null +++ b/SOURCES/0002-test-test.c-Whitespace-cleanup.patch @@ -0,0 +1,44 @@ +From ce70d7a39f384c526e0a0e5fdfd1d3ed523f4942 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 25 Nov 2016 11:36:14 +0100 +Subject: [PATCH] test/test.c: Whitespace cleanup + +Signed-off-by: Phil Sutter +--- + test/test.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/test/test.c b/test/test.c +index c793225eaa820..224c1b4944fc5 100644 +--- a/test/test.c ++++ b/test/test.c +@@ -69,7 +69,7 @@ int main() + } + printf("TCP_KEEPCNT = %d\n", optval); + #endif +- ++ + #ifdef TCP_KEEPIDLE + if(getsockopt(s, SOL_TCP, TCP_KEEPIDLE, &optval, &optlen) < 0) { + perror("getsockopt()"); +@@ -78,7 +78,7 @@ int main() + } + printf("TCP_KEEPIDLE = %d\n", optval); + #endif +- ++ + #ifdef TCP_KEEPINTVL + if(getsockopt(s, SOL_TCP, TCP_KEEPINTVL, &optval, &optlen) < 0) { + perror("getsockopt()"); +@@ -88,7 +88,7 @@ int main() + printf("TCP_KEEPINTVL = %d\n", optval); + #endif + } +- ++ + close(s); + + exit(EXIT_SUCCESS); +-- +2.10.0 + diff --git a/SOURCES/0003-test-Implement-self-test-functionality.patch b/SOURCES/0003-test-Implement-self-test-functionality.patch new file mode 100644 index 0000000..47a69ee --- /dev/null +++ b/SOURCES/0003-test-Implement-self-test-functionality.patch @@ -0,0 +1,114 @@ +From c5e5b8415e9c91d132678dcfccde8df848ee70c8 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 25 Nov 2016 11:38:02 +0100 +Subject: [PATCH] test: Implement self-test functionality + +This allows to run 'test' unattended by setting environment variable +SELFTEST=on. Instead of printing the settings libkeepalive should have +changed, it uses the input values still present in environment to assert +them being set correctly. + +Signed-off-by: Phil Sutter +--- + test/test.c | 42 ++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 38 insertions(+), 4 deletions(-) + +diff --git a/test/test.c b/test/test.c +index 224c1b4944fc5..7eaaaed2e9840 100644 +--- a/test/test.c ++++ b/test/test.c +@@ -32,14 +32,23 @@ + */ + + #define _GNU_SOURCE ++#include + #include + #include ++#include + #include + #include + #include + #include + #include + ++#define assert(x) do { \ ++ if (!(x)) { \ ++ printf("%s:%d: assertion '" #x "' failed!\n", __FILE__, __LINE__); \ ++ exit(EXIT_FAILURE); \ ++ } \ ++} while (0) ++ + int main(void); + + int main() +@@ -47,6 +56,11 @@ int main() + int s; + int optval; + socklen_t optlen = sizeof(optval); ++ const char *env; ++ bool selftest = false; ++ ++ env = getenv("SELFTEST"); ++ selftest = env && !strcasecmp(env, "on"); + + if((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + perror("socket()"); +@@ -58,7 +72,12 @@ int main() + close(s); + exit(EXIT_FAILURE); + } +- printf("SO_KEEPALIVE is %s\n", (optval ? "ON" : "OFF")); ++ if (selftest) { ++ env = getenv("KEEPALIVE"); ++ assert((env && !strcasecmp(env, "off")) ^ optval); ++ } else { ++ printf("SO_KEEPALIVE is %s\n", (optval ? "ON" : "OFF")); ++ } + + if(optval) { + #ifdef TCP_KEEPCNT +@@ -67,7 +86,12 @@ int main() + close(s); + exit(EXIT_FAILURE); + } +- printf("TCP_KEEPCNT = %d\n", optval); ++ if (selftest) { ++ env = getenv("KEEPCNT"); ++ assert(!env || atoi(env) == optval); ++ } else { ++ printf("TCP_KEEPCNT = %d\n", optval); ++ } + #endif + + #ifdef TCP_KEEPIDLE +@@ -76,7 +100,12 @@ int main() + close(s); + exit(EXIT_FAILURE); + } +- printf("TCP_KEEPIDLE = %d\n", optval); ++ if (selftest) { ++ env = getenv("KEEPIDLE"); ++ assert(!env || atoi(env) == optval); ++ } else { ++ printf("TCP_KEEPIDLE = %d\n", optval); ++ } + #endif + + #ifdef TCP_KEEPINTVL +@@ -85,7 +114,12 @@ int main() + close(s); + exit(EXIT_FAILURE); + } +- printf("TCP_KEEPINTVL = %d\n", optval); ++ if (selftest) { ++ env = getenv("KEEPINTVL"); ++ assert(!env || atoi(env) == optval); ++ } else { ++ printf("TCP_KEEPINTVL = %d\n", optval); ++ } + #endif + } + +-- +2.10.0 + diff --git a/SOURCES/0004-Makefile-Make-self-test-accessible-by-make-test.patch b/SOURCES/0004-Makefile-Make-self-test-accessible-by-make-test.patch new file mode 100644 index 0000000..84b5e57 --- /dev/null +++ b/SOURCES/0004-Makefile-Make-self-test-accessible-by-make-test.patch @@ -0,0 +1,48 @@ +From 22820938a43871b7cd634767809faec31d139f27 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 25 Nov 2016 11:45:05 +0100 +Subject: [PATCH] Makefile: Make self-test accessible by 'make test' + +This will call 'test' three times: The first call makes sure that +KEEPALIVE=off is respected, the last two calls check that environment +variables KEEPCNT, KEEPIDLE and KEEPINTVL are applied as expected. + +Signed-off-by: Phil Sutter +--- + Makefile | 3 +++ + test/Makefile | 6 ++++++ + 2 files changed, 9 insertions(+) + +diff --git a/Makefile b/Makefile +index 524d6a98c8329..01622771d73c5 100644 +--- a/Makefile ++++ b/Makefile +@@ -13,6 +13,9 @@ default: + cp src/libkeepalive.so libkeepalive.so + strip -s libkeepalive.so + ++test: default ++ make -C test/ runtest ++ + clean: + make -C src/ clean + make -C test/ clean +diff --git a/test/Makefile b/test/Makefile +index 2a0f6e2780d5e..6baf822c2338d 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -11,5 +11,11 @@ CC=gcc + + default: test + ++TENV = LD_PRELOAD=../libkeepalive.so SELFTEST=on ++runtest: ++ ${TENV} KEEPALIVE=off ./test ++ ${TENV} KEEPCNT=13 KEEPIDLE=23 KEEPINTVL=42 ./test ++ ${TENV} KEEPCNT=42 KEEPIDLE=13 KEEPINTVL=23 ./test ++ + clean: + rm -f test +-- +2.10.0 + diff --git a/SOURCES/0005-Makefile-Allow-setting-custom-compiler-flags.patch b/SOURCES/0005-Makefile-Allow-setting-custom-compiler-flags.patch new file mode 100644 index 0000000..5ba0536 --- /dev/null +++ b/SOURCES/0005-Makefile-Allow-setting-custom-compiler-flags.patch @@ -0,0 +1,49 @@ +From 910e5ec42b7d04e4d7e650f8bd20afd06f418ae5 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Fri, 25 Nov 2016 12:22:13 +0100 +Subject: [PATCH] Makefile: Allow setting custom compiler flags + +This allows to override CC variable and to extend CFLAGS, LDFLAGS and +LDLIBS variables. + +Signed-off-by: Phil Sutter +--- + src/Makefile | 8 ++++---- + test/Makefile | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/Makefile b/src/Makefile +index b8b0188502189..19e3785665a86 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -7,10 +7,10 @@ + # + # (C) Fabio Busatto + +-CC=gcc +-CFLAGS=-fPIC -ansi -pedantic -Wall +-LDFLAGS=-shared -Wl,-soname,libkeepalive.so +-LDLIBS=-ldl ++CC := gcc ++CFLAGS += -fPIC -ansi -pedantic -Wall ++LDFLAGS += -shared -Wl,-soname,libkeepalive.so ++LDLIBS += -ldl + + default: libkeepalive.so + +diff --git a/test/Makefile b/test/Makefile +index 6baf822c2338d..6a279a0ac6b94 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -7,7 +7,7 @@ + # + # (C) Fabio Busatto + +-CC=gcc ++CC := gcc + + default: test + +-- +2.10.0 + diff --git a/SPECS/libkeepalive.spec b/SPECS/libkeepalive.spec new file mode 100644 index 0000000..3e3d7ae --- /dev/null +++ b/SPECS/libkeepalive.spec @@ -0,0 +1,104 @@ +Name: libkeepalive +Version: 0.3 +Release: 16%{?dist} +Summary: Enable TCP keepalive in dynamic binaries +URL: http://libkeepalive.sourceforge.net/ + +BuildRequires: gcc +BuildRequires: make + +License: MIT +Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz + +# All patches sent to the upstream maintainer directly via email. +Patch1: 0001-Add-vim-modelines-to-source-files.patch +Patch2: 0002-test-test.c-Whitespace-cleanup.patch +Patch3: 0003-test-Implement-self-test-functionality.patch +Patch4: 0004-Makefile-Make-self-test-accessible-by-make-test.patch +Patch5: 0005-Makefile-Allow-setting-custom-compiler-flags.patch + +%description +libkeepalive is a library that enables tcp keepalive features in glibc based +binary dynamic executables, without any change in the original program. + +%prep +%autosetup -p1 + +%build +export CFLAGS="%{optflags}" +export LDFLAGS="%{__global_ldflags}" +%make_build + +%check +make test + +%install +# install the file in src not topdir - the latter is stripped already +install -p -m 0755 -D src/libkeepalive.so %{buildroot}%{_libdir}/libkeepalive.so + +%files +%license LICENSE +%doc README +%{_libdir}/libkeepalive.so + +%changelog +* Wed Mar 15 2023 MSVSphere Packaging Team - 0.3-16 +- Rebuilt for MSVSphere 9.1. + +* Mon Aug 09 2021 Mohan Boddu - 0.3-16 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Apr 16 2021 Mohan Boddu - 0.3-15 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 0.3-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 0.3-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jan 29 2020 Fedora Release Engineering - 0.3-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 0.3-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 0.3-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.3-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Feb 09 2018 Igor Gnatenko - 0.3-8 +- Escape macros in %%changelog + +* Wed Feb 07 2018 Fedora Release Engineering - 0.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 0.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 0.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 05 2016 Phil Sutter - 0.3-3 +- Use %%autosetup flag '-p1' instead of '-S git' to get rid of git dependency. +- Use %%license macro in %%files section. +- Added comment about included patches' upstream status. + +* Fri Nov 25 2016 Phil Sutter - 0.3-2 +- Add missing build requirement: gcc. +- Add source code patches to facilitate following changes. +- Patches managed in git, so add git as another build requirement. +- Respect build system compiler flags. +- Use %%make_build instead of plain make in %%build. +- Add %%check target which performs unattended runtime test. +- Use -D install flag instead of manual mkdir. + +* Thu Nov 17 2016 Phil Sutter - 0.3-1 +- Initial packaging. +