Skip to content

pkg/ldd: show Stderr output of interpreter in case of ExitError#2710

Merged
rminnich merged 2 commits into
u-root:mainfrom
jochil:ldd-more-details-on-runinterp-error
Jul 1, 2023
Merged

pkg/ldd: show Stderr output of interpreter in case of ExitError#2710
rminnich merged 2 commits into
u-root:mainfrom
jochil:ldd-more-details-on-runinterp-error

Conversation

@jochil
Copy link
Copy Markdown
Contributor

@jochil jochil commented Jun 28, 2023

When using ldd.Ldd() on a executable with a missing shared object the error message contains just the exit code.

Example:
Having this executable:

ldd my_test                              
	foobar.so => not found
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f908f7b0000)
       ...

The error will read exit status 127 without information about the missing shared object. With this change the actual interpreter error will be added. For the above example this will result in the following errror exit status 127: my_test: error while loading shared libraries: foobar.so: cannot open shared object file: No such file or directory

@jochil jochil force-pushed the ldd-more-details-on-runinterp-error branch from ff7fd8f to 957ded8 Compare June 28, 2023 15:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 28, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01 ⚠️

Comparison is base (70b0606) 75.36% compared to head (b85a9df) 75.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2710      +/-   ##
==========================================
- Coverage   75.36%   75.35%   -0.01%     
==========================================
  Files         414      414              
  Lines       42231    42233       +2     
==========================================
  Hits        31826    31826              
- Misses      10405    10407       +2     
Impacted Files Coverage Δ
pkg/ldd/ldd_unix.go 78.64% <0.00%> (-1.56%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

... to have more information about the missing shared library

Co-authored-by: Maren Sandner <maren.sandner@code-intelligence.com>
Signed-off-by: Jochen <jochen.hilgers@gmail.com>
@jochil jochil force-pushed the ldd-more-details-on-runinterp-error branch from 957ded8 to bb6eeee Compare June 28, 2023 15:57
Copy link
Copy Markdown
Member

@rminnich rminnich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice, if you can figure out a test, that would be good, but ... it does seem kinda hard :-)

@rminnich rminnich added automerge Applying this label auto-merges the PR when ready Awaiting author Waiting for new changes or feedback for author. labels Jun 30, 2023
@rminnich rminnich merged commit 921c08d into u-root:main Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Applying this label auto-merges the PR when ready Awaiting author Waiting for new changes or feedback for author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants