sandbox: do not assume home is inside /Users
				
					
				
			It’s not uncommon to use `/var/${USER}` as a home directory, especially
for shared or CLI-only users.
This fixes an issue where a formula that requires `xcodebuild` is
`brew install`ed from such a shared or CLI-only user account.
In that case, `xcodebuild` would fail because it is denied writing to
`/var/${USER}/Library/Developer/Xcode`.
For details, see: https://gist.github.com/claui/17cd89f8f6b4094ac704f142ea811fd8
Suggested-by: Bo Anderson <mail@boanderson.me>
			
			
This commit is contained in:
		
							parent
							
								
									f1e4c4ed56
								
							
						
					
					
						commit
						23cb93ff1c
					
				@ -47,12 +47,12 @@ class Sandbox
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def allow_cvs
 | 
					  def allow_cvs
 | 
				
			||||||
    allow_write_path "/Users/#{ENV["USER"]}/.cvspass"
 | 
					    allow_write_path "#{ENV["HOME"]}/.cvspass"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def allow_fossil
 | 
					  def allow_fossil
 | 
				
			||||||
    allow_write_path "/Users/#{ENV["USER"]}/.fossil"
 | 
					    allow_write_path "#{ENV["HOME"]}/.fossil"
 | 
				
			||||||
    allow_write_path "/Users/#{ENV["USER"]}/.fossil-journal"
 | 
					    allow_write_path "#{ENV["HOME"]}/.fossil-journal"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def allow_write_cellar(formula)
 | 
					  def allow_write_cellar(formula)
 | 
				
			||||||
@ -63,7 +63,7 @@ class Sandbox
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # Xcode projects expect access to certain cache/archive dirs.
 | 
					  # Xcode projects expect access to certain cache/archive dirs.
 | 
				
			||||||
  def allow_write_xcode
 | 
					  def allow_write_xcode
 | 
				
			||||||
    allow_write_path "/Users/#{ENV["USER"]}/Library/Developer"
 | 
					    allow_write_path "#{ENV["HOME"]}/Library/Developer"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def allow_write_log(formula)
 | 
					  def allow_write_log(formula)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user