-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Related issues:
- directory deletion with trailing slash causes problems with
realpathAdjust
sarrac#208 - rmdir processing broken #1377
- directory removal race condition #1395
sr3 rejects messages with relPaths that end in /
. When relPath ends in /
, msg['new_file']
is an empty string (''
) and that causes the message to be rejected by this code:
sarracenia/sarracenia/flow/__init__.py
Lines 1947 to 1953 in 52d5033
if not 'new_dir' in msg or not msg['new_dir']: | |
self.reject(msg, 422, f"new_dir message field missing, do not know which directory to put file in. skipping." ) | |
continue | |
if not 'new_file' in msg or not msg['new_file']: | |
self.reject(msg, 422, f"new_file message field missing, do not know name of file to write. skipping." ) | |
continue |
This causes problems with directory (creation and removal) fileOps when the relPath ends in /
as generated by sr3c/libshim when the input command also ends in slash (e.g. rm -r some_dir/
or mkdir some_dir/
).
This was also not caught previously because the test case I wrote in sr3c creates and deletes the directory with a trailing slash -- so both the creation and removal messages are rejected by sr3:
https://github.com/MetPX/sarrac/blob/707d21d6a525ef8f3e19bffd0198e0a342e44aee/shim_copy_post.sh#L120-L125
The code that is currently written essentially does not allow relPaths ending in /
. If we want to keep it that way, then we need to change sr3c to remove the slash when the message gets posted. Or sr3 (Python) could be modified to accept these messages.