Ensure that Perl processes delete their entry in the temproots directory
By moving the destructor object to libstore.so, it's also run when download-using-manifests and nix-prefetch-url exit. This prevents them from cluttering /nix/var/nix/temproots with stale files.
This commit is contained in:
		
							parent
							
								
									b461721f17
								
							
						
					
					
						commit
						bd50c01972
					
				
					 4 changed files with 12 additions and 17 deletions
				
			
		| 
						 | 
					@ -90,12 +90,6 @@ static void setLogType(string lt)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RemoveTempRoots::~RemoveTempRoots()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    removeTempRoots();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static bool showTrace = false;
 | 
					static bool showTrace = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -217,10 +211,6 @@ static void initAndRun(int argc, char * * argv)
 | 
				
			||||||
    verbosityDelta += queryIntSetting("verbosity", lvlInfo);
 | 
					    verbosityDelta += queryIntSetting("verbosity", lvlInfo);
 | 
				
			||||||
    verbosity = (Verbosity) (verbosityDelta < 0 ? 0 : verbosityDelta);
 | 
					    verbosity = (Verbosity) (verbosityDelta < 0 ? 0 : verbosityDelta);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    /* Automatically clean up the temporary roots file when we
 | 
					 | 
				
			||||||
       exit. */
 | 
					 | 
				
			||||||
    RemoveTempRoots removeTempRoots __attribute__((unused));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    run(remaining);
 | 
					    run(remaining);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Close the Nix database. */
 | 
					    /* Close the Nix database. */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,11 +48,6 @@ extern bool setuidMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern volatile ::sig_atomic_t blockInt;
 | 
					extern volatile ::sig_atomic_t blockInt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct RemoveTempRoots 
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    ~RemoveTempRoots();    
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Exit code of the program. */
 | 
					/* Exit code of the program. */
 | 
				
			||||||
extern int exitCode;
 | 
					extern int exitCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -214,6 +214,18 @@ void removeTempRoots()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Automatically clean up the temporary roots file when we exit. */
 | 
				
			||||||
 | 
					struct RemoveTempRoots 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ~RemoveTempRoots()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        removeTempRoots();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static RemoveTempRoots autoRemoveTempRoots __attribute__((unused));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef boost::shared_ptr<AutoCloseFD> FDPtr;
 | 
					typedef boost::shared_ptr<AutoCloseFD> FDPtr;
 | 
				
			||||||
typedef list<FDPtr> FDs;
 | 
					typedef list<FDPtr> FDs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -584,8 +584,6 @@ static void performOp(unsigned int clientVersion,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void processConnection()
 | 
					static void processConnection()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    RemoveTempRoots removeTempRoots __attribute__((unused));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    canSendStderr = false;
 | 
					    canSendStderr = false;
 | 
				
			||||||
    myPid = getpid();    
 | 
					    myPid = getpid();    
 | 
				
			||||||
    writeToStderr = tunnelStderr;
 | 
					    writeToStderr = tunnelStderr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue