ldd: trim leading and trailing white spaces from name
All checks were successful
Tests / Go tests (push) Successful in 33s
Nix / NixOS tests (push) Successful in 3m31s

Glibc emits ldd output with \t prefix for formatting. Remove that here.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2024-12-26 16:53:01 +09:00
parent dc579dc610
commit b956ce4052
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
2 changed files with 21 additions and 21 deletions

View File

@ -32,7 +32,7 @@ func Parse(stdout fmt.Stringer) ([]*Entry, error) {
switch len(segment) {
case 2: // /lib/ld-musl-x86_64.so.1 (0x7f04d14ef000)
iL = 1
result[i] = &Entry{Name: segment[0]}
result[i] = &Entry{Name: strings.TrimSpace(segment[0])}
case 4: // libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f04d14ef000)
iL = 3
if segment[1] != "=>" {
@ -42,7 +42,7 @@ func Parse(stdout fmt.Stringer) ([]*Entry, error) {
return nil, ErrPathNotAbsolute
}
result[i] = &Entry{
Name: segment[0],
Name: strings.TrimSpace(segment[0]),
Path: segment[2],
}
default: