Fix 'Read-only file system' when building a derivation
This commit is contained in:
		
							parent
							
								
									32a0a223d5
								
							
						
					
					
						commit
						a32ff2573b
					
				
					 3 changed files with 5 additions and 1 deletions
				
			
		|  | @ -2193,6 +2193,7 @@ void DerivationGoal::startBuilder() | ||||||
|         userNamespaceSync.create(); |         userNamespaceSync.create(); | ||||||
| 
 | 
 | ||||||
|         options.allowVfork = false; |         options.allowVfork = false; | ||||||
|  |         options.restoreMountNamespace = false; | ||||||
| 
 | 
 | ||||||
|         Pid helper = startProcess([&]() { |         Pid helper = startProcess([&]() { | ||||||
| 
 | 
 | ||||||
|  | @ -2259,6 +2260,7 @@ void DerivationGoal::startBuilder() | ||||||
| #endif | #endif | ||||||
|     { |     { | ||||||
|         options.allowVfork = !buildUser && !drv->isBuiltin(); |         options.allowVfork = !buildUser && !drv->isBuiltin(); | ||||||
|  |         options.restoreMountNamespace = false; | ||||||
|         pid = startProcess([&]() { |         pid = startProcess([&]() { | ||||||
|             runChild(); |             runChild(); | ||||||
|         }, options); |         }, options); | ||||||
|  |  | ||||||
|  | @ -936,6 +936,7 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options) | ||||||
|                 throw SysError("setting death signal"); |                 throw SysError("setting death signal"); | ||||||
| #endif | #endif | ||||||
|             restoreAffinity(); |             restoreAffinity(); | ||||||
|  |             if (options.restoreMountNamespace) | ||||||
|                 restoreMountNamespace(); |                 restoreMountNamespace(); | ||||||
|             fun(); |             fun(); | ||||||
|         } catch (std::exception & e) { |         } catch (std::exception & e) { | ||||||
|  |  | ||||||
|  | @ -250,6 +250,7 @@ struct ProcessOptions | ||||||
|     bool dieWithParent = true; |     bool dieWithParent = true; | ||||||
|     bool runExitHandlers = false; |     bool runExitHandlers = false; | ||||||
|     bool allowVfork = true; |     bool allowVfork = true; | ||||||
|  |     bool restoreMountNamespace = true; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| pid_t startProcess(std::function<void()> fun, const ProcessOptions & options = ProcessOptions()); | pid_t startProcess(std::function<void()> fun, const ProcessOptions & options = ProcessOptions()); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue