SHA256
1
0
forked from pool/ptools

- Added fix-32bit-cast.diff which replaces a cast which is OK for

64bit targets but not for 32 bit targets to make the package
  buildable with GCC 14 on i586.

If the request is OK, please forward it to Factory too so that we can
switch the default compiler soon.  Thanks!

OBS-URL: https://build.opensuse.org/package/show/Base:System/ptools?expand=0&rev=14
This commit is contained in:
Dirk Mueller 2024-08-12 15:47:41 +00:00 committed by Git OBS Bridge
commit 83052cee5a
8 changed files with 211 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

33
commit-a42a099 Normal file
View File

@ -0,0 +1,33 @@
commit a42a0991797ab10c04bbcdf7cc2846c5da5bbd25
Author: Jan Blunck <jblunck@suse.de>
Date: Mon Sep 21 17:57:02 2009 +0200
Fix crash in map_seach_ehdr()
When searching for the ELF header check if libelf returned a valid pointer
before referencing it.
https://crashdb.opensuse.org/log/show/b75d1730f4c944b092afd8f302fe76b7
Signed-off-by: Jan Blunck <jblunck@suse.de>
---
src/pbuildid.c | 5 +++++
1 file changed, 5 insertions(+)
Index: b/src/pbuildid.c
===================================================================
--- a/src/pbuildid.c
+++ b/src/pbuildid.c
@@ -467,6 +467,11 @@ static Elf *map_search_ehdr(struct core_
/* Look for ELF header in this LOAD segment */
data = elf_getdata_rawchunk (map->elf, map->p_offset,
map->p_filesz, ELF_T_EHDR);
+ if (!data) {
+ fprintf(stderr, "Couldn't read LOAD segment: %s\n",
+ elf_errmsg(-1));
+ return NULL;
+ }
e_ident = (unsigned char *)data->d_buf;
if (memcmp (e_ident, ELFMAG, SELFMAG) != 0
|| e_ident[EI_CLASS] <= ELFCLASSNONE

20
fix-32bit-cast.diff Normal file
View File

@ -0,0 +1,20 @@
From: Martin Jambor <mjambor@suse.de>
Date: 2024-08-09
The pre-existing type-cast is OK for 64bit targets but not for 32 bit
targets, so this patch swaps it with what is actually used in the
corresponding data type definition.
Index: ptools-0.1/src/pbuildid.c
===================================================================
--- ptools-0.1.orig/src/pbuildid.c
+++ ptools-0.1/src/pbuildid.c
@@ -751,7 +751,7 @@ out:
mmap->l_addr = lmap->l_addr;
mmap->l_name = strdup(l_name);
- mmap->l_ld = (GElf_Dyn *)lmap->l_ld;
+ mmap->l_ld = (ElfW(Dyn) *)lmap->l_ld;
mmap->l_next = core_link_map;
mmap->l_prev = NULL;
if (core_link_map)

25
output-l_addr.diff Normal file
View File

@ -0,0 +1,25 @@
diff --git a/src/pbuildid.c b/src/pbuildid.c
index 3e480aa..445d6bf 100644
--- a/src/pbuildid.c
+++ b/src/pbuildid.c
@@ -234,7 +234,7 @@ static void so_print_buildid(struct core_map_info *core_map, const char *name,
note_phdr->p_filesz);
if (len) {
unsigned int i;
- printf("%s ", name);
+ printf("%s %#" PRIx64 " ", name, ehdr_addr);
for (i = 0; i < len; i++)
printf("%02" PRIx8, build_id[i]);
printf("\n");
@@ -915,8 +915,9 @@ static int process_core(Elf *elf, GElf_Ehdr *ehdr)
nphdr->p_filesz);
if (len) {
unsigned int i;
- printf("%s ",
- core_fname ? core_fname : "");
+ printf("%s %#" PRIx64 " ",
+ core_fname ? core_fname : "",
+ core_l_addr);
for (i = 0; i < len; i++)
printf("%02" PRIx8,
build_id[i]);

3
ptools-0.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b956e8e8d50d3e32731a8e17b7e04972087b157a203dd15c2790c84488b4e6b
size 239933

52
ptools.changes Normal file
View File

@ -0,0 +1,52 @@
-------------------------------------------------------------------
Fri Aug 9 14:19:31 UTC 2024 - Martin Jambor <mjambor@suse.com>
- Added fix-32bit-cast.diff which replaces a cast which is OK for
64bit targets but not for 32 bit targets to make the package
buildable with GCC 14 on i586.
-------------------------------------------------------------------
Thu Feb 29 15:03:43 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Use %autosetup macro. Allows to eliminate the usage of deprecated
%patchN.
-------------------------------------------------------------------
Tue Nov 7 21:50:29 UTC 2023 - Dirk Müller <dmueller@suse.com>
- spec-cleaner run
-------------------------------------------------------------------
Sun Oct 31 12:37:02 UTC 2010 - jengelh@medozas.de
- Use %_smp_mflags
-------------------------------------------------------------------
Mon Sep 21 17:59:50 CEST 2009 - jblunck@suse.de
- Fix crash in map_seach_ehdr().
-------------------------------------------------------------------
Tue Feb 3 10:37:08 CET 2009 - jblunck@suse.de
- Print out the load address of shared objects as well.
-------------------------------------------------------------------
Mon Nov 10 22:36:48 CET 2008 - jblunck@suse.de
- Relocate the AT_SYSINFO_EHDR to match the link_map->l_addr
- Check the version of the linker protocol used by the dynamic linker
- Parse section headers when processing executables
- Add pbuildid manual page
- Various cleanups
-------------------------------------------------------------------
Fri Nov 7 17:33:52 CET 2008 - jblunck@suse.de
- Add --kernel and --vdso command line.
-------------------------------------------------------------------
Thu Nov 6 13:40:17 CET 2008 - jblunck@suse.de
- The initial package of this tools. Only includes pbuildid for the moment.

54
ptools.spec Normal file
View File

@ -0,0 +1,54 @@
#
# spec file for package ptools
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: ptools
Version: 0.1
Release: 0
Summary: The process tools collection
License: GPL-2.0-or-later
Group: Development/Tools/Debuggers
URL: ftp://ftp.suse.com/pub/people/jblunck/ptools/
Source: %{name}-%{version}.tar.bz2
Patch0: output-l_addr.diff
Patch1: commit-a42a099
Patch2: fix-32bit-cast.diff
BuildRequires: libelf-devel
BuildRequires: popt-devel
#ExclusiveArch: %{ix86} x86_64
%description
pbuildid dumps the build-ids of an executable, core file or a process,
given the pid of that process.
%prep
%autosetup -p1
%build
%configure
%make_build
%install
%make_install
%files
%license COPYING
%doc README
%{_bindir}/pbuildid
%{_mandir}/man1/pbuildid.1%{?ext_man}
%changelog