You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A more descriptive error should be added and, hopefully, a way to detect when we can actually patchelf a file to add a dependency to it without needing to resort to parsing the ELF on the caller side.
patchelf --version output
patchelf 0.18.0
Additional context
This actually originated from NixOS/nixpkgs#361077 as in the dotnet infra, we patch binaries in NuGet packages used in buildDotnetModule so that they use the correct interpreter, have the required .NET dependencies that are dynamically loaded and more.
The file is accompanied by an actual binary called FunctionsNetHost, and they both only differ through their Type and lack of interpreter name on the .dbg file:
$ nix-shell -p binutils --run 'readelf --file-header contentFiles/any/any/workers/dotnet-isolated/bin/FunctionsNetHost.dbg'ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: DYN (Shared object file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x161c0 Start of program headers: 64 (bytes into file) Start of section headers: 34132072 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 12 Size of section headers: 64 (bytes) Number of section headers: 49 Section header string table index: 48readelf: Error: Unable to find program interpreter name
$ nix-shell -p binutils --run 'readelf --file-header contentFiles/any/any/workers/dotnet-isolated/bin/FunctionsNetHost'ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: DYN (Position-Independent Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x161c0 Start of program headers: 64 (bytes into file) Start of section headers: 12158360 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 12 Size of section headers: 64 (bytes) Number of section headers: 37 Section header string table index: 36
The text was updated successfully, but these errors were encountered:
Describe the bug
An assertion is hit on a call to
--add-needed
on a.dbg
file.The file has no
.interp
section so I assume that might be related (or not).Steps To Reproduce
.dbg
file from my mirror (https://dl.ggg.dev/FunctionsNetHost.dbg).patchelf
the file to--add-needed libicui18n.so --add-needed libicuuc.so --add-needed libz.so --add-needed libssl.so
(full command:/nix/store/0bm0ay014jqqa818pqpp6rcd6a91jjc5-patchelf-0.18.0-unstable-2024-06-15/bin/patchelf --add-needed libicui18n.so --add-needed libicuuc.so --add-needed libz.so --add-needed libssl.so microsoft.azure.functions.dotnetisolatednativehost/1.0.11/contentFiles/any/any/workers/dotnet-isolated/bin/FunctionsNetHost.dbg
).patchelf: patchelf.cc:1095: void setSubstr(std::string&, unsigned int, const std::string&): Assertion `pos + t.size() <= s.size()' failed.
Expected behavior
A more descriptive error should be added and, hopefully, a way to detect when we can actually
patchelf
a file to add a dependency to it without needing to resort to parsing the ELF on the caller side.patchelf --version
outputpatchelf 0.18.0
Additional context
This actually originated from NixOS/nixpkgs#361077 as in the dotnet infra, we patch binaries in NuGet packages used in
buildDotnetModule
so that they use the correct interpreter, have the required .NET dependencies that are dynamically loaded and more.The file is accompanied by an actual binary called
FunctionsNetHost
, and they both only differ through theirType
and lack of interpreter name on the.dbg
file:The text was updated successfully, but these errors were encountered: