patchelf
patchelf copied to clipboard
Patchelf set-rpath fails on Fedora 41 beta
Describe the bug
Executables which have the rpath set give a segfault on the beta Fedora 41.
Steps To Reproduce
Basic hello world
mytest.c:
#include <stdio.h>
int main()
{
printf("hello, world!\n");
return 0;
}
$ gcc -o mytest mytest.c
$ patchelf --set-rpath '/usr/lib' ./mytest
$ ./mytest
Segmentation fault (core dumped)
Please include exact steps with an attached binary so that another person can reproduce the problem.
Expected behavior
Should not fail.
patchelf --version output
patchelf 0.18.0
Additional context Originally reported in this Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=2319341
Possibly related is a segmentation fault in a meson-python test that fiddles with rpaths: https://bugzilla.redhat.com/show_bug.cgi?id=2321588, https://github.com/mesonbuild/meson-python/issues/698
I am not entirely sure the meson-python issue is caused by the same thing. It only now started to happen since this binutils commit: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bf6d7087de0a7351fd1dfd5f41522a7f4f576180
For the record, this is still an ongoing issue. Would upstream want some help setting up a CI to cover Fedora? In the meantime LIEF also works, but it doesn't have a compatible interface. A compatibility shim can be created though
@LecrisUT LIEF recently announced a drop-in-replacement of patchelf command line utility.
https://lief.re/blog/2025-07-13-patchelf/