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

setup.sh: avoid running the same hook twice #49552

Merged
merged 1 commit into from Jan 27, 2019

Conversation

matthewbauer
Copy link
Member

In strictDeps=false, we don’t want the same package hook to be run
twice, otherwise we get duplicates in some flags.

Fixes #41340

@GrahamcOfBorg GrahamcOfBorg added the 6.topic: stdenv Standard environment label Oct 31, 2018
@Ericson2314
Copy link
Member

Ericson2314 commented Oct 31, 2018

This won't work because it is the same hook that gives build cc nativeBuildInputs and regular cc buildInputs. One of those wouldn't get the deps then.

OH! it only applies in the unstrict deps case. Perfect!

I guess all I'd ask for is more comments, explaining it's intentionally only for strictDeps=false / adding another TODO remove to match.

@cdepillabout
Copy link
Member

Any update on getting this into staging?

I've been running into #41340 on darwin and it would be really nice to have it finally fixed!

@matthewbauer
Copy link
Member Author

matthewbauer commented Nov 14, 2018

@cdepillabout I don't think this will fix your issue. The main Haskell issue was fixed in f375825. I would make sure your nixpkgs version is correct and all of your channels are up to date.

@infinisil
Copy link
Member

I don't think this solves #27533, right? Seems related

@matthewbauer
Copy link
Member Author

No it won't fix that issue. But it shouldn't be too hard to fix...

In strictDeps=false, we don’t want the same package hook to be run
twice, otherwise we get duplicates in some flags.

Fixes NixOS#41340
Copy link
Member

@dtzWill dtzWill left a comment

Choose a reason for hiding this comment

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

Small questions, more than a review really :).

@@ -562,6 +562,10 @@ _addToEnv() {
(( "$depHostOffset" <= "$depTargetOffset" )) || continue
local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"
if [[ -z "${strictDeps-}" ]]; then

# Keep track of which packages we have visited before.
local visitedPkgs=""
Copy link
Member

Choose a reason for hiding this comment

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

(I'm not an expert, but would it be better to use an array instead of building/scanning a string? IIRC there are some issues with some shell features so maybe it's a bad idea for those or other reasons)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that might have been a better idea… I am kind of wanting to just fix the argmax issue as it seems to still be happening. Making this more performant would definitely be better.

@@ -574,7 +578,11 @@ _addToEnv() {
${pkgsHostTarget+"${pkgsHostTarget[@]}"} \
${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}
do
if [[ "$visitedPkgs" = *"$pkg"* ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Is this susceptible to false matches when package is a substring of another?

Oh, nevermind, these are probably store paths so that can't happen, right? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I forgot to leave in the spaces here

@matthewbauer matthewbauer deleted the setup-dedupe branch February 22, 2019 04:18
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

6 participants