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

@demin-dmitriy demin-dmitriy 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.

Reduces gitMinimal closure size from 329.6M to 174.8M.

Fixes the issue NixOS#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
Copy link
Contributor Author

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
Copy link
Member

LnL7 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
Copy link
Contributor

Choose a reason for hiding this comment

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

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 fix-git-runtime-dependency-on-gcc branch from 3b73121 to ae2082a Compare July 10, 2019 18:44
@lheckemann
Copy link
Member

@GrahamcOfBorg build git

Copy link
Contributor

@gloaming gloaming left a comment

Choose a reason for hiding this comment

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

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 July 17, 2019 08:32
@FRidh FRidh merged commit ea688c0 into NixOS:staging Jul 17, 2019
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