Add operation ‘nix-store --repair-path’
This operation allows fixing corrupted or accidentally deleted store paths by redownloading them using substituters, if available. Since the corrupted path cannot be replaced atomically, there is a very small time window (one system call) during which neither the old (corrupted) nor the new (repaired) contents are available. So repairing should be used with some care on critical packages like Glibc.
This commit is contained in:
		
							parent
							
								
									e666e1156f
								
							
						
					
					
						commit
						9958bd6992
					
				
					 8 changed files with 151 additions and 36 deletions
				
			
		|  | @ -734,6 +734,21 @@ static void opVerifyPath(Strings opFlags, Strings opArgs) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| /* Repair the contents of the given path by redownloading it using a
 | ||||
|    substituter (if available). */ | ||||
| static void opRepairPath(Strings opFlags, Strings opArgs) | ||||
| { | ||||
|     if (!opFlags.empty()) | ||||
|         throw UsageError("no flags expected"); | ||||
| 
 | ||||
|     foreach (Strings::iterator, i, opArgs) { | ||||
|         Path path = followLinksToStorePath(*i); | ||||
|         printMsg(lvlTalkative, format("repairing path `%1%'...") % path); | ||||
|         ensureLocalStore().repairPath(path); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| static void showOptimiseStats(OptimiseStats & stats) | ||||
| { | ||||
|     printMsg(lvlError, | ||||
|  | @ -834,6 +849,8 @@ void run(Strings args) | |||
|             op = opVerify; | ||||
|         else if (arg == "--verify-path") | ||||
|             op = opVerifyPath; | ||||
|         else if (arg == "--repair-path") | ||||
|             op = opRepairPath; | ||||
|         else if (arg == "--optimise") | ||||
|             op = opOptimise; | ||||
|         else if (arg == "--query-failed-paths") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue