build: move needsHashRewrite initialization to startBuilder
The value of useChroot is not set yet in the constructor, resulting in hash rewriting being enabled in certain cases where it should not be. Fixes #2801
This commit is contained in:
		
							parent
							
								
									7c6391ddc7
								
							
						
					
					
						commit
						ff6867ab94
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
					@ -997,13 +997,6 @@ DerivationGoal::DerivationGoal(const Path & drvPath, const StringSet & wantedOut
 | 
				
			||||||
    , wantedOutputs(wantedOutputs)
 | 
					    , wantedOutputs(wantedOutputs)
 | 
				
			||||||
    , buildMode(buildMode)
 | 
					    , buildMode(buildMode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if __linux__
 | 
					 | 
				
			||||||
    needsHashRewrite = !useChroot;
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
    /* Darwin requires hash rewriting even when sandboxing is enabled. */
 | 
					 | 
				
			||||||
    needsHashRewrite = true;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    state = &DerivationGoal::getDerivation;
 | 
					    state = &DerivationGoal::getDerivation;
 | 
				
			||||||
    name = (format("building of '%1%'") % drvPath).str();
 | 
					    name = (format("building of '%1%'") % drvPath).str();
 | 
				
			||||||
    trace("created");
 | 
					    trace("created");
 | 
				
			||||||
| 
						 | 
					@ -1852,6 +1845,13 @@ void DerivationGoal::startBuilder()
 | 
				
			||||||
        #endif
 | 
					        #endif
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if __linux__
 | 
				
			||||||
 | 
					    needsHashRewrite = !useChroot;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    /* Darwin requires hash rewriting even when sandboxing is enabled. */
 | 
				
			||||||
 | 
					    needsHashRewrite = true;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* If `build-users-group' is not empty, then we have to build as
 | 
					    /* If `build-users-group' is not empty, then we have to build as
 | 
				
			||||||
       one of the members of that group. */
 | 
					       one of the members of that group. */
 | 
				
			||||||
    if (settings.buildUsersGroup != "" && getuid() == 0) {
 | 
					    if (settings.buildUsersGroup != "" && getuid() == 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue