Add wrapper to export MALLOC_CHECK_=3

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2019-06-10 20:21:15 +02:00
parent 9e41d42924
commit 8d4a190d35
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C

View File

@ -21,7 +21,7 @@
%global rpmver 4.14.90 %global rpmver 4.14.90
%global snapver git14653 %global snapver git14653
%global rel 2 %global rel 3
%global srcver %{version}%{?snapver:-%{snapver}} %global srcver %{version}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x} %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@ -69,8 +69,6 @@ Requires: %{_bindir}/db_stat
Requires: popt%{_isa} >= 1.10.2.1 Requires: popt%{_isa} >= 1.10.2.1
Requires: curl Requires: curl
BuildRequires: libasan
%if %{without int_bdb} %if %{without int_bdb}
BuildRequires: libdb-devel BuildRequires: libdb-devel
%endif %endif
@ -312,9 +310,10 @@ Requires: rpm-libs%{_isa} = %{version}-%{release}
ln -s db-%{bdbver} db ln -s db-%{bdbver} db
%endif %endif
find -type f -name '*.c' -exec sed -i -e '/MALLOC_CHECK_/d' {} \+
%build %build
%set_build_flags %set_build_flags
export CFLAGS="$CFLAGS -fsanitize=address"
autoreconf -i -f autoreconf -i -f
@ -397,6 +396,13 @@ find $RPM_BUILD_ROOT -name "*.la"|xargs rm -f
rm -f $RPM_BUILD_ROOT/%{rpmhome}/{perldeps.pl,perl.*,pythond*} rm -f $RPM_BUILD_ROOT/%{rpmhome}/{perldeps.pl,perl.*,pythond*}
rm -f $RPM_BUILD_ROOT/%{_fileattrsdir}/{perl*,python*} rm -f $RPM_BUILD_ROOT/%{_fileattrsdir}/{perl*,python*}
mv -f %{buildroot}%{_bindir}/rpmbuild{,.real}
echo > %{buildroot}%{_bindir}/rpmbuild << EOF
#!/bin/sh
env MALLOC_CHECK_=3 /usr/bin/rpmbuild.real $@
EOF
chmod +x %{_bindir}/rpmbuild
%if %{with check} %if %{with check}
%check %check
# https://github.com/rpm-software-management/rpm/issues/741 # https://github.com/rpm-software-management/rpm/issues/741