import libtraceevent-1.1.1-8.el9

This commit is contained in:
CentOS Sources 2022-05-17 06:31:41 -04:00 committed by Stepan Oksanichenko
commit 257a12f060
5 changed files with 292 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/libtraceevent-1.1.1.tar.gz

1
.libtraceevent.metadata Normal file
View File

@ -0,0 +1 @@
07d940c014adcc4c15bb7333845b8e2c21328dc7 SOURCES/libtraceevent-1.1.1.tar.gz

View File

@ -0,0 +1,86 @@
From 62823da1bd46f24e2b498513a809011dfe16cd9b Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Date: Tue, 8 Jun 2021 17:27:44 -0400
Subject: [PATCH] libtraceevent: Handle parsing of "(REC)->" case
If a trace event wraps the special __entry variable to dereference it with
parenthesis, it shows up in the trace event format file wrapping the
"(REC)" as well. For example, the "func_repeats" event passed the __entry
into a helper macro in the TP_printk() portion, and the macro correctly
wrapped its parameter in parenthesis. This caused the output to show:
"(((u64)(REC)->top_delta_ts << 32) | (REC)->bottom_delta_ts)"
The parser then failed to parse the "(REC)->" portion, as it expected the
"->" to appear directly after the "REC". This is not a requirement, and
the parser should be able to handle such cases.
When this occurred, trace-cmd would error with the following message:
trace-cmd: No such file or directory
Error: expected type 4 but read 5
Link: https://lore.kernel.org/linux-trace-devel/20210608172744.796e93b7@gandalf.local.home
Fixes: 6582b0a ("tools/events: Add files to create libtraceevent.a")
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
src/event-parse.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/event-parse.c b/src/event-parse.c
index 97c1a97..1217491 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -2311,8 +2311,19 @@ process_entry(struct tep_event *event __maybe_unused, struct tep_print_arg *arg,
char *field;
char *token;
- if (read_expected(TEP_EVENT_OP, "->") < 0)
- goto out_err;
+ type = read_token_item(&token);
+ /*
+ * Check if REC happens to be surrounded by parenthesis, and
+ * return if that's the case, as "(REC)->" is valid.
+ * but return TEP_EVENT_ITEM.
+ */
+ if (type == TEP_EVENT_DELIM && strcmp(token, ")") == 0) {
+ *tok = token;
+ return TEP_EVENT_ITEM;
+ }
+
+ if (test_type_token(type, token, TEP_EVENT_OP, "->"))
+ goto out_free;
if (read_expect_type(TEP_EVENT_ITEM, &token) < 0)
goto out_free;
@@ -2338,7 +2349,6 @@ process_entry(struct tep_event *event __maybe_unused, struct tep_print_arg *arg,
out_free:
free_token(token);
- out_err:
*tok = NULL;
return TEP_EVENT_ERROR;
}
@@ -3033,6 +3043,17 @@ process_paren(struct tep_event *event, struct tep_print_arg *arg, char **tok)
if (type == TEP_EVENT_ERROR)
goto out_free;
+ /*
+ * If REC is surrounded by parenthesis, the process_arg()
+ * will return TEP_EVENT_ITEM with token == ")". In
+ * this case, we need to continue processing the item
+ * and return.
+ */
+ if (type == TEP_EVENT_ITEM && strcmp(token, ")") == 0) {
+ free_token(token);
+ return process_entry(event, arg, tok);
+ }
+
if (test_type_token(type, token, TEP_EVENT_DELIM, ")"))
goto out_free;
--
2.31.1

View File

@ -0,0 +1,98 @@
From e9bd314141ee6b4556d9db854bccd34159661ffa Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Date: Thu, 28 Jan 2021 16:31:35 -0500
Subject: [PATCH] libtraceevent: Move plugin_dir define logic to top level
Makefile
The installation location of the plugin directory needs to be passed into
the C files via the -DPLUGIN_DIR=".." compiler option. But the logic for
that was only in the plugin directory, such that the main library did not
know where to find the plugins (as the PLUGIN_DIR macro was not set). This
caused the library not to load the plugins for the application.
By moving the logic to the top level Makefile and exporting the variables,
this fixes the issue.
Link: https://lore.kernel.org/linux-trace-devel/20210128163135.27ae85d5@gandalf.local.home
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Makefile | 26 ++++++++++++++++++++++++++
plugins/Makefile | 24 ------------------------
2 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/Makefile b/Makefile
index e4eba74..11bfe54 100644
--- a/Makefile
+++ b/Makefile
@@ -118,6 +118,32 @@ endif
LIBS = -ldl
+set_plugin_dir := 1
+
+# Set plugin_dir to preffered global plugin location
+# If we install under $HOME directory we go under
+# $(HOME)/.local/lib/traceevent/plugins
+#
+# We dont set PLUGIN_DIR in case we install under $HOME
+# directory, because by default the code looks under:
+# $(HOME)/.local/lib/traceevent/plugins by default.
+#
+ifeq ($(plugin_dir),)
+ifeq ($(prefix),$(HOME))
+override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
+set_plugin_dir := 0
+else
+override plugin_dir = $(libdir)/traceevent/plugins
+endif
+export plugin_dir
+endif
+
+ifeq ($(set_plugin_dir),1)
+PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
+PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
+export PLUGIN_DIR PLUGIN_DIR_SQ
+endif
+
# Append required CFLAGS
override CFLAGS += -fPIC
override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
diff --git a/plugins/Makefile b/plugins/Makefile
index e8b8850..b60352d 100644
--- a/plugins/Makefile
+++ b/plugins/Makefile
@@ -41,30 +41,6 @@ libdir_relative ?= $(libdir_relative_tmp)
prefix ?= /usr/local
libdir = $(prefix)/$(libdir_relative)
-set_plugin_dir := 1
-
-# Set plugin_dir to preffered global plugin location
-# If we install under $HOME directory we go under
-# $(HOME)/.local/lib/traceevent/plugins
-#
-# We dont set PLUGIN_DIR in case we install under $HOME
-# directory, because by default the code looks under:
-# $(HOME)/.local/lib/traceevent/plugins by default.
-#
-ifeq ($(plugin_dir),)
-ifeq ($(prefix),$(HOME))
-override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
-set_plugin_dir := 0
-else
-override plugin_dir = $(libdir)/traceevent/plugins
-endif
-endif
-
-ifeq ($(set_plugin_dir),1)
-PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
-PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
-endif
-
include ../scripts/Makefile.include
# copy a bit from Linux kbuild
--
2.31.1

106
SPECS/libtraceevent.spec Normal file
View File

@ -0,0 +1,106 @@
# git tag
#%%global commit 5dd505f3aba255c5fbc2a6dbed57fcba51b400f6
#%%global commitdate 20201009
#%%global shortcommit %%(c=%%{commit}; echo ${c:0:7})
Name: libtraceevent
Version: 1.1.1
Release: 8%{?dist}
License: LGPLv2+ and GPLv2+
Summary: Library to parse raw trace event formats
URL: https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
# If upstream does not provide tarballs, to generate:
# git clone git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git
# cd libtraceevent
# git archive --prefix=libtraceevent-%%{version}/ -o libtraceevent-%%{version}.tar.gz %%{git_commit}
#Source0: libtraceevent-%%{version}.tar.gz
Source0: https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/libtraceevent-%{version}.tar.gz
Patch0: libtraceevent-Handle-parsing-of-REC-case.patch
Patch1: libtraceevent-Move-plugin_dir-define-logic-to-top-le.patch
BuildRequires: gcc
BuildRequires: xmlto
BuildRequires: asciidoc
%global __provides_exclude_from ^%{_libdir}/traceevent/plugins
%description
libtraceevent is a library to parse raw trace event formats.
%package devel
Summary: Development headers of %{name}
Requires: %{name}%{_isa} = %{version}-%{release}
%description devel
Development headers of %{name}-libs
%prep
%autosetup -p1
%build
MANPAGE_DOCBOOK_XSL=`rpm -ql docbook-style-xsl | grep manpages/docbook.xsl`
%set_build_flags
#looks like CFLAGS is ignored when compiling plugins, but not EXTRA_CFLAGS
export EXTRA_CFLAGS="%{optflags}"
export LDFLAGS="-Wl,-z,now"
%make_build prefix=%{_prefix} libdir=%{_libdir} MANPAGE_XSL=%{MANPAGE_DOCBOOK_XSL} all doc
%install
%set_build_flags
#looks like CFLAGS is ignored when compiling plugins, but not EXTRA_CFLAGS
export EXTRA_CFLAGS="%{optflags}"
export LDFLAGS="-Wl,-z,now"
%make_install prefix=%{_prefix} libdir=%{_libdir} install doc-install
rm -rf %{buildroot}/%{_libdir}/libtraceevent.a
%files
%license LICENSES/LGPL-2.1
%license LICENSES/GPL-2.0
%{_libdir}/traceevent/
%{_libdir}/libtraceevent.so.%{version}
%{_libdir}/libtraceevent.so.1
%{_mandir}/man3/tep_*.3.*
%{_mandir}/man3/libtraceevent.3.*
%{_mandir}/man3/trace_seq*.3.*
%{_docdir}/%{name}-doc
%files devel
%{_includedir}/traceevent/
%{_libdir}/libtraceevent.so
%{_libdir}/pkgconfig/libtraceevent.pc
%changelog
* Fri Jan 14 2022 Michael Petlan <mpetlan@redhat.com> - 1.1.1-8
- Harden linking to meet annocheck requirements
Related: rhbz#2037125
* Fri Nov 19 2021 Jerome Marchand <jmarchan@redhat.com> - 1.1.1-7
- Fix rpminspect annocheck issue.
* Tue Oct 26 2021 Jerome Marchand <jmarchan@redhat.com> - 1.1.1-6
- Handle parsing of "(REC)->" case
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.1.1-5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu May 6 2021 Michael Petlan <mpetlan@redhat.com> - 1.1.1-4
- Remove conflict to enable perf linking. Resolves: rhbz#1957733
* Wed Apr 21 2021 Jerome Marchand <jmarchan@redhat.com> - 1.1.1-3
- Multi-build with libtracefs, trace-cmd and kernelshark
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.1.1-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Mon Feb 08 2021 Zamir SUN <sztsian@gmail.com> - 1.1.1-1
- Update to 1.1.1
* Sat Oct 17 2020 Zamir SUN <sztsian@gmail.com> - 1.1.0-1
- Update to 1.1.0
* Fri Oct 09 2020 Zamir SUN <sztsian@gmail.com> - 0-0.1.20201009git5dd505f
- Initial libtraceevent