ashb commented on code in PR #23535:
URL: https://github.com/apache/airflow/pull/23535#discussion_r868186136


##########
airflow/utils/file.py:
##########
@@ -233,7 +234,13 @@ def _find_path_from_directory(
 
         dirs[:] = [subdir for subdir in dirs if not 
ignore_rule_type.match(Path(root) / subdir, patterns)]
 
-        patterns_by_dir.update({Path(root) / sd: patterns.copy() for sd in 
dirs})
+        # explicit loop for infinite recursion detection since we are 
following symlinks in this walk
+        for sd in dirs:
+            dirpath = (Path(root) / sd).resolve()
+            if dirpath in patterns_by_dir:
+                log.error("Detected recursive loop when walking DAG directory 
%s: %s has appeared more than once.", base_dir_path, dirpath)
+                raise RuntimeError(f"Detected recursive loop when walking DAG 
directory {base_dir_path}: {dirpath} has appeared more than once.")

Review Comment:
   ```suggestion
                   raise RuntimeError(f"Detected recursive loop when walking 
DAG directory {base_dir_path}: {dirpath} has appeared more than once.")
   ```
   
   No need to log here too -- let what ever handles (or doesn't) log it if 
needed 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to