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

git: fix bad patch and fix run-time dependency on gcc #64395

Merged

Conversation

@demin-dmitriy
Copy link
Contributor

commented Jul 6, 2019

Motivation for this change

Fixes the issue #64350 .

Problem was that in previous version of git git-stash was a shell script, but now it's a symlink to git. postInstall tried to patch it (in-place) as if it was a script, but instead replaced symlink with a corrupted git copy. strip refused to strip symbols from it, so debug information with references to gcc was left in the resulting package.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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.

@gloaming might want to take a look at it.

git: remove runtime dependency on gcc
Reduces gitMinimal closure size from 329.6M to 174.8M.

Fixes the issue #64350.

In git 2.22.0 git-stash is no longer a shell script and now it is just a symlink to git.
`postInstall` assumed that it was a shell script, tried to patch it and
ended up corrupting the file and made `strip` refuse stripping it.
@demin-dmitriy

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2019

I'm uncertain about second commit which adds a sanity check isScript because it adds more to already bloated postInstall script. Maybe postInstall should be refactored, but I'm not ready for that.

@LnL7

This comment has been minimized.

Copy link
Member

commented Jul 6, 2019

Might be a good idea to add this to avoid similar issues like this in the future.

  disallowedReferences = [ stdenv.cc ];
perl -0777 -i -pe "$SCRIPT" \
$out/libexec/git-core/git-{sh-setup,filter-branch,merge-octopus,mergetool,quiltimport,request-pull,submodule,subtree,web--browse}
perl -0777 -i -pe "$SCRIPT" $out/libexec/git-core/git-sh-setup

This comment has been minimized.

Copy link
@gloaming

gloaming Jul 6, 2019

Contributor

How come git-sh-setup is handled separately now?

perl -0777 -i -pe "$SCRIPT" $out/libexec/git-core/git-sh-setup
for git_script in $out/libexec/git-core/git-{filter-branch,merge-octopus,mergetool,quiltimport,request-pull,submodule,subtree,web--browse}; do
isScript $git_script || (echo "$git_script is not a script. Can't patch it."; exit 1)

This comment has been minimized.

Copy link
@gloaming

gloaming Jul 8, 2019

Contributor
Suggested change
isScript $git_script || (echo "$git_script is not a script. Can't patch it."; exit 1)
isScript $git_script || (echo "$git_script is not a script. Can't patch it." >&2; exit 1)

@demin-dmitriy demin-dmitriy force-pushed the demin-dmitriy:fix-git-runtime-dependency-on-gcc branch from 3b73121 to ae2082a Jul 10, 2019

@lheckemann

This comment has been minimized.

Copy link
Member

commented Jul 16, 2019

@GrahamcOfBorg build git

@gloaming
Copy link
Contributor

left a comment

What happened to the isScript check? I don't think it's a good idea to leave it out, given that this wasn't caught by the testsuite last time.

@FRidh FRidh changed the base branch from master to staging Jul 17, 2019

@FRidh FRidh merged commit ea688c0 into NixOS:staging Jul 17, 2019

16 checks passed

Evaluation Performance Report Evaluator Performance Report
Details
git on aarch64-linux Success
Details
git on x86_64-darwin Success
Details
git on x86_64-linux Success
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.