Skip to content

Directory fileOps are not processed when relPath ends in / #1503

@reidsunderland

Description

@reidsunderland

Related issues:

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:

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.

Metadata

Metadata

Labels

HPCrelated to hich performance computing mirroing use casePolicySuggested Explicit Change of Behaviour, debatable.Refactorchange implementation of existing functionality.work-arounda work-around is provided, mitigating the issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions