* Regression fix: realise substitutes and detect cycles.
This commit is contained in:
		
							parent
							
								
									1ad9d11247
								
							
						
					
					
						commit
						6f5a5ea5ea
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -287,6 +287,12 @@ void ensurePath(const Path & path, PathSet pending)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /* If the path is already valid, we're done. */
 | 
					    /* If the path is already valid, we're done. */
 | 
				
			||||||
    if (isValidPath(path)) return;
 | 
					    if (isValidPath(path)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (pending.find(path) != pending.end())
 | 
				
			||||||
 | 
					      throw Error(format(
 | 
				
			||||||
 | 
					          "path `%1%' already being realised (possible substitute cycle?)")
 | 
				
			||||||
 | 
						  % path);
 | 
				
			||||||
 | 
					    pending.insert(path);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    /* Otherwise, try the substitutes. */
 | 
					    /* Otherwise, try the substitutes. */
 | 
				
			||||||
    Paths subPaths = querySubstitutes(path);
 | 
					    Paths subPaths = querySubstitutes(path);
 | 
				
			||||||
| 
						 | 
					@ -296,7 +302,8 @@ void ensurePath(const Path & path, PathSet pending)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        checkInterrupt();
 | 
					        checkInterrupt();
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            normaliseStoreExpr(*i, pending);
 | 
					            Path nf = normaliseStoreExpr(*i, pending);
 | 
				
			||||||
 | 
						    realiseClosure(nf, pending);
 | 
				
			||||||
            if (isValidPath(path)) return;
 | 
					            if (isValidPath(path)) return;
 | 
				
			||||||
            throw Error(format("substitute failed to produce expected output path"));
 | 
					            throw Error(format("substitute failed to produce expected output path"));
 | 
				
			||||||
        } catch (Error & e) {
 | 
					        } catch (Error & e) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue