Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
base: 8d865c95152f
Choose a base ref
...
head repository: NixOS/nixpkgs
compare: 19e83bc2ba2b
Choose a head ref
  • 5 commits
  • 3 files changed
  • 2 contributors

Commits on Sep 23, 2018

  1. autoPatchelfHook: do not patch statically linked files

    Also speed up quite significantly due less forking.
    Mic92 committed Sep 23, 2018
    Copy the full SHA
    58a97df View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2018

  1. autoPatchelfHook: Only check PT_INTERP on execs

    If the ELF file is not an executable, we do not get a PT_INTERP section,
    because after all, it's a *shared* library.
    
    So instead of checking for PT_INTERP (to avoid statically linked
    executables) for all ELF files, we add another check to see if it's an
    executable and *only* skip it when it is and there's no PT_INTERP.
    
    Signed-off-by: aszlig <aszlig@nix.build>
    aszlig committed Sep 25, 2018
    Copy the full SHA
    9920215 View commit details
    Browse the repository at this point in the history
  2. autoPatchelfHook: Silence errors in isExecutable

    The "maxx" package recursively runs isExecutable on a bunch of files and
    since the change to use "readelf" instead of "file" a lot of errors like
    this one are printed during build:
    
      readelf: Error: Not an ELF file - it has the wrong magic bytes at the
      start
    
    While the isExecutable was never meant to be used outside of the
    autoPatchelfHook, it's still a good idea to silence the errors because
    whenever readelf fails, it clearly indicates that the file in question
    is not a valid ELF file.
    
    Signed-off-by: aszlig <aszlig@nix.build>
    aszlig committed Sep 25, 2018
    Copy the full SHA
    b452604 View commit details
    Browse the repository at this point in the history
  3. elasticsearch: Add zlib to buildInputs for unfree

    The unfree variant of elasticsearch uses autoPatchelfHook and since we
    removed the dependency on file for the hook itself in
    58a97df we no longer have zlib
    propagated.
    
    So we need to explicitly state that dependency here.
    
    Signed-off-by: aszlig <aszlig@nix.build>
    Cc: @apeschar, @basvandijk
    aszlig committed Sep 25, 2018
    Copy the full SHA
    8df68a9 View commit details
    Browse the repository at this point in the history
  4. Merge autoPatchelfHook improvements (#47222)

    This includes the initialy commit was done by @Mic92 plus a few fixes
    from my side. So essentially this avoids patching statically linked
    executables and also speeds up searching for ELF files altogether.
    
    I've tested this by comparing the outputs of all the derivations which
    make use of this hook using the following Nix expression:
    
      let
        getPackagesForRev = rev: with import (builtins.fetchGit {
          url = ./.;
          inherit rev;
        }) { config.allowUnfree = true; }; [
          cups-kyodialog3 elasticsearch franz gurobi javacard-devkit
          masterpdfeditor maxx oracle-instantclient powershell reaper
          teamviewer unixODBCDrivers.msodbcsql17 virtlyst wavebox zoom-us
        ];
    
        pkgs = import <nixpkgs> {};
        baseRev = "ef764eb0d8314b81a012dae04642b4766199956d";
    
      in pkgs.runCommand "diff-contents" {
        chset = pkgs.lib.zipListsWith (old: new: pkgs.runCommand "diff" {
          inherit old new;
          nativeBuildInputs = [ pkgs.nukeReferences ];
        } ''
          mkdir -p "''${NIX_STORE#/}"
          cp --no-preserve=all -r "$old" "''${NIX_STORE#/}"
          cp --no-preserve=all -r "$new" "''${NIX_STORE#/}"
          find "''${old#/}" "''${new#/}" \
            \( -type f -exec nuke-refs {} + \) -o \( -type l -delete \)
          mkdir "$out"
          echo "$old" > "$out/old-path"
          echo "$new" > "$out/new-path"
          diff -Nur "''${old#/}" "''${new#/}" > "$out/diff" || :
        '') (getPackagesForRev baseRev) (getPackagesForRev "");
      } ''
        err=0
        for c in $chset; do
          if [ -s "$c/diff" ]; then
            echo "$(< "$c/old-path") -> $(< "$c/new-path")" \
                 "differs, report: $c/diff" >&2
            err=1
          fi
        done
        [ $err -eq 0 ] && touch "$out"
      ''
    
    With these changes there is only one derivation which has altered
    contents, which is "franz". However the reason why it has differing
    contents is not directly because of the autoPatchelfHook changes, but
    because the "env-vars" file from the builder is in
    "$out/opt/franz/env-vars" (Cc: @gnidorah) and we now have different
    contents for NIX_CFLAGS_COMPILE and other environment variables.
    
    I also tested this against a random static binary and the hook no longer
    tries to patch it.
    
    Merges: #47222
    aszlig committed Sep 25, 2018
    Copy the full SHA
    19e83bc View commit details
    Browse the repository at this point in the history