Compare commits

...

27 Commits

Author SHA1 Message Date
David Abdurachmanov ae0fc5b66c
Ignore testsuite failures on riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2023-11-25 15:33:00 +02:00
David Abdurachmanov da00848d8e
Merge remote-tracking branch 'up/main' into main-riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2023-11-25 15:31:28 +02:00
Aaron Merey 67d56959ad 0.190-3 - Add elfutils-0.190-fix-core-noncontig.patch 2023-11-24 16:33:03 -05:00
Mark Wielaard 4bf94eb436 0.190-2 - Update Fedora license tags to spdx license tags 2023-11-04 01:10:11 +01:00
Mark Wielaard d6169014dd 0.190-1
- Upgrade to upstream elfutils 0.190
- Add eu-srcfiles
- Drop upstreamed patches
  elfutils-0.189-relr.patch
  elfutils-0.189-debuginfod_config_cache-double-close.patch
  elfutils-0.189-elf_getdata_rawchunk.patch
  elfutils-0.189-elfcompress.patch
  elfutils-0.189-c99-compat.patch
- Only package debuginfod-client-config.7 manpage for debuginfod-client
2023-11-03 21:21:05 +01:00
Mark Wielaard 87c5e66753 0.189-6 - Update elfutils-0.189-relr.patch 2023-08-25 01:15:22 +02:00
Mark Wielaard 6258998871 0.189-5 - Add elfutils-0.189-relr.patch 2023-08-24 00:16:51 +02:00
Fedora Release Engineering 62b5826af2 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-19 18:20:35 +00:00
Mark Wielaard cb376abe7f 0.189-3 - Add elfutils-0.189-debuginfod_config_cache-double-close.patch 2023-06-22 15:10:49 +02:00
Mark Wielaard 87f9e5c38d Add elfutils-0.189-elf_getdata_rawchunk.patch 2023-06-22 15:08:31 +02:00
Martin Cermak 771965e4bc CI Tests: Simplify test for rhbz2188064 2023-04-25 12:50:10 +02:00
Martin Cermak 7c06a3670c CI Tests: Test cover rhbz2188064 2023-04-25 12:40:59 +02:00
Mark Wielaard 25ede0eead 0.189-2 2023-04-22 22:29:20 +02:00
Mark Wielaard 4ae92c9668 Add elfutils-0.189-elfcompress.patch 2023-04-22 22:28:38 +02:00
Mark Wielaard 829b595e08 Add elfutils-0.189-c99-compat.patch 2023-04-22 22:23:26 +02:00
Martin Cermak 66e41cec57 CI Tests: Fix the debuginfod URL 2023-03-06 10:06:48 +01:00
Mark Wielaard cb75800050 0.189-1 - Upgrade to upsteam elfutils 0.189 2023-03-03 17:44:51 +01:00
Martin Cermak ad7295b997 CI Tests: Update Regression/GNU-Attribute-notes-not-recognized 2023-02-13 12:56:12 +01:00
Mark Wielaard c468385a0e 0.188-5 Add various libcurl fixes for deprecated constants
- Add elfutils-0.188-deprecated-CURLINFO.patch,
  elfutils-0.188-CURL_AT_LEAST_VERSION.patch and
  elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch
2023-01-27 19:09:22 +01:00
Fedora Release Engineering a1e6f5590c Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 02:12:19 +00:00
Mark Wielaard 0f93d8ded5 0.188-3
- Add elfutils-0.188-compile-warnings.patch
- Add elfutils-0.188-debuginfod-client-lifetime.patch
2022-11-07 17:15:03 +01:00
Mark Wielaard dae3515986 0.188-2 2022-11-02 18:22:54 +01:00
Mark Wielaard 8b711f9c71 0.188-2 - Add elfutils-0.188-static-extract_section.patch 2022-11-02 18:14:57 +01:00
Mark Wielaard 3d4d19222d 0.188-1 - Upgrade to upsteam elfutils 0.188 2022-11-02 16:33:41 +01:00
Amit Shah 17c16efeeb Use distro-configured debuginfod server
Fedora and CentOS configure a debuginfod server by default, whereas RHEL
and Amazon Linux do not.  The new `dist_debuginfod_url` macro sets the
server URL in a central place.  Use that value, if defined, to configure
with a default server.  If unset, do not configure one.

This ensures we have a unified spec file for all distro variants, and
distro-specific config resides in the macros.dist file.

With this change, we do not need the recently-added bcond for
with_debuginfo_url, so drop it.

Signed-off-by: Amit Shah <amitshah@fedoraproject.org>
2022-10-05 15:50:10 +02:00
Debarshi Ray 3e1f9c3f60 Silence mixed-use-of-spaces-and-tabs 2022-08-24 17:46:20 +02:00
Debarshi Ray 21528c8512 Use %sysusers_requires_compat to match %sysusers_create_compat
Fallout from 8675595d8f
2022-08-24 17:40:43 +02:00
15 changed files with 544 additions and 341 deletions

3
.gitignore vendored
View File

@ -28,3 +28,6 @@
/elfutils-0.185.tar.bz2
/elfutils-0.186.tar.bz2
/elfutils-0.187.tar.bz2
/elfutils-0.188.tar.bz2
/elfutils-0.189.tar.bz2
/elfutils-0.190.tar.bz2

View File

@ -1,28 +0,0 @@
commit f1252e4dbe781f75d806ce0b990779548eeeb7a9
Author: Mark Wielaard <mark@klomp.org>
Date: Tue May 3 17:48:55 2022 +0200
config: Move the 2>/dev/null inside the sh -c '' quotes for profile.csh.
csh/tcsh would warn about "Ambiguous output redirect" if not done inside
the sh -c command.
Fix-by: наб <nabijaczleweli@nabijaczleweli.xyz>
https://bugzilla.redhat.com/show_bug.cgi?id=2080957
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/config/profile.csh.in b/config/profile.csh.in
index 012e243a..74c20c99 100644
--- a/config/profile.csh.in
+++ b/config/profile.csh.in
@@ -6,7 +6,7 @@
if (! $?DEBUGINFOD_URLS) then
set prefix="@prefix@"
- set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "@sysconfdir@/debuginfod" 2>/dev/null | tr '\n' ' '`
+ set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls 2>/dev/null; :' "@sysconfdir@/debuginfod" | tr '\n' ' '`
if ( "$DEBUGINFOD_URLS" != "" ) then
setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
else

View File

@ -1,98 +0,0 @@
commit 59158656f3b0b99d8784ddc82c15778813000edc
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Wed May 4 10:26:42 2022 -0400
PR29117: fix fd leak in debuginfod client for cache-miss files
Correct a nasty fd leak and a few less nasty leaks in the debuginfod
client code. The nasty one impacts long-lived apps such as debuginfod
servers.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index ea6e461a..521972e4 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -243,7 +243,13 @@ debuginfod_config_cache(char *config_path,
return -errno;
if (dprintf(fd, "%ld", cache_config_default_s) < 0)
- return -errno;
+ {
+ int ret = -errno;
+ close (fd);
+ return ret;
+ }
+
+ close (fd);
}
long cache_config;
@@ -284,7 +290,13 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
return -errno;
if (dprintf(fd, "%ld", cache_clean_default_interval_s) < 0)
- return -errno;
+ {
+ int ret = -errno;
+ close (fd);
+ return ret;
+ }
+
+ close (fd);
/* init max age config file. */
if (stat(maxage_path, &st) != 0
@@ -292,8 +304,13 @@ debuginfod_init_cache (char *cache_path, char *interval_path, char *maxage_path)
return -errno;
if (dprintf(fd, "%ld", cache_default_max_unused_age_s) < 0)
- return -errno;
+ {
+ int ret = -errno;
+ close (fd);
+ return ret;
+ }
+ close (fd);
return 0;
}
@@ -812,18 +829,17 @@ debuginfod_query_server (debuginfod_client *c,
has passed since the last attempt. */
time_t cache_miss;
time_t target_mtime = st.st_mtime;
+
+ close(fd); /* no need to hold onto the negative-hit file descriptor */
+
rc = debuginfod_config_cache(cache_miss_path,
cache_miss_default_s, &st);
if (rc < 0)
- {
- close(fd);
- goto out;
- }
+ goto out;
cache_miss = (time_t)rc;
if (time(NULL) - target_mtime <= cache_miss)
{
- close(fd);
rc = -ENOENT;
goto out;
}
diff --git a/debuginfod/debuginfod-find.c b/debuginfod/debuginfod-find.c
index 3e8ab203..f60b5463 100644
--- a/debuginfod/debuginfod-find.c
+++ b/debuginfod/debuginfod-find.c
@@ -231,6 +231,8 @@ main(int argc, char** argv)
fprintf(stderr, "Server query failed: %s\n", strerror(-rc));
return 1;
}
+ else
+ close (rc);
printf("%s\n", cache_name);
free (cache_name);

View File

