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
warn differently about collisions of identical paths #41144
Conversation
@@ -110,7 +110,7 @@ sub findFiles { | |||
} | |||
|
|||
unless (-d $target && ($oldTarget eq "" || -d $oldTarget)) { | |||
if ($ignoreCollisions) { | |||
if ($ignoreCollisions && !checkCollision($oldTarget, $target)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also obey checkCollisionContents
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my reading of the code is that we have three possibilities:
- ignore collisions with a warning
- silently allow collisions, only if file contents are identical
- don't allow any collisions at all
ignoreCollisions
tells us if we're in case 1 or not. Then only if not, checkCollisionContents
tells us if we're in 2 or 3.
Since all I'm aiming for is silencing meaningless warnings in case 1, I didn't think checkCollisionContents
was relevant.
We should aim at not having duplicate files. These warnings are needed in order to find them and therefore I'm of the opinion we should not silence them. In your case (https://discourse.nixos.org/t/collisions-between-identical-files/278), an important question to ask is why you actually get multiple versions of Phonon in your profile. This is due to how we package Qt software; all Qt packages get propagated into the profile. |
Hm ... would you be open to reporting collisions of identical files differently than collisions of different files? I think they're at least less severe than collisions of different files, right? |
It's additional information that could be useful, so if it's cheap to do, yes. |
ca1085d
to
cef25e5
Compare
Okay, pushed a new version that still prints a message for identical collisions. |
Am I correct that collisions of identical files will now always be printed, and collisions of other files conditionally? That seems a bit weird. |
cef25e5
to
635b608
Compare
I don't think so, but it's definitely worth talking through before biting off the mass-rebuild: if we're in the if we're in the I think that's all okay ... ? |
@@ -111,7 +111,11 @@ sub findFiles { | |||
|
|||
unless (-d $target && ($oldTarget eq "" || -d $oldTarget)) { | |||
if ($ignoreCollisions) { | |||
warn "collision between `$target' and `$oldTarget'\n" if $ignoreCollisions == 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I also do not understand about the previous code is, why it checks first for if ($ignoreCollisions)
and then has a second check if $ignoreCollisions == 1;
. What other states can this variable has?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one stumps me, too. I did a git grep ignoreCollisions
, and every place it turned up was setting it to true
or false
-- in nix expressions. So ... hopefully those translate to 1
and 0
in perl, but I'm not really sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found it:
commit 03f9026ac5ce7568c4b5c28d30552f869e229c63
Author: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed Jul 25 16:24:18 2012 -0400
buildEnv: don't warn about collisions in propagated packages
This mimicks buildenv in Nix more closely.
diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl
index 71502c9f668..08331b178f4 100755
--- a/pkgs/build-support/buildenv/builder.pl
+++ b/pkgs/build-support/buildenv/builder.pl
@@ -66,7 +66,7 @@ sub findFiles {
unless (-d $target && ($oldTarget eq "" || -d $oldTarget)) {
if ($ignoreCollisions) {
- warn "collision between `$target' and `$oldTarget'";
+ warn "collision between `$target' and `$oldTarget'" if $ignoreCollisions == 1;
return;
} else {
die "collision between `$target' and `$oldTarget'";
@@ -122,7 +122,7 @@ while (scalar(keys %postponed) > 0) {
my @pkgDirs = keys %postponed;
%postponed = ();
foreach my $pkgDir (sort @pkgDirs) {
- addPkg($pkgDir, 1);
+ addPkg($pkgDir, 2);
}
}
The use of addPkg has changed since 2012, but there's still a case where $ignoreCollisions
can be 2
. It's on line 198 currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Therefore I think it makes sense to keep the if $ignoreCollisions == 1
in both cases
edit I mean that it should be refactored so == 1
is always checked, of course. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have a comment clarifying this.
such collisions are still a concern, but not as severe as collisions between non-identical paths.
635b608
to
388a3b6
Compare
This pull request has been mentioned on Nix community. There might be relevant details there: https://discourse.nixos.org/t/how-to-debug-a-conflict/1524/7 |
Looks okay to me... Is there anything left here? |
Thank you for your contributions.
|
@matthewbauer I think it only needs somebody to test/merge it. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
I marked this as stale due to inactivity. → More info |
Closing as dead. |
Motivation for this change
As discussed at https://discourse.nixos.org/t/collisions-between-identical-files/278.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)