Trim net-snmp-config --cflags output

Resolves: #1309080

As result, Makefile.PL must not remove -Wall from CFLAGS, otherwise it gets -Werror=format-security without -Wformat and gcc fails.
This commit is contained in:
Jan Safranek 2016-02-24 12:26:08 +01:00
parent 2e7db8cf88
commit b1bfd06991
2 changed files with 141 additions and 2 deletions

134
net-snmp-5.7.3-cflags.patch Normal file
View File

@ -0,0 +1,134 @@
1309080 - net-snmp-config specifies redhat-hardened-cc1 in cflags and causes gcc failure without redhat-rpm-config
Don't remove -Wall in perl Makefiles - it would remove -Wformat and gcc would fail with
error: -Wformat-security ignored without -Wformat
+ there is one upstream patch below (to be removed on rebase)
diff -up net-snmp-5.7.3/perl/agent/default_store/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/default_store/Makefile.PL
--- net-snmp-5.7.3/perl/agent/default_store/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/perl/agent/default_store/Makefile.PL 2016-02-24 12:17:05.154209526 +0100
@@ -79,7 +79,7 @@ sub InitMakeParams {
$Params{'LIBS'} = "-L../../../snmplib/.libs -L../../../snmplib/ " . $Params{'LIBS'};
$Params{'CCFLAGS'} = "-I../../../include " . $Params{'CCFLAGS'};
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
die "You need to install net-snmp first (I can't find net-snmp-config)";
}
diff -up net-snmp-5.7.3/perl/agent/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/Makefile.PL
--- net-snmp-5.7.3/perl/agent/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/perl/agent/Makefile.PL 2016-02-24 12:17:05.154209526 +0100
@@ -92,7 +92,7 @@ sub InitMakeParams {
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . $Params{'LIBS'};
# $Params{'PREREQ_PM'} = {'NetSNMP::OID' => '0.1'};
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
die "You need to install net-snmp first (I can't find net-snmp-config)";
}
diff -up net-snmp-5.7.3/perl/agent/Support/Makefile.PL.cflags net-snmp-5.7.3/perl/agent/Support/Makefile.PL
--- net-snmp-5.7.3/perl/agent/Support/Makefile.PL.cflags 2016-02-24 12:17:16.291271579 +0100
+++ net-snmp-5.7.3/perl/agent/Support/Makefile.PL 2016-02-24 12:17:22.413305687 +0100
@@ -86,7 +86,7 @@ sub InitMakeParams {
$Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
die "You need to install net-snmp first (I can't find net-snmp-config)";
}
diff -up net-snmp-5.7.3/perl/ASN/Makefile.PL.cflags net-snmp-5.7.3/perl/ASN/Makefile.PL
--- net-snmp-5.7.3/perl/ASN/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/perl/ASN/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
@@ -86,7 +86,7 @@ sub InitMakeParams {
$Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
die "You need to install net-snmp first (I can't find net-snmp-config)";
}
diff -up net-snmp-5.7.3/perl/default_store/Makefile.PL.cflags net-snmp-5.7.3/perl/default_store/Makefile.PL
--- net-snmp-5.7.3/perl/default_store/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/perl/default_store/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
@@ -79,7 +79,7 @@ sub InitMakeParams {
$Params{'LIBS'} = "-L../../snmplib/.libs -L../../snmplib/ " . $Params{'LIBS'};
$Params{'CCFLAGS'} = "-I../../include " . $Params{'CCFLAGS'};
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
die "You need to install net-snmp first (I can't find net-snmp-config)";
}
diff -up net-snmp-5.7.3/perl/OID/Makefile.PL.cflags net-snmp-5.7.3/perl/OID/Makefile.PL
--- net-snmp-5.7.3/perl/OID/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/perl/OID/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
@@ -86,7 +86,7 @@ sub InitMakeParams {
# } else {
# $Params{'PREREQ_PM'} = {'SNMP' => '5.0'};
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if ($Params{'LIBS'} eq "" || $Params{'CCFLAGS'} eq "") {
die "You need to install net-snmp first (I can't find net-snmp-config)";
}
diff -up net-snmp-5.7.3/perl/SNMP/Makefile.PL.cflags net-snmp-5.7.3/perl/SNMP/Makefile.PL
--- net-snmp-5.7.3/perl/SNMP/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/perl/SNMP/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
@@ -98,7 +98,7 @@ sub InitMakeParams {
# } else {
# $Params{'PREREQ_PM'} = { 'NetSNMP::default_store' => 0.01 };
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if (!$ENV{'NETSNMP_PREFIX'}) {
$prefix = `$opts->{'nsconfig'} --prefix`;
chomp($prefix);
diff -up net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL.cflags net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL
--- net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL.cflags 2014-12-08 21:23:22.000000000 +0100
+++ net-snmp-5.7.3/perl/TrapReceiver/Makefile.PL 2016-02-24 12:17:05.155209532 +0100
@@ -124,7 +124,7 @@ sub InitMakeParams {
$Params{'LIBS'} = `$opts->{'nsconfig'} --libdir` . " $Params{'LIBS'}";
}
- $Params{'CCFLAGS'} =~ s/ -W(all|inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
+ $Params{'CCFLAGS'} =~ s/ -W(inline|strict-prototypes|write-strings|cast-qual|no-char-subscripts)//g; # ignore developer warnings
if ($Params{'CCFLAGS'} eq "") {
die "You need to install net-snmp first (I can't find net-snmp-config)";
}
commit 127274f8f27fba264a4c0f91190fd6f8037cdf21
Author: Jan Safranek <jsafranek@users.sourceforge.net>
Date: Wed Feb 24 10:14:21 2016 +0100
Trim output of net-snmp-config --cflags.
We should report CFLAGS needed to import and use Net-SNMP headers, not
CFLAGS used to compile actual Net-SNMP.
E.g. we should not report various distro fortify-source options.
diff --git a/net-snmp-config.in b/net-snmp-config.in
index 7e34944..f3bffe9 100644
--- a/net-snmp-config.in
+++ b/net-snmp-config.in
@@ -138,10 +138,10 @@ else
;;
#################################################### compile
--base-cflags)
- echo @CFLAGS@ @CPPFLAGS@ -I${NSC_INCLUDEDIR}
+ echo -I${NSC_INCLUDEDIR}
;;
--cflags|--cf*)
- echo @CFLAGS@ @DEVFLAGS@ @CPPFLAGS@ -I. -I${NSC_INCLUDEDIR}
+ echo @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR}
;;
--srcdir)
echo $NSC_SRCDIR

View File

@ -11,7 +11,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.7.3
Release: 8%{?dist}
Release: 9%{?dist}
Epoch: 1
License: BSD
@ -42,6 +42,7 @@ Patch9: net-snmp-5.7-agentx-crash.patch
Patch10: net-snmp-5.5-agentx-disconnect-crash.patch
Patch11: net-snmp-5.7.2-cert-path.patch
Patch12: net-snmp-5.7.3-snmpstatus-null.patch
Patch13: net-snmp-5.7.3-cflags.patch
Requires(post): chkconfig
Requires(preun): chkconfig
@ -210,6 +211,7 @@ cp %{SOURCE12} .
%patch10 -p1 -b .agentx-disconnect-crash
%patch11 -p1 -b .cert-path
%patch12 -p1 -b .snmpstatus-null
%patch13 -p1 -b .cflags
%ifarch sparc64 s390 s390x
# disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697
@ -236,7 +238,7 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
%configure \
--disable-static --enable-shared \
--with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT -Wformat" \
--with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT" \
--with-ldflags="-Wl,-z,relro -Wl,-z,now" \
--with-sys-location="Unknown" \
--with-logfile="/var/log/snmpd.log" \
@ -517,6 +519,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif
%changelog
* Wed Feb 24 2016 Jan Safranek <jsafrane@redhat.com> - 1:5.7.3-9
- Trim net-snmp-config --cflags output (#1309080)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1:5.7.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild