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

autoPatchelfHook: fix bug introduced by #101142 #106830

Merged
merged 3 commits into from Dec 25, 2020

Conversation

DavHau
Copy link
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.

Copy link
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
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
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
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
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
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
Copy link
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
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants