Skip to content

Commit

Permalink
ssh: raise clear error when broken symbolic link is found (#366)
Browse files Browse the repository at this point in the history
One currently gets a `RecursionError` when a broken symbolic link is
uploaded, as it tries to walk again and again.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
  • Loading branch information
njzjz committed Sep 22, 2023
1 parent cc08915 commit dd2b191
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dpdispatcher/ssh_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ def _walk_directory(self, files, work_path, file_list, directory_list):
directory_list.append(root)
for name in files:
file_list.append(os.path.join(root, name))
elif os.path.islink(file_name) and not os.path.exists(file_name):
raise OSError(f"{file_name} is broken symbolic link")
elif glob(file_name):
# If the file name contains a wildcard, os.path functions will fail to identify it. Use glob to get the complete list of filenames which match the wildcard.
abs_file_list = glob(file_name)
Expand Down

0 comments on commit dd2b191

Please sign in to comment.