From 6a459a966e9290369760b18cc142d75dd2058279 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 19 2015 15:53:07 +0000 Subject: import gperftools-2.4-7.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..937aac7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/gperftools-2.4.tar.gz diff --git a/.gperftools.metadata b/.gperftools.metadata new file mode 100644 index 0000000..9d16532 --- /dev/null +++ b/.gperftools.metadata @@ -0,0 +1 @@ +13b904d0d1f220e43e4495f3403ee280c6da26ea SOURCES/gperftools-2.4.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/gperf-allow-customizing-trace-filename.patch b/SOURCES/gperf-allow-customizing-trace-filename.patch new file mode 100644 index 0000000..2056aac --- /dev/null +++ b/SOURCES/gperf-allow-customizing-trace-filename.patch @@ -0,0 +1,60 @@ +allow customizing the trace file name + +Message-id: <1438961446-14046-1-git-send-email-pbonzini@redhat.com> +Patchwork-id: 67396 +O-Subject: [RHEL7.2 PATCH gperftools] allow customizing the trace file name +Bugzilla: 1232702 +RH-Acked-by: Thomas Huth +RH-Acked-by: Jeff Nelson +RH-Acked-by: Miroslav Rezanina + +The debug version of tcmalloc opens a hard-coded file in /tmp. Arguably, +this is not a vulnerability because it just affects debugging, but we +should still fix this before shipping gperftools. The file is still +hard-coded, but at least multiple developers can use tcmalloc tracing +at the same time. + +(cherry picked from upstream commit 36066b8df4bc) + + + + +diff --git a/src/debugallocation.cc b/src/debugallocation.cc +index 2a8a20e..1f6296b 100644 +--- a/src/debugallocation.cc ++++ b/src/debugallocation.cc +@@ -884,6 +884,9 @@ static void TracePrintf(int fd, const char *fmt, ...) { + va_start(ap, fmt); + const char *p = fmt; + char numbuf[25]; ++ if (fd < 0) { ++ return; ++ } + numbuf[sizeof(numbuf)-1] = 0; + while (*p != '\0') { // until end of format string + char *s = &numbuf[sizeof(numbuf)-1]; +@@ -955,11 +958,20 @@ static void TracePrintf(int fd, const char *fmt, ...) { + static int TraceFd() { + static int trace_fd = -1; + if (trace_fd == -1) { // Open the trace file on the first call +- trace_fd = open("/tmp/google.alloc", O_CREAT|O_TRUNC|O_WRONLY, 0666); ++ const char *val = getenv("TCMALLOC_TRACE_FILE"); ++ bool fallback_to_stderr = false; ++ if (!val) { ++ val = "/tmp/google.alloc"; ++ fallback_to_stderr = true; ++ } ++ trace_fd = open(val, O_CREAT|O_TRUNC|O_WRONLY, 0666); + if (trace_fd == -1) { +- trace_fd = 2; +- TracePrintf(trace_fd, +- "Can't open /tmp/google.alloc. Logging to stderr.\n"); ++ if (fallback_to_stderr) { ++ trace_fd = 2; ++ TracePrintf(trace_fd, "Can't open %s. Logging to stderr.\n", val); ++ } else { ++ TracePrintf(2, "Can't open %s. Logging disabled.\n", val); ++ } + } + // Add a header to the log. + TracePrintf(trace_fd, "Trace started: %lu\n", diff --git a/SPECS/gperftools.spec b/SPECS/gperftools.spec new file mode 100644 index 0000000..99841b2 --- /dev/null +++ b/SPECS/gperftools.spec @@ -0,0 +1,127 @@ +# This package used to be called "google-perftools", but it was renamed on 2012-02-03. + +%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} + +Name: gperftools +Version: 2.4 +Release: 7%{?dist} +License: BSD +Group: Development/Tools +Summary: Very fast malloc and performance analysis tools +URL: http://code.google.com/p/gperftools/ +Source0: https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/%{name}-%{version}.tar.gz + +# For bz 1232702 - gperftools: tcmalloc debug version uses hard-coded path /tmp/google.alloc +Patch1: gperf-allow-customizing-trace-filename.patch + +ExcludeArch: s390 s390x +%ifnarch ppc %{power64} +BuildRequires: libunwind-devel +%endif +Requires: gperftools-devel = %{version}-%{release} +Requires: pprof = %{version}-%{release} + +%description +Perf Tools is a collection of performance analysis tools, including a +high-performance multi-threaded malloc() implementation that works +particularly well with threads and STL, a thread-friendly heap-checker, +a heap profiler, and a cpu-profiler. + +This is a metapackage which pulls in all of the gperftools (and pprof) +binaries, libraries, and development headers, so that you can use them. + +%package devel +Summary: Development libraries and headers for gperftools +Group: Development/Libraries +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Provides: google-perftools-devel = %{version}-%{release} +Obsoletes: google-perftools-devel < 2.0 + +%description devel +Libraries and headers for developing applications that use gperftools. + +%package libs +Summary: Libraries provided by gperftools +Provides: google-perftools-libs = %{version}-%{release} +Obsoletes: google-perftools-libs < 2.0 + +%description libs +Libraries provided by gperftools, including libtcmalloc and libprofiler. + +%package -n pprof +Summary: CPU and Heap Profiler tool +Requires: graphviz +BuildArch: noarch +Provides: google-perftools = %{version}-%{release} +Obsoletes: google-perftools < 2.0 + +%description -n pprof +Pprof is a heap and CPU profiler tool, part of the gperftools suite. + +%prep +%setup -q +%patch1 -p1 + +# Fix end-of-line encoding +sed -i 's/\r//' README_windows.txt + +# No need to have exec permissions on source code +chmod -x src/*.h src/*.cc + +%build +CFLAGS=`echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-unused-local-typedefs -DTCMALLOC_LARGE_PAGES | sed -e 's|-fexceptions||g'` +CXXFLAGS=`echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-unused-local-typedefs -DTCMALLOC_LARGE_PAGES | sed -e 's|-fexceptions||g'` +%configure --disable-static + +# Bad rpath! +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +# Can't build with smp_mflags +make + +%install +make DESTDIR=%{buildroot} docdir=%{_pkgdocdir}/ install +find %{buildroot} -type f -name "*.la" -exec rm -f {} ';' + +# Delete useless files +rm -rf %{buildroot}%{_pkgdocdir}/INSTALL + +%check +# http://code.google.com/p/google-perftools/issues/detail?id=153 +%ifnarch ppc +# Their test suite is almost always broken. +# LD_LIBRARY_PATH=./.libs make check +%endif + +%post libs -p /sbin/ldconfig +%postun libs -p /sbin/ldconfig + +%files + +%files -n pprof +%{_bindir}/pprof +%{_mandir}/man1/* + +%files devel +%{_pkgdocdir}/ +%{_includedir}/google/ +%{_includedir}/gperftools/ +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc + +%files libs +%{_libdir}/*.so.* + +%changelog +* Wed Aug 26 2015 Miroslav Rezanina 2.4-7 +- Rebuild to fix NVR [bz#1269032] +- Resolves: bz#1269032 + (gperftools NVR lower than EPEL version) + +* Wed Aug 26 2015 Miroslav Rezanina 2.4-2 +- gperf-allow-customizing-trace-filename.patch [bz#1232702] +- Resolves: bz#1232702 + (gperftools: tcmalloc debug version uses hard-coded path /tmp/google.alloc) + +* Tue Jun 02 2015 Miroslav Rezanina 2.4-1 +- Import to RHEL