From 60c0b795e48e018cfbe935286d8da635c72a6723 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Sun, 24 Apr 2022 10:04:23 +0800 Subject: [PATCH] build: fix inplace-selinux check error --- 0001-fix-inplace-selinux-error.patch | 71 ++++++++++++++++++++++++++++ sed.spec | 14 +++++- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 0001-fix-inplace-selinux-error.patch diff --git a/0001-fix-inplace-selinux-error.patch b/0001-fix-inplace-selinux-error.patch new file mode 100644 index 0000000..467f215 --- /dev/null +++ b/0001-fix-inplace-selinux-error.patch @@ -0,0 +1,71 @@ +From 026bf901ac6976d2afe970741ed9042544e21090 Mon Sep 17 00:00:00 2001 +From: mahailiang +Date: Tue, 2 Feb 2021 20:16:15 +0800 +Subject: [PATCH] fix inplace-selinux error + +--- + sed/sed.c | 18 ++++++++++++++++++ + testsuite/inplace-selinux.sh | 5 +++++ + 2 files changed, 23 insertions(+) + +diff --git a/sed/sed.c b/sed/sed.c +index e5910cf..a47b7f9 100644 +--- a/sed/sed.c ++++ b/sed/sed.c +@@ -28,6 +28,7 @@ + #include "getopt.h" + #include "progname.h" + #include "version.h" ++#include + + #include "version-etc.h" + +@@ -124,6 +125,22 @@ General help using GNU software: .\n")); + fprintf(out, _("E-mail bug reports to: <%s>.\n"), PACKAGE_BUGREPORT); + } + ++static void ++selinux_support (void) ++{ ++ putchar ('\n'); ++#if HAVE_SELINUX_SELINUX_H ++ puts (_("This sed program was built with SELinux support.")); ++ if (is_selinux_enabled()) ++ puts (_("SELinux is enabled on this system.")); ++ else ++ puts (_("SELinux is disabled on this system.")); ++#else ++ puts (_("This sed program was built without SELinux support.")); ++#endif ++ putchar ('\n'); ++} ++ + _Noreturn static void + usage(int status) + { +@@ -370,6 +387,7 @@ main (int argc, char **argv) + case 'v': + version_etc(stdout, program_name, PACKAGE_NAME, Version, + AUTHORS, (char *) NULL); ++ selinux_support (); + contact(false); + ck_fclose (NULL); + exit (EXIT_SUCCESS); +diff --git a/testsuite/inplace-selinux.sh b/testsuite/inplace-selinux.sh +index 47383a9..06e7f8d 100755 +--- a/testsuite/inplace-selinux.sh ++++ b/testsuite/inplace-selinux.sh +@@ -18,6 +18,11 @@ + print_ver_ sed + require_selinux_ + ++sed --version | grep -q "with SELinux" \ ++ || skip_ "sed built without SELinux support" ++sed --version | grep -q "^SELinux is enabled" \ ++ || skip_ "sed reports SELinux is disabled on this system" ++ + fail=0 + + touch a || framework_failure_ +-- +2.18.2 diff --git a/sed.spec b/sed.spec index d014c6e..413538a 100644 --- a/sed.spec +++ b/sed.spec @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- - +%define anolis_release .0.1 Summary: A GNU stream text editor Name: sed Version: 4.5 -Release: 5%{?dist} +Release: 5%{anolis_release}%{?dist} License: GPLv3+ Group: Applications/Text URL: http://sed.sourceforge.net/ @@ -12,6 +12,11 @@ Source1: http://sed.sourceforge.net/sedfaq.txt Patch0: sed-4.2.2-binary_copy_args.patch Patch2: sed-fuse.patch Patch3: sed-selinux-testsuite.patch + +# Add by Anolis +Patch1000: 0001-fix-inplace-selinux-error.patch +# End + BuildRequires: glibc-devel, libselinux-devel, libacl-devel, automake, autoconf BuildRequires: perl-Getopt-Long Requires(post): /sbin/install-info @@ -34,6 +39,7 @@ specified in a script file or from the command line. %patch0 -p1 -b .copy %patch2 -p1 %patch3 -p2 +%patch1000 -p1 %build %configure --without-included-regex @@ -73,6 +79,10 @@ fi %{_mandir}/man*/* %changelog +* Sun Apr 24 2022 Mahailiang - 4.5-5.0.1 +- fix testsuite/inplace-selinux.sh check error +- Sync from https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35997 + * Tue Oct 05 2021 Jakub Martisko - 4.5-5 - Minor cleanup - remove unused patch from the spec file too (related to 4.5-3) - Resolves: rhbz#1869253 -- Gitee