@ -1,51 +0,0 @@
commit 28f9d86ea89f88b24f1d12c8e9d5ddc3f77da194
Author: Mark Wielaard <mark@klomp.org>
Date: Fri May 6 00:29:28 2022 +0200
debuginfod: Use MHD_USE_EPOLL for libmicrohttpd version 0.9.51 or higher
Also disable MHD_USE_THREAD_PER_CONNECTION when using MHD_USE_EPOLL.
https://sourceware.org/bugzilla/show_bug.cgi?id=29123
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index c02540f1..d4f47bf7 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1,6 +1,6 @@
/* Debuginfo-over-http server.
Copyright (C) 2019-2021 Red Hat, Inc.
- Copyright (C) 2021 Mark J. Wielaard <mark@klomp.org>
+ Copyright (C) 2021, 2022 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -3899,7 +3899,14 @@ main (int argc, char *argv[])
}
}
- unsigned int mhd_flags = ((connection_pool
+ /* Note that MHD_USE_EPOLL and MHD_USE_THREAD_PER_CONNECTION don't
+ work together. */
+ unsigned int use_epoll = 0;
+#if MHD_VERSION >= 0x00095100
+ use_epoll = MHD_USE_EPOLL;
+#endif
+
+ unsigned int mhd_flags = ((connection_pool || use_epoll
? 0 : MHD_USE_THREAD_PER_CONNECTION)
#if MHD_VERSION >= 0x00095300
| MHD_USE_INTERNAL_POLLING_THREAD
@@ -3907,9 +3914,7 @@ main (int argc, char *argv[])
| MHD_USE_SELECT_INTERNALLY
#endif
| MHD_USE_DUAL_STACK
-#ifdef MHD_USE_EPOLL
- | MHD_USE_EPOLL
-#endif
+ | use_epoll
#if MHD_VERSION >= 0x00095200
| MHD_USE_ITC
#endif

View File

@ -1,118 +0,0 @@
commit ba675ed25a26fd425ffd19b02cf18babf4291b4f
Author: Mark Wielaard <mark@klomp.org>
Date: Thu May 5 23:59:57 2022 +0200
debuginfod: Try without MHD_USE_DUAL_STACK if MHD_start_daemon fails
On a systems that have ipv6 disabled debuginfod doesn't start up
anymore because libhttpd MHD_USE_DUAL_STACK only works if it can
open an ipv6 socket. If MHD_start_daemon with MHD_USE_DUAL_STACK
fails try again without that flag set.
https://sourceware.org/bugzilla/show_bug.cgi?id=29122
Signed-off-by: Mark Wielaard <mark@klomp.org>
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 4aaf41c0..c02540f1 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3899,40 +3899,67 @@ main (int argc, char *argv[])
}
}
- // Start httpd server threads. Use a single dual-homed pool.
- MHD_Daemon *d46 = MHD_start_daemon ((connection_pool ? 0 : MHD_USE_THREAD_PER_CONNECTION)
+ unsigned int mhd_flags = ((connection_pool
+ ? 0 : MHD_USE_THREAD_PER_CONNECTION)
#if MHD_VERSION >= 0x00095300
- | MHD_USE_INTERNAL_POLLING_THREAD
+ | MHD_USE_INTERNAL_POLLING_THREAD
#else
- | MHD_USE_SELECT_INTERNALLY
+ | MHD_USE_SELECT_INTERNALLY
#endif
+ | MHD_USE_DUAL_STACK
#ifdef MHD_USE_EPOLL
- | MHD_USE_EPOLL
+ | MHD_USE_EPOLL
#endif
- | MHD_USE_DUAL_STACK
#if MHD_VERSION >= 0x00095200
- | MHD_USE_ITC
+ | MHD_USE_ITC
#endif
- | MHD_USE_DEBUG, /* report errors to stderr */
- http_port,
- NULL, NULL, /* default accept policy */
- handler_cb, NULL, /* handler callback */
- MHD_OPTION_EXTERNAL_LOGGER, error_cb, NULL,
- (connection_pool ? MHD_OPTION_THREAD_POOL_SIZE : MHD_OPTION_END),
- (connection_pool ? (int)connection_pool : MHD_OPTION_END),
- MHD_OPTION_END);
+ | MHD_USE_DEBUG); /* report errors to stderr */
+ // Start httpd server threads. Use a single dual-homed pool.
+ MHD_Daemon *d46 = MHD_start_daemon (mhd_flags, http_port,
+ NULL, NULL, /* default accept policy */
+ handler_cb, NULL, /* handler callback */
+ MHD_OPTION_EXTERNAL_LOGGER,
+ error_cb, NULL,
+ (connection_pool
+ ? MHD_OPTION_THREAD_POOL_SIZE
+ : MHD_OPTION_END),
+ (connection_pool
+ ? (int)connection_pool
+ : MHD_OPTION_END),
+ MHD_OPTION_END);
+
+ MHD_Daemon *d4 = NULL;
if (d46 == NULL)
{
- sqlite3 *database = db;
- sqlite3 *databaseq = dbq;
- db = dbq = 0; // for signal_handler not to freak
- sqlite3_close (databaseq);
- sqlite3_close (database);
- error (EXIT_FAILURE, 0, "cannot start http server at port %d", http_port);
- }
+ // Cannot use dual_stack, use ipv4 only
+ mhd_flags &= ~(MHD_USE_DUAL_STACK);
+ d4 = MHD_start_daemon (mhd_flags, http_port,
+ NULL, NULL, /* default accept policy */
+ handler_cb, NULL, /* handler callback */
+ MHD_OPTION_EXTERNAL_LOGGER,
+ error_cb, NULL,
+ (connection_pool
+ ? MHD_OPTION_THREAD_POOL_SIZE
+ : MHD_OPTION_END),
+ (connection_pool
+ ? (int)connection_pool
+ : MHD_OPTION_END),
+ MHD_OPTION_END);
+ if (d4 == NULL)
+ {
+ sqlite3 *database = db;
+ sqlite3 *databaseq = dbq;
+ db = dbq = 0; // for signal_handler not to freak
+ sqlite3_close (databaseq);
+ sqlite3_close (database);
+ error (EXIT_FAILURE, 0, "cannot start http server at port %d",
+ http_port);
+ }
- obatched(clog) << "started http server on IPv4 IPv6 "
+ }
+ obatched(clog) << "started http server on"
+ << (d4 != NULL ? " IPv4 " : " IPv4 IPv6 ")
<< "port=" << http_port << endl;
// add maxigroom sql if -G given
@@ -4053,6 +4080,7 @@ main (int argc, char *argv[])
/* Stop all the web service threads. */
if (d46) MHD_stop_daemon (d46);
+ if (d4) MHD_stop_daemon (d4);
if (! passive_p)
{

View File

@ -0,0 +1,329 @@
From 0fba72fed595f77ca19a57553096ce3cc81cf8f3 Mon Sep 17 00:00:00 2001
From: Aaron Merey <amerey@redhat.com>
Date: Fri, 24 Nov 2023 14:52:38 -0500
Subject: [PATCH] libdwfl: Correctly handle corefile non-contiguous segments
It is possible for segments of different shared libaries to be interleaved
in memory such that the segments of one library are located in between
non-contiguous segments of another library.
For example, this can be seen with firefox on RHEL 7.9 where multiple
shared libraries could be mapped in between ld-2.17.so segments:
[...]
7f0972082000-7f09720a4000 00000000 139264 /usr/lib64/ld-2.17.so
7f09720a4000-7f09720a5000 00000000 4096 /memfd:mozilla-ipc (deleted)
7f09720a5000-7f09720a7000 00000000 8192 /memfd:mozilla-ipc (deleted)
7f09720a7000-7f09720a9000 00000000 8192 /memfd:mozilla-ipc (deleted)
7f0972134000-7f0972136000 00000000 8192 /usr/lib64/firefox/libmozwayland.so
7f0972136000-7f0972137000 00002000 4096 /usr/lib64/firefox/libmozwayland.so
7f0972137000-7f0972138000 00003000 4096 /usr/lib64/firefox/libmozwayland.so
7f0972138000-7f0972139000 00003000 4096 /usr/lib64/firefox/libmozwayland.so
7f097213a000-7f0972147000 00000000 53248 /usr/lib64/firefox/libmozsqlite3.so
7f0972147000-7f097221e000 0000d000 880640 /usr/lib64/firefox/libmozsqlite3.so
7f097221e000-7f0972248000 000e4000 172032 /usr/lib64/firefox/libmozsqlite3.so
7f0972248000-7f0972249000 0010e000 4096 /usr/lib64/firefox/libmozsqlite3.so
7f0972249000-7f097224c000 0010e000 12288 /usr/lib64/firefox/libmozsqlite3.so
7f097224c000-7f0972250000 00111000 16384 /usr/lib64/firefox/libmozsqlite3.so
7f0972250000-7f0972253000 00000000 12288 /usr/lib64/firefox/liblgpllibs.so
[...]
7f09722a3000-7f09722a4000 00021000 4096 /usr/lib64/ld-2.17.so
7f09722a4000-7f09722a5000 00022000 4096 /usr/lib64/ld-2.17.so
dwfl_segment_report_module did not account for the possibility of
interleaving non-contiguous segments, resulting in premature closure
of modules as well as failing to report modules.
Fix this by removing segment skipping in dwfl_segment_report_module.
When dwfl_segment_report_module reported a module, it would return
the index of the segment immediately following the end address of the
current module. Since there's a chance that other modules might fall
within this address range, dwfl_segment_report_module instead returns
the index of the next segment.
This patch also fixes premature module closure that can occur in
dwfl_segment_report_module when interleaving non-contiguous segments
are found. Previously modules with start and end addresses that overlap
with the current segment would have their build-ids compared with the
current segment's build-id. If there was a mismatch, that module would
be closed. Avoid closing modules in this case when mismatching build-ids
correspond to distinct modules.
https://sourceware.org/bugzilla/show_bug.cgi?id=30975
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
libdwfl/dwfl_segment_report_module.c | 37 ++++++++----
tests/Makefile.am | 8 ++-
tests/dwfl-core-noncontig.c | 82 +++++++++++++++++++++++++++
tests/run-dwfl-core-noncontig.sh | 63 ++++++++++++++++++++
4 files changed, 177 insertions(+), 14 deletions(-)
create mode 100644 tests/dwfl-core-noncontig.c
create mode 100755 tests/run-dwfl-core-noncontig.sh
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index 3ef62a7d..09ee37b3 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -737,17 +737,34 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
&& invalid_elf (module->elf, module->disk_file_has_build_id,
&build_id))
{
- elf_end (module->elf);
- close (module->fd);
- module->elf = NULL;
- module->fd = -1;
+ /* If MODULE's build-id doesn't match the disk file's
+ build-id, close ELF only if MODULE and ELF refer to
+ different builds of files with the same name. This
+ prevents premature closure of the correct ELF in cases
+ where segments of a module are non-contiguous in memory. */
+ if (name != NULL && module->name[0] != '\0'
+ && strcmp (basename (module->name), basename (name)) == 0)
+ {
+ elf_end (module->elf);
+ close (module->fd);
+ module->elf = NULL;
+ module->fd = -1;
+ }
}
- if (module->elf != NULL)
+ else if (module->elf != NULL)
{
- /* Ignore this found module if it would conflict in address
- space with any already existing module of DWFL. */
+ /* This module has already been reported. */
skip_this_module = true;
}
+ else
+ {
+ /* Only report this module if we haven't already done so. */
+ for (Dwfl_Module *mod = dwfl->modulelist; mod != NULL;
+ mod = mod->next)
+ if (mod->low_addr == module_start
+ && mod->high_addr == module_end)
+ skip_this_module = true;
+ }
}
if (skip_this_module)
goto out;
@@ -781,10 +798,6 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
}
}
- /* Our return value now says to skip the segments contained
- within the module. */
- ndx = addr_segndx (dwfl, segment, module_end, true);
-
/* Examine its .dynamic section to get more interesting details.
If it has DT_SONAME, we'll use that as the module name.
If it has a DT_DEBUG, then it's actually a PIE rather than a DSO.
@@ -929,6 +942,8 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
ndx = -1;
goto out;
}
+ else
+ ndx++;
/* We have reported the module. Now let the caller decide whether we
should read the whole thing in right now. */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7fb8efb1..9f8f7698 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,7 +42,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \
dwfl-addr-sect dwfl-bug-report early-offscn \
dwfl-bug-getmodules dwarf-getmacros dwarf-ranges addrcfi \
- dwarfcfi \
+ dwfl-core-noncontig dwarfcfi \
test-flag-nobits dwarf-getstring rerequest_tag \
alldts typeiter typeiter2 low_high_pc \
test-elf_cntl_gelf_getshdr dwflsyms dwfllines \
@@ -212,7 +212,7 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
$(asm_TESTS) run-disasm-bpf.sh run-low_high_pc-dw-form-indirect.sh \
run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \
run-readelf-dw-form-indirect.sh run-strip-largealign.sh \
- run-readelf-Dd.sh
+ run-readelf-Dd.sh run-dwfl-core-noncontig.sh
if !BIARCH
export ELFUTILS_DISABLE_BIARCH = 1
@@ -632,7 +632,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \
testfile_nvidia_linemap.bz2 \
testfile-largealign.o.bz2 run-strip-largealign.sh \
- run-funcretval++11.sh
+ run-funcretval++11.sh \
+ run-dwfl-core-noncontig.sh testcore-noncontig.bz2
if USE_VALGRIND
@@ -738,6 +739,7 @@ dwfl_bug_fd_leak_LDADD = $(libeu) $(libdw) $(libebl) $(libelf)
dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf)
dwfl_bug_getmodules_LDADD = $(libeu) $(libdw) $(libebl) $(libelf)
dwfl_addr_sect_LDADD = $(libeu) $(libdw) $(libebl) $(libelf) $(argp_LDADD)
+dwfl_core_noncontig_LDADD = $(libdw) $(libelf)
dwarf_getmacros_LDADD = $(libdw)
dwarf_ranges_LDADD = $(libdw)
dwarf_getstring_LDADD = $(libdw)
diff --git a/tests/dwfl-core-noncontig.c b/tests/dwfl-core-noncontig.c
new file mode 100644
index 00000000..04558e28
--- /dev/null
+++ b/tests/dwfl-core-noncontig.c
@@ -0,0 +1,82 @@
+/* Test program for dwfl_getmodules bug.
+ Copyright (C) 2008 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <assert.h>
+#include ELFUTILS_HEADER(dwfl)
+#include ELFUTILS_HEADER(elf)
+
+static const Dwfl_Callbacks cb =
+{
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+};
+
+int
+main (int argc, char **argv)
+{
+ assert (argc == 2);
+
+ Dwfl *dwfl = dwfl_begin (&cb);
+
+ int fd = open (argv[1], O_RDONLY);
+ assert (fd != -1);
+
+ Elf *elf = elf_begin (fd, ELF_C_READ, NULL);
+ (void) dwfl_core_file_report (dwfl, elf, argv[0]);
+
+ /* testcore-noncontig contains a shared library mapped between
+ non-contiguous segments of another shared library:
+
+ [...]
+ 7f14e458c000-7f14e45ae000 00000000 139264 /usr/lib64/ld-2.17.so (1)
+ 7f14e4795000-7f14e4798000 00000000 12288 /usr/lib64/firefox/liblgpllibs.so (2)
+ 7f14e4798000-7f14e479d000 00003000 20480 /usr/lib64/firefox/liblgpllibs.so
+ 7f14e479d000-7f14e479f000 00008000 8192 /usr/lib64/firefox/liblgpllibs.so
+ 7f14e479f000-7f14e47a0000 00009000 4096 /usr/lib64/firefox/liblgpllibs.so
+ 7f14e47a0000-7f14e47a1000 0000a000 4096 /usr/lib64/firefox/liblgpllibs.so (3)
+ 7f14e47ad000-7f14e47ae000 00021000 4096 /usr/lib64/ld-2.17.so (4)
+ 7f14e47ae000-7f14e47af000 00022000 4096 /usr/lib64/ld-2.17.so */
+
+ /* First segment of the non-contiguous module (1). */
+ int seg = dwfl_addrsegment (dwfl, 0x7f14e458c000, NULL);
+ assert (seg == 32);
+
+ /* First segment of the module within the non-contiguous module's address
+ range (2). */
+ seg = dwfl_addrsegment (dwfl, 0x7f14e4795000, NULL);
+ assert (seg == 33);
+
+ /* Last segment of the module within the non-contiguous module's
+ address range (3). */
+ seg = dwfl_addrsegment (dwfl, 0x7f14e47a0000, NULL);
+ assert (seg == 37);
+
+ /* First segment of non-contiguous module following its address space
+ gap (4). */
+ seg = dwfl_addrsegment (dwfl, 0x7f14e47ad000, NULL);
+ assert (seg == 40);
+
+ dwfl_end (dwfl);
+ elf_end (elf);
+
+ return 0;
+}
diff --git a/tests/run-dwfl-core-noncontig.sh b/tests/run-dwfl-core-noncontig.sh
new file mode 100755
index 00000000..1245b67f
--- /dev/null
+++ b/tests/run-dwfl-core-noncontig.sh
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 2023 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# Test whether libdwfl can handle corefiles containing non-contiguous
+# segments where multiple modules are contained within the address
+# space of some other module.
+
+# testcore-noncontig was generated from the following program with
+# systemd-coredump on RHEL 7.9 Workstation, kernel
+# 3.10.0-1160.105.1.el7.x86_64. liblgpllibs.so was packaged with
+# firefox-115.4.0-1.el7_9.x86_64.rpm.
+
+# #include <unistd.h>
+# #include <dlfcn.h>
+#
+# int main () {
+# dlopen ("/usr/lib64/firefox/liblgpllibs.so", RTLD_GLOBAL | RTLD_NOW);
+# sleep (60);
+# return 0;
+# }
+#
+# gcc -ldl -o test test.c
+
+tempfiles out
+testfiles testcore-noncontig
+
+testrun ${abs_builddir}/dwfl-core-noncontig testcore-noncontig
+
+# Remove parts of the output that could change depending on which
+# libraries are locally installed.
+testrun ${abs_top_builddir}/src/unstrip -n --core testcore-noncontig \
+ | sed 's/+/ /g' | cut -d " " -f1,3 | sort > out
+
+testrun_compare cat out <<\EOF
+0x400000 3a1748a544b40a38b3be3d2d13ffa34a2a5a71c0@0x400284
+0x7f14e357e000 edf51350c7f71496149d064aa8b1441f786df88a@0x7f14e357e1d8
+0x7f14e3794000 7615604eaf4a068dfae5085444d15c0dee93dfbd@0x7f14e37941d8
+0x7f14e3a96000 09cfb171310110bc7ea9f4476c9fa044d85baff4@0x7f14e3a96210
+0x7f14e3d9e000 e10cc8f2b932fc3daeda22f8dac5ebb969524e5b@0x7f14e3d9e248
+0x7f14e3fba000 fc4fa58e47a5acc137eadb7689bce4357c557a96@0x7f14e3fba280
+0x7f14e4388000 7f2e9cb0769d7e57bd669b485a74b537b63a57c4@0x7f14e43881d8
+0x7f14e458c000 62c449974331341bb08dcce3859560a22af1e172@0x7f14e458c1d8
+0x7f14e4795000 175efdcef445455872a86a6fbee7567ca16a513e@0x7f14e4795248
+0x7ffcfe59f000 80d79b32785868a2dc10047b39a80d1daec8923d@0x7ffcfe59f328
+EOF
+
+exit 0
--
2.41.0

View File

@ -1,16 +1,13 @@
%ifarch riscv64
%global debug_package %{nil}
%endif
Name: elfutils
Version: 0.187
%global baserelease 7
Version: 0.190
%global baserelease 3
Release: %{baserelease}.0.riscv64%{?dist}
URL: http://elfutils.org/
%global source_url ftp://sourceware.org/pub/elfutils/%{version}/
License: GPLv3+ and (GPLv2+ or LGPLv3+) and GFDL
License: GPL-3.0-or-later and (GPL-2.0-or-later or LGPL-3.0-or-later) and GFDL-1.3-no-invariants-or-later
Source: %{?source_url}%{name}-%{version}.tar.bz2
Source1: elfutils-debuginfod.sysusers
Source2: testcore-noncontig.bz2
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
# Needed for isa specific Provides and Requires.
@ -52,6 +49,8 @@ BuildRequires: iproute
BuildRequires: procps
BuildRequires: bsdtar
BuildRequires: curl
# For run-debuginfod-response-headers.sh test case
BuildRequires: socat
BuildRequires: automake
BuildRequires: autoconf
@ -60,30 +59,24 @@ BuildRequires: gettext-devel
%global _gnu %{nil}
%global _program_prefix eu-
%global provide_yama_scope 0
%global provide_yama_scope 0
%if 0%{?fedora} >= 22 || 0%{?rhel} >= 7
%global provide_yama_scope 1
%global provide_yama_scope 1
%endif
%global with_sysusers 0
%global with_sysusers 0
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
%global with_sysusers 1
%global with_sysusers 1
%endif
# Patches
# For s390x... FDO package notes are bogus.
Patch1: elfutils-0.186-fdo-swap.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2080957
Patch2: elfutils-0.187-csh-profile.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=29117
Patch3: elfutils-0.187-debuginfod-client-fd-leak.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=29122
Patch4: elfutils-0.187-mhd_no_dual_stack.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=29123
Patch5: elfutils-0.187-mhd_epoll.patch
# PR30975: Fix handling of corefiles with non-contiguous .so segments.
Patch2: elfutils-0.190-fix-core-noncontig.patch
%description
Elfutils is a collection of utilities, including stack (to show
@ -95,7 +88,7 @@ elfcompress (to compress or decompress ELF sections).
%package libs
Summary: Libraries to handle compiled objects
License: GPLv2+ or LGPLv3+
License: GPL-2.0-or-later or LGPL-3.0-or-later
%if 0%{!?_isa:1}
Provides: elfutils-libs%{depsuffix} = %{version}-%{release}
%endif
@ -118,7 +111,7 @@ libraries.
%package devel
Summary: Development libraries to handle compiled objects
License: GPLv2+ or LGPLv3+
License: GPL-2.0-or-later or LGPL-3.0-or-later
%if 0%{!?_isa:1}
Provides: elfutils-devel%{depsuffix} = %{version}-%{release}
%endif
@ -139,7 +132,7 @@ assembler interface.
%package libelf
Summary: Library to read and write ELF files
License: GPLv2+ or LGPLv3+
License: GPL-2.0-or-later or LGPL-3.0-or-later
%if 0%{!?_isa:1}
Provides: elfutils-libelf%{depsuffix} = %{version}-%{release}
%endif
@ -153,7 +146,7 @@ elfutils package use it also to generate new ELF files.
%package libelf-devel
Summary: Development support for libelf
License: GPLv2+ or LGPLv3+
License: GPL-2.0-or-later or LGPL-3.0-or-later
%if 0%{!?_isa:1}
Provides: elfutils-libelf-devel%{depsuffix} = %{version}-%{release}
%endif
@ -170,7 +163,7 @@ different sections of an ELF file.
%if %{provide_yama_scope}
%package default-yama-scope
Summary: Default yama attach scope sysctl setting
License: GPLv2+ or LGPLv3+
License: GPL-2.0-or-later or LGPL-3.0-or-later
Provides: default-yama-scope
BuildArch: noarch
# For the sysctl_apply macro we need systemd as build requires.
@ -204,7 +197,7 @@ profiling) of processes.
%package debuginfod-client
Summary: Library and command line client for build-id HTTP ELF/DWARF server
License: GPLv3+ and (GPLv2+ or LGPLv3+)
License: GPL-3.0-or-later and (GPL-2.0-or-later or LGPL-3.0-or-later)
%if 0%{!?_isa:1}
Provides: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release}
%endif
@ -214,7 +207,7 @@ Requires: elfutils-libelf%{depsuffix} = %{version}-%{release}
%package debuginfod-client-devel
Summary: Libraries and headers to build debuginfod client applications
License: GPLv2+ or LGPLv3+
License: GPL-2.0-or-later or LGPL-3.0-or-later
%if 0%{!?_isa:1}
Provides: elfutils-debuginfod-client-devel%{depsuffix} = %{version}-%{release}
%endif
@ -222,7 +215,7 @@ Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release}
%package debuginfod
Summary: HTTP ELF/DWARF file server addressed by build-id
License: GPLv3+
License: GPL-3.0-or-later
Requires: elfutils-libs%{depsuffix} = %{version}-%{release}
Requires: elfutils-libelf%{depsuffix} = %{version}-%{release}
Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release}
@ -234,7 +227,11 @@ BuildRequires: make
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%if %{with_sysusers}
%{?sysusers_requires_compat}
%else
Requires(pre): shadow-utils
%endif
# To extract .deb files with a bsdtar (= libarchive) subshell
Requires: bsdtar
@ -264,6 +261,8 @@ autoreconf -f -v -i
# are executable.
find . -name \*.sh ! -perm -0100 -print | xargs chmod +x
cp %{SOURCE2} tests
%build
# Remove -Wall from default flags. The makefiles enable enough warnings
# themselves, and they use -Werror. Appending -Wall defeats the cases where
@ -275,7 +274,14 @@ RPM_OPT_FLAGS="${RPM_OPT_FLAGS} -Wformat"
trap 'cat config.log' EXIT
%configure CFLAGS="$RPM_OPT_FLAGS" --enable-debuginfod-urls=https://debuginfod.fedoraproject.org/
# dist_debuginfod_url is defined in macros.dist. Fedora and CentOS have
# URLs pointing to their respective servers. RHEL and Amazon Linux do
# not configure a default server.
%if "%{?dist_debuginfod_url}"
%configure CFLAGS="$RPM_OPT_FLAGS" --enable-debuginfod-urls=%{dist_debuginfod_url}
%else
%configure CFLAGS="$RPM_OPT_FLAGS"
%endif
trap '' EXIT
%make_build
@ -351,6 +357,7 @@ fi
%{_bindir}/eu-ranlib
%{_bindir}/eu-readelf
%{_bindir}/eu-size
%{_bindir}/eu-srcfiles
%{_bindir}/eu-stack
%{_bindir}/eu-strings
%{_bindir}/eu-strip
@ -403,7 +410,9 @@ fi
%{_mandir}/man1/debuginfod-find.1*
%{_mandir}/man7/debuginfod*.7*
%config(noreplace) %{_sysconfdir}/profile.d/*
%if "%{?dist_debuginfod_url}"
%config(noreplace) %{_sysconfdir}/debuginfod/*
%endif
%files debuginfod-client-devel
%{_libdir}/pkgconfig/libdebuginfod.pc
@ -415,11 +424,11 @@ fi
%{_bindir}/debuginfod
%config(noreplace) %{_sysconfdir}/sysconfig/debuginfod
%{_unitdir}/debuginfod.service
%{_sysconfdir}/sysconfig/debuginfod
%if %{with_sysusers}
%{_sysusersdir}/elfutils-debuginfod.conf
%endif
%{_mandir}/man8/debuginfod.8*
%{_mandir}/man8/debuginfod*.8*
%dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod
%ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite
@ -442,9 +451,69 @@ exit 0
%systemd_postun_with_restart debuginfod.service
%changelog
* Thu Aug 04 2022 David Abdurachmanov <davidlt@rivosinc.com> - 0.187-7.0.riscv64
- Disable debug packages on riscv64
- Remove bcond
* Sat Nov 25 2023 David Abdurachmanov <davidlt@rivosinc.com> - 0.190-3.0.riscv64
- Ignore testsuite failures on riscv64
* Fri Nov 24 2023 Aaron Merey <amerey@fedoraproject.org> - 0.190-3
- Add elfutils-0.190-fix-core-noncontig.patch
* Fri Nov 3 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.190-2
- Update Fedora license tags to spdx license tags
* Fri Nov 3 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.190-1
- Upgrade to upstream elfutils 0.190
- Add eu-srcfiles
- Drop upstreamed patches
elfutils-0.189-relr.patch
elfutils-0.189-debuginfod_config_cache-double-close.patch
elfutils-0.189-elf_getdata_rawchunk.patch
elfutils-0.189-elfcompress.patch
elfutils-0.189-c99-compat.patch
- Only package debuginfod-client-config.7 manpage for debuginfod-client
* Thu Aug 24 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.189-6
- Update elfutils-0.189-relr.patch
* Wed Aug 23 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.189-5
- Add elfutils-0.189-relr.patch
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.189-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jun 22 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.189-3
- Add elfutils-0.189-elf_getdata_rawchunk.patch
- Add elfutils-0.189-debuginfod_config_cache-double-close.patch
* Sat Apr 22 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.189-2
- Add elfutils-0.189-c99-compat.patch
- Add elfutils-0.189-elfcompress.patch
* Fri Mar 3 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.189-1
- Upgrade to upsteam elfutils 0.189.
* Fri Jan 27 2023 Mark Wielaard <mjw@fedoraproject.org> - 0.188-5
- Add elfutils-0.188-deprecated-CURLINFO.patch,
elfutils-0.188-CURL_AT_LEAST_VERSION.patch and
elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.188-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Nov 7 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.188-3
- Add elfutils-0.188-compile-warnings.patch
- Add elfutils-0.188-debuginfod-client-lifetime.patch
* Wed Nov 2 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.188-2
- Add elfutils-0.188-static-extract_section.patch.
* Wed Nov 2 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.188-1
- Upgrade to upsteam elfutils 0.188.
* Wed Oct 5 2022 Amit Shah <amitshah@fedoraproject.org> - 0.187-9
- Auto-configure debuginfod_url based on macros.dist
* Wed Aug 24 2022 Debarshi Ray <rishi@fedoraproject.org> - 0.187-8
- Use %%sysusers_requires_compat to match %%sysusers_create_compat
* Wed Jul 27 2022 Amit Shah <amitshah@fedoraproject.org> - 0.187-7
- Allow building without default debuginfod URL

View File

@ -1 +1 @@
SHA512 (elfutils-0.187.tar.bz2) = a9b9e32b503b8b50a62d4e4001097ed2721d3475232a6380e6b9853bd1647aec016440c0ca7ceb950daf1144f8db9814ab43cf33cc0ebef7fc91e9e775c9e874
SHA512 (elfutils-0.190.tar.bz2) = 9c4f5328097e028286c42f29e39dc3d80914b656cdfbbe05b639e91bc787ae8ae64dd4d69a6e317ce30c01648ded10281b86a51e718295f4c589df1225a48102

BIN
testcore-noncontig.bz2 Normal file

Binary file not shown.

View File

@ -54,7 +54,7 @@ $(METADATA): Makefile
@echo "TestTime: 48h" >> $(METADATA)
@echo "RunFor: elfutils" >> $(METADATA)
@echo "Requires: elfutils" >> $(METADATA)
@echo "Requires: bash" >> $(METADATA)
@echo "Requires: bash bash-debuginfo" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)

View File

@ -2,15 +2,15 @@ summary: GNU-Attribute-notes-not-recognized
description: |
Bug summary: elfutils doesn't recognize GNU Attribute notes
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1650125
contact:
- Martin Cermak <mcermak@redhat.com>
contact: Martin Cermak <mcermak@redhat.com>
component:
- elfutils
- elfutils
test: ./runtest.sh
framework: beakerlib
recommend:
- elfutils
- bash
- elfutils
- bash
- bash-debuginfo
duration: 48h
extra-summary: /tools/elfutils/Regression/GNU-Attribute-notes-not-recognized
extra-task: /tools/elfutils/Regression/GNU-Attribute-notes-not-recognized

View File

@ -32,12 +32,35 @@ PACKAGE="elfutils"
rlJournalStart
rlPhaseStartTest
# Rely on that /bin/bash is annobin-annotated per
# - https://fedoraproject.org/wiki/Toolchain/Watermark
# - https://fedoraproject.org/wiki/Changes/Annobin
# Seems to work fine with bash-4.4.19-6.el8 and elfutils-0.174-5.el8.
set -o pipefail
rlRun "eu-readelf -n /bin/bash | grep -2 '^ GA' | fgrep 'GNU Build Attribute' | tail -50"
# Rely on that /bin/bash is annobin-annotated per
# - https://fedoraproject.org/wiki/Toolchain/Watermark
# - https://fedoraproject.org/wiki/Changes/Annobin
# Seems to work fine with bash-4.4.19-6.el8 and elfutils-0.174-5.el8.
f="/bin/bash"
# Annobin notes originally used to reside in the binary itself.
# Later on they moved to debuginfo.
# Let's see if we can chase down needed debuginfo somewhere...
# Attempt getting the needed file using debuginfod
export DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/
rlRun "f=\"$f $(debuginfod-find debuginfo /bin/bash)\""
# Attempt getting the needed file by traditional means
rlRun "debuginfo-install -y bash"
rlRun "buildid=$(eu-readelf -n /bin/bash | awk '/Build ID:/ {print $NF}')"
for i in $(rpm -ql bash-debuginfo); do
test -f $i || continue
if eu-readelf -n $i | fgrep $buildid; then
rlRun "f=\"$f $i\""
fi
done
set -o pipefail
export f
# Check if eu-readelf can read the notes from at least one of files
# that can possibly contain it...
rlRun "(for i in $f; do eu-readelf -n $i; done ) | grep -2 '^ GA' | fgrep 'GNU Build Attribute' | tail -50"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,4 @@
int main()
{
return 0;
}

View File

@ -0,0 +1,15 @@
summary: eu-elfcompress-breaks-hard-links
description: ''
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2188064
contact: Martin Cermak <mcermak@redhat.com>
component:
- elfutils
test: ./runtest.sh
framework: beakerlib
recommend:
- elfutils
- gcc
duration: 1h
extra-summary: /tools/elfutils/Regression/eu-elfcompress-breaks-hard-links
extra-task: /tools/elfutils/Regression/eu-elfcompress-breaks-hard-links

View File

@ -0,0 +1,55 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/elfutils/Regression/eu-elfcompress-breaks-hard-links
# Description: eu-elfcompress-breaks-hard-links
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2023 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="elfutils"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TMP=$(mktemp -d)"
rlRun "cp bubble.c $TMP/"
rlRun "pushd $TMP"
rlPhaseEnd
rlPhaseStartTest
rlRun "gcc -o a.out -g bubble.c"
rlRun "ln a.out a.lnk"
rlRun "eu-elfcompress -q -p -t none a.lnk"
rlRun "i0=$(stat -c '%i' a.out)"
rlRun "i1=$(stat -c '%i' a.lnk)"
rlRun "test $i0 -eq $i1"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMP"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd