Closed demin-dmitriy closed 5 years ago
$ cd $(nix-build . -A gitMinimal --no-out-link)
$ nix-store -q --tree . | grep 'gcc-7.4.0 '
| +---/nix/store/n4q167a25rkvb043rf0sw7z4cixgv48x-gcc-7.4.0 [...]
$ ag -u n4q167a25rkvb043rf0sw7z4cixgv48x
Binary file libexec/git-core/git-stash matches.
$ strings libexec/git-core/git-stash | ag n4q167a25rkvb043rf0sw7z4cixgv48x
/nix/store/n4q167a25rkvb043rf0sw7z4cixgv48x-gcc-7.4.0/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/include
** repeated 330 times **
/nix/store/n4q167a25rkvb043rf0sw7z4cixgv48x-gcc-7.4.0/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/crtbegin.o
/nix/store/n4q167a25rkvb043rf0sw7z4cixgv48x-gcc-7.4.0/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/crtend.o
No idea.
The breaking commit is eeb9e6c7623450f0cb986d315d7813abd59f041d which just bumps git version. Maybe they added -g
flag to their makefile or something like that.
(master)$ ag 'CFLAGS.*-g' Makefile
1155:CFLAGS = -g -O2 -Wall
Removing it doesn't help, though. I think stripping would remove anything from -g
, anyway.
The upstream commit that breaks it is: https://github.com/git/git/commit/40af14683432285b94407e8488eab6942d0779dc But I don't see why.
N.B. They broke the (Nix) build around here as well, use this to get it working:
diff --git a/contrib/subtree/Makefile b/contrib/subtree/Makefile
index 6906aae441..eaee2ac8d6 100644
--- a/contrib/subtree/Makefile
+++ b/contrib/subtree/Makefile
@@ -4,7 +4,7 @@ all::
-include ../../config.mak.autogen
-include ../../config.mak
-prefix ?= /usr/local
+prefix ?= $(out)
gitexecdir ?= $(prefix)/libexec/git-core
mandir ?= $(prefix)/share/man
man1dir ?= $(mandir)/man1
I don't completely understand what's happening but I'm pretty sure that postInstall script is breaking it. If I understood correctly git-stash used to be a shell script, and now it's a symlink. This patch fixes the issue.
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index 7d0b28bd6cc..e49c4ad57b8 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -162,7 +162,7 @@ stdenv.mkDerivation {
EOS
)"
perl -0777 -i -pe "$SCRIPT" \
- $out/libexec/git-core/git-{sh-setup,filter-branch,merge-octopus,mergetool,quiltimport,request-pull,stash,submodule,subtree,web--browse}
+ $out/libexec/git-core/git-{sh-setup,filter-branch,merge-octopus,mergetool,quiltimport,request-pull,submodule,subtree,web--browse}
# Also put git-http-backend into $PATH, so that we can use smart
I haven't tested this on master yet. What I don't understand is why resulting package is even working after that script.
A-ha. I understand what's happening on master. I'm not sure why I see something different on eeb9e6c.
That perl script is overwriting symlink to git with a copy of git. And it also incorrectly patches it so strip
refuses to work on it:
strip:out/libexec/git-core/git-stash: file format not recognized
(this error is ignored and silenced to /dev/null, so you won't see it in build log)
Anyway, I'll make a pull request.
Nice! Yes, I saw that strip
,lld
, and nm
barfed on it but I thought it was some kind of linker error - didn't realise it was getting mutilated!
That postInstall
script is horrendous. I take it you intend to make it check the files are actually scripts first - this could easily happen again with a different git
command, plus it wastes disk space :)
Yeah, it's amazing the binaries still worked at all!
I think this issue can be closed, right?
Right. I forgot that it was still open.
Issue description
On current master c7276b2b3d05e5191a9b5b7236d63edf49204f79 package gitMinimal depends on gcc, which blows up it's closure size.
Steps to reproduce
Technical details
On very old version of nixpkgs (6c064e6b1f34a8416f990db0cc617a7195f71588) there was no such problem: