File tree Expand file tree Collapse file tree 6 files changed +25
-3
lines changed Expand file tree Collapse file tree 6 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 2020      with :
2121        fetch-depth : 0 
2222    - uses : cachix/install-nix-action@v20 
23+       with :
24+         #  The sandbox would otherwise be disabled by default on Darwin
25+         extra_nix_config : " sandbox = true" 
2326    - run : echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV 
2427    - uses : cachix/cachix-action@v12 
2528      if : needs.check_secrets.outputs.cachix == 'true' 
Original file line number Diff line number Diff line change @@ -2620,7 +2620,7 @@ Strings EvalSettings::getDefaultNixPath()
26202620{
26212621    Strings res;
26222622    auto  add = [&](const  Path & p, const  std::string & s = std::string ()) {
2623-         if  (pathExists (p)) {
2623+         if  (pathAccessible (p)) {
26242624            if  (s.empty ()) {
26252625                res.push_back (p);
26262626            } else  {
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ bool Settings::isWSL1()
183183Path Settings::getDefaultSSLCertFile ()
184184{
185185    for  (auto  & fn : {" /etc/ssl/certs/ca-certificates.crt"  , " /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt"  })
186-         if  (pathExists (fn)) return  fn;
186+         if  (pathAccessible (fn)) return  fn;
187187    return  " "  ;
188188}
189189
Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ namespace nix {
202202    }
203203
204204    TEST (pathExists, bogusPathDoesNotExist) {
205-         ASSERT_FALSE (pathExists (" /home/ schnitzel/darmstadt/pommes"  ));
205+         ASSERT_FALSE (pathExists (" /schnitzel/darmstadt/pommes"  ));
206206    }
207207
208208    /*  ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -266,6 +266,17 @@ bool pathExists(const Path & path)
266266    return  false ;
267267}
268268
269+ bool  pathAccessible (const  Path & path)
270+ {
271+     try  {
272+         return  pathExists (path);
273+     } catch  (SysError & e) {
274+         //  swallow EPERM
275+         if  (e.errNo  == EPERM) return  false ;
276+         throw ;
277+     }
278+ }
279+ 
269280
270281Path readLink (const  Path & path)
271282{
Original file line number Diff line number Diff line change @@ -120,6 +120,14 @@ struct stat lstat(const Path & path);
120120 */  
121121bool  pathExists (const  Path & path);
122122
123+ /* *
124+  * A version of pathExists that returns false on a permission error. 
125+  * Useful for inferring default paths across directories that might not 
126+  * be readable. 
127+  * @return true iff the given path can be accessed and exists 
128+  */  
129+ bool  pathAccessible (const  Path & path);
130+ 
123131/* *
124132 * Read the contents (target) of a symbolic link.  The result is not 
125133 * in any way canonicalised. 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments