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

buildEnv: Check the content of colliding paths. #5096

Merged
merged 2 commits into from
Jan 19, 2016

Conversation

aszlig
Copy link
Member

@aszlig aszlig commented Nov 23, 2014

Originally wanted to include ignoreCollisions in cups-progs, but I think it's better if we use ignoreCollisions only if there are real collisions between files with different contents.

Of course, we also check whether the file permissions match, so you get a collision if contents are the same but the permissions are different.

Cc for review to @edolstra and @domenkozar

@aszlig aszlig added the 9.needs: reporter feedback This issue needs the person who filed it to respond label Nov 23, 2014
@aszlig aszlig self-assigned this Nov 23, 2014
@aszlig aszlig force-pushed the buildenv-check-collision-contents branch from 032a96b to 7f5958c Compare November 23, 2014 19:55
@peti
Copy link
Member

peti commented Nov 23, 2014

+1. Nice feature.

@lucabrunox
Copy link
Contributor

Doesn't enabling this by default break nixos-rebuild? nixos-rebuild by default ignores collisions, so checking the contents may break nixos-rebuild, am I wrong?

@wmertens
Copy link
Contributor

This will also catch non-deterministic builds, something we can't do much about, right? So should there be a whitelist?

@aszlig
Copy link
Member Author

aszlig commented Nov 23, 2014

@lethalman: It doesn't change anything in regards to nixos-rebuild, because whenever ignoreCollisions is active, this will still ignore collisions the same way.

However, one particular thing could be done better: If ignoreCollisions is true, skip the content check entirely. Fixing...

@edolstra
Copy link
Member

Do you have an example of a collision that would be prevented by this?

@aszlig
Copy link
Member Author

aszlig commented Nov 24, 2014

@edolstra: This one for example: https://headcounter.org/hydra/build/583003/nixlog/1/raw
But we could probably also avoid using ignoreCollisions for building the system path, firmware or ghcWithPackages.

@aszlig
Copy link
Member Author

aszlig commented Nov 24, 2014

Hm, never mind about the CUPS one, they do have different contents, actually. But I'd prefer to get out ignoreCollisions as much as possible, especially when it comes to the system path. So you only get collisions/warnings about files which actually have different content and might be a real problem.

@7c6f434c
Copy link
Member

7c6f434c commented Apr 4, 2015

Is there any reason not to merge it? Removing ignoreCollisions from ghcWithPackages sounds like a good idea.

@aszlig
Copy link
Member Author

aszlig commented Apr 4, 2015

It would also reduce the noise printed by buildEnv. @edolstra any objections?

@edolstra
Copy link
Member

Where exactly do we have collisions between binaries with the same name and identical contents?

@aszlig
Copy link
Member Author

aszlig commented Apr 13, 2015

@edolstra: One thing that comes immediately into my mind would be reducing the noise while building the system-path. And ghcWithPackages as @7c6f434c pointed out already.

@peti
Copy link
Member

peti commented Apr 13, 2015

ghcWithPackages does not use ignoreCollisions = true. Even if it would, I am not aware of any case where identical files would collide.

@vcunat
Copy link
Member

vcunat commented Apr 18, 2015

@aszlig: does this address the problem I see on IRC that a directory won't merge with a valid symlink to a directory?

@aszlig
Copy link
Member Author

aszlig commented Apr 19, 2015

@vcunat: It doesn't handle directories at all, nor does it dereference symlinks, but the checkCollision could be extended to handle that as well.

@bennofs
Copy link
Contributor

bennofs commented Aug 24, 2015

👍 I've had collisions between identical files quite often with texlive if I recall correctly, since texlive symlinks a lot of tools.

@vcunat
Copy link
Member

vcunat commented Aug 24, 2015

Hehe, texlive won't be an issue any longer (also in this respect). I'll post updates to #287 when I get a little further (or request on IRC/mail if you hurry).

@DamienCassou
Copy link
Contributor

What is the status of this?

@domenkozar
Copy link
Member

I'd like to merge this, @aszlig can you rebase?

Originally wanted to include ignoreCollisions in cups-progs, but I think
it's better if we use ignoreCollisions only if there are _real_
collisions between files with different contents.

Of course, we also check whether the file permissions match, so you get
a collision if contents are the same but the permissions are different.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Checking file contents is redundant in this case, because we will go
ahead anyway, regardless of whether the content is the same.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
@aszlig aszlig force-pushed the buildenv-check-collision-contents branch from b8db5af to bfb11fd Compare January 18, 2016 03:12
@aszlig
Copy link
Member Author

aszlig commented Jan 18, 2016

@domenkozar: Rebased.

domenkozar added a commit that referenced this pull request Jan 19, 2016
buildEnv: Check the content of colliding paths.
@domenkozar domenkozar merged commit 3b381d3 into NixOS:master Jan 19, 2016
aszlig added a commit that referenced this pull request Jan 28, 2016
Regression introduced by 4529ed1.

I've missed this in #5096, not because of a messed up rebase as I have
guessed from a comment on #12635 but missed this in the first place.

The testing I did while working on the pull request weren't exhaustive
enough to cover this, because I haven't tested with packages that use
the propagatedUserEnvPkgs attribute.

In order to make the test a bit more exhaustive this time, let's test it
using:

nix-build -E 'with import ./. {}; buildEnv {
  name = "testenv";
  paths = [
    pkgs.hello pkgs.binutils pkgs.libsoup pkgs.gnome3.yelp
    pkgs.gnome3.totem
  ];
}'

And with this commit the errors no longer show up and the environment is
built correctly.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Fixes: #12635
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement Add something new 2.status: work-in-progress This PR isn't done 8.has: clean-up 9.needs: changelog 9.needs: reporter feedback This issue needs the person who filed it to respond
Projects
None yet
Development

Successfully merging this pull request may close these issues.