Skip to content

autoPatchelfHook: fix bug introduced by #101142#106830

Merged
FRidh merged 3 commits intoNixOS:masterfrom
DavHau:fix-autopatchelfhook
Dec 25, 2020
Merged

autoPatchelfHook: fix bug introduced by #101142#106830
FRidh merged 3 commits intoNixOS:masterfrom
DavHau:fix-autopatchelfhook

Conversation

@DavHau
Copy link
Copy Markdown
Member

@DavHau DavHau commented Dec 13, 2020

Fixes breakage intrduced by #101142

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • 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"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@DavHau DavHau requested a review from Ericson2314 as a code owner December 13, 2020 14:22
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels Dec 13, 2020
Copy link
Copy Markdown
Member

@eadwu eadwu left a comment

Choose a reason for hiding this comment

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

Fixes the issue on my end.

@numinit
Copy link
Copy Markdown
Contributor

numinit commented Dec 13, 2020

Seems to fix it. While we're here, maybe we should clean up the Shellcheck warnings, and note why we should ignore the return value in a comment:

$ shellcheck --shell=bash build-support/setup-hooks/auto-patchelf.sh

In ../../../../build-support/setup-hooks/auto-patchelf.sh line 14:
addEnvHooks "$targetOffset" gatherLibraries
             ^-----------^ SC2154: targetOffset is referenced but not assigned.


In ../../../../build-support/setup-hooks/auto-patchelf.sh line 119:
        if [ -n "$runtimeDependencies" ]; then
                 ^------------------^ SC2154: runtimeDependencies is referenced but not assigned.


In ../../../../build-support/setup-hooks/auto-patchelf.sh line 132:
    local missing="$(
          ^-----^ SC2155: Declare and assign separately to avoid masking return values.


In ../../../../build-support/setup-hooks/auto-patchelf.sh line 178:
      $(find "$@" "${findOpts[@]}" \! -type d \
      ^-- SC2044: For loops over find output are fragile. Use find -exec or a while read loop.


In ../../../../build-support/setup-hooks/auto-patchelf.sh line 214:
      [ -n "$(echo "$segmentHeaders" | grep '^Program Headers:')" ] || continue
        ^-- SC2143: Use grep -q instead of comparing output with [ -n .. ].


In ../../../../build-support/setup-hooks/auto-patchelf.sh line 217:
          [ -n "$(echo "$segmentHeaders" | grep "^ *INTERP\\>")" ] || continue
            ^-- SC2143: Use grep -q instead of comparing output with [ -n .. ].


In ../../../../build-support/setup-hooks/auto-patchelf.sh line 233:
    if [[ $depsMissing == 1 && -z "$autoPatchelfIgnoreMissingDeps" ]]; then
                                   ^----------------------------^ SC2154: autoPatchelfIgnoreMissingDeps is referenced but not assigned.


In ../../../../build-support/setup-hooks/auto-patchelf.sh line 247:
postFixupHooks+=('
                 ^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.

For more information:
  https://www.shellcheck.net/wiki/SC2044 -- For loops over find output are fr...
  https://www.shellcheck.net/wiki/SC2154 -- autoPatchelfIgnoreMissingDeps is ...
  https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ...

@numinit
Copy link
Copy Markdown
Contributor

numinit commented Dec 13, 2020

All the SC2154 warnings look like they're all input variables, so those can probably be silenced FWIW.

@DavHau
Copy link
Copy Markdown
Member Author

DavHau commented Dec 14, 2020

Fixed or silenced all red and orange shellcheck warnings. Please review

@numinit numinit self-requested a review December 14, 2020 17:45
@FRidh FRidh changed the base branch from master to staging December 17, 2020 06:35
@FRidh FRidh changed the base branch from staging to master December 17, 2020 06:35
@FRidh
Copy link
Copy Markdown
Member

FRidh commented Dec 17, 2020

Let's keep this targeting master, rebuilds of packages that need patchelf are typically fast.

@drewrisinger drewrisinger mentioned this pull request Dec 17, 2020
10 tasks
Copy link
Copy Markdown
Contributor

@numinit numinit left a comment

Choose a reason for hiding this comment

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

Overall looks good, a comment on ldd to explain why we're ignoring that return would be helpful before committing but I'm approving since others are blocked on this review.

@DavHau DavHau force-pushed the fix-autopatchelfhook branch from 9506bfc to e815bf1 Compare December 20, 2020 08:26
@DavHau
Copy link
Copy Markdown
Member Author

DavHau commented Dec 20, 2020

I added a comment explaining why we return on a failing ldd/sed command.

@FRidh FRidh merged commit 2efcf6d into NixOS:master Dec 25, 2020
Comment on lines +1 to +2
#!/usr/bin/env bash

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the reason for this? The file is not executable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added this to make shellcheck happy.

aszlig added a commit to aszlig/nixpkgs that referenced this pull request Jan 9, 2021
I really hate the very concept of this file (the reason being that I
think "owner" implies some form of BDFL rather than just being
notified), but since there were recent[1] changes[2] in auto-patchelf.sh
which I missed it's probably a good idea to add myself there solely for
being notified, because ofborg can't seem to infer maintainer
information here.

To make indentation consistent with all the other entries in the
codeowners file, I also re-indented the other entries in the "Nixpkgs
Internals" block.

[1]: NixOS#101142
[2]: NixOS#106830

Signed-off-by: aszlig <aszlig@nix.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants