Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patchelf: add patch: false alarm for non overlapping sections #106340

Closed
wants to merge 1 commit into from

Conversation

Yarny0
Copy link
Contributor

@Yarny0 Yarny0 commented Dec 8, 2020

Motivation for this change

Starting with version 0.12, patchelf sometimes returns an error complaining about overlapping sections. The build of tsm-client reports the following error message

unsupported overlap of SHT_NOTE and PT_NOTE

see #106257

There is a patch available in this patchelf pull request: NixOS/patchelf#230
The pull request at hand adds the patch to the nixpkgs patchelf build recipe. This fixes the tsm-client package, maybe more.

Note on local tests

Due to lack of machine power, I cannot fully test this commit. It tries to rebuild stdenv again, and would even try to build the whole world to obtain a NixOS system for testing.
However, I tested the patch by building the attached recipe with current nixos-unstable (83cbad92d73) and also with current nixos-20.09 (3a02dc9edb2). This generates a working patchelf alone, then uses a modified autoPatchelfHook to inject the fixed patchelf into the PATH of the tsm-client build. It makes tsm-client build correctly (on unstable and on 20.09).
Note that the attached recipe below can also be used as a workaround to build a working tsm-client.

tsm-client-fix.nix.txt

Notifying patchelf maintainer: @edolstra

Things done

See the note on local tests above.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS: x86_64
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip": too much
  • Tested execution of all binary files (usually in ./result/bin/): indirectly tested, by building tsm-client
  • Determined the impact on package closure size (by running nix path-info -S before and after): 39,441,192 Bytes + 240 Bytes = 39,441,432 Bytes (this is the increase measured with the patchelf build by the attached recipe)
  • Ensured that relevant documentation is up to date: no changes needed
  • Fits CONTRIBUTING.md.

@Yarny0
Copy link
Contributor Author

Yarny0 commented Dec 8, 2020

Oh no. This patch was actually intended for staging. But I also see a branch called staging-patchelf. Not sure which one is correct. Should I re-create the pull request with one of those branches? Sorry for the confusion!

@domenkozar
Copy link
Member

Are you sure it fixes the problem? My testing of NixOS/patchelf#255 shows that the error still persists

@Yarny0
Copy link
Contributor Author

Yarny0 commented Dec 10, 2020

Are you sure it fixes the problem? My testing of NixOS/patchelf#255 shows that the error still persists

No. Sorry! I probably glanced over the error messages too quickly and failed to spot the difference. I just tested NixOS/patchelf#255 and the error persists with the patch attached in the pull request at hand.

However, it does fix the tsm-client build. So these are likely two different bugs.

I'll update the commit message and the text of my pull request accordingly.

Starting with version 0.12, patchelf sometimes returns
an error complaining about overlapping sections:

> unsupported overlap of SHT_NOTE and PT_NOTE

This issue was reported for tsm-client:

NixOS#106257

There is a patch available in this pull request:

NixOS/patchelf#230

This patch fixes tsm-client, maybe other packages as well.

This commit adds the patch to the nixpkgs patchelf build recipe.

Note that the patch may also be downloaded directly here:

https://github.com/NixOS/patchelf/pull/230.patch

However, in contrast to common nixpkgs policy,
the patch is not fetched with fetchpatch,
but is copied directly into nixpkgs tree.
This is necessary because patchelf
is a dependency of fetchpatch.
See also the note at the top of the patchelf build recipe
in pkgs/development/tools/misc/patchelf/default.nix .
@stale
Copy link

stale bot commented Jun 9, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 9, 2021

for (unsigned int j = 0; j < phdrs.size(); ++j)
- if (rdi(phdrs[j].p_type) == PT_NOTE) {
+ if (rdi(phdrs[j].p_type) == PT_NOTE && noted_phdrs.find(j) == noted_phdrs.end()) {
Copy link
Member

Choose a reason for hiding this comment

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

I can also make a release of patchelf itself.

@stale stale bot removed 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md labels Aug 28, 2021
@domenkozar
Copy link
Member

This is part of patchelf 0.13.

@domenkozar domenkozar closed this Aug 28, 2021
@Yarny0 Yarny0 deleted the patchelf branch September 4, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants