| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -46,13 +46,10 @@ def get_apport_stacktrace(fn): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def get_tombstones(): | 
					 | 
					 | 
					 | 
					def get_tombstones(): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  """Returns list of (filename, ctime) for all tombstones in /data/tombstones | 
					 | 
					 | 
					 | 
					  """Returns list of (filename, ctime) for all crashlogs""" | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  and apport crashlogs in /var/crash""" | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  files = [] | 
					 | 
					 | 
					 | 
					  files = [] | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for folder in [TOMBSTONE_DIR, APPORT_DIR]: | 
					 | 
					 | 
					 | 
					  if os.path.exists(APPORT_DIR): | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if os.path.exists(folder): | 
					 | 
					 | 
					 | 
					    with os.scandir(APPORT_DIR) as d: | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      with os.scandir(folder) as d: | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      # Loop over first 1000 directory entries | 
					 | 
					 | 
					 | 
					      # Loop over first 1000 directory entries | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      for _, f in zip(range(1000), d, strict=False): | 
					 | 
					 | 
					 | 
					      for _, f in zip(range(1000), d, strict=False): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if f.name.startswith("tombstone"): | 
					 | 
					 | 
					 | 
					        if f.name.startswith("tombstone"): | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -143,7 +140,7 @@ def report_tombstone_apport(fn): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					def main() -> NoReturn: | 
					 | 
					 | 
					 | 
					def main() -> NoReturn: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  sentry.init(sentry.SentryProject.SELFDRIVE_NATIVE) | 
					 | 
					 | 
					 | 
					  should_report = sentry.init(sentry.SentryProject.SELFDRIVE_NATIVE) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  # Clear apport folder on start, otherwise duplicate crashes won't register | 
					 | 
					 | 
					 | 
					  # Clear apport folder on start, otherwise duplicate crashes won't register | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  clear_apport_folder() | 
					 | 
					 | 
					 | 
					  clear_apport_folder() | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -153,6 +150,14 @@ def main() -> NoReturn: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    now_tombstones = set(get_tombstones()) | 
					 | 
					 | 
					 | 
					    now_tombstones = set(get_tombstones()) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for fn, _ in (now_tombstones - initial_tombstones): | 
					 | 
					 | 
					 | 
					    for fn, _ in (now_tombstones - initial_tombstones): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      # clear logs if we're not interested in them | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      if not should_report: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        try: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          os.remove(fn) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        except Exception: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					          pass | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        continue | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      try: | 
					 | 
					 | 
					 | 
					      try: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cloudlog.info(f"reporting new tombstone {fn}") | 
					 | 
					 | 
					 | 
					        cloudlog.info(f"reporting new tombstone {fn}") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if fn.endswith(".crash"): | 
					 | 
					 | 
					 | 
					        if fn.endswith(".crash"): | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |