Skip to content

Support for multi-arg rm and rmdir#517

Open
sfc-gh-iyashchyshyn wants to merge 2 commits intomainfrom
iyashchyshyn/multi-file-rm-and-rmdir
Open

Support for multi-arg rm and rmdir#517
sfc-gh-iyashchyshyn wants to merge 2 commits intomainfrom
iyashchyshyn/multi-file-rm-and-rmdir

Conversation

@sfc-gh-iyashchyshyn
Copy link
Contributor

Changes rm and rmdir to accept multiple args (absolute paths) and return a compound error for any dirs/files that failed to be deleted. Also add -r flag to rmdir which deletes everything inside of directory, along with directory itself. Behaviour in general follows coreutils rm with -r flag.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a breaking change. Instead of modifying filename field, we could add filenames field of type repeated string and on server side filename value will be used only if filenames field is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into some options and I don't think there's a nice way of doing this for us. Technically, with current code (before the fix below) new-client-old-server scenario would just result in deletion of the last file, with the approach above its going to be first-file deleted only, so I implemented that for now.

That being said, we have no good way (without connecting that is) of knowing what version of SansShell server we're sending the request to, so we'll have to populate both of these fields at all times basically to ensure that both old and new versions work.

Copy link
Collaborator

@sfc-gh-ikryvanos sfc-gh-ikryvanos Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prop renaming also will cause non backward compatible changes of opa policy and could open backdoor to remove what actually should't be removed.

To avoid this lets avoid request shape changes, instead send several remove requests to remove single file/dir

@sfc-gh-iyashchyshyn sfc-gh-iyashchyshyn marked this pull request as ready for review December 16, 2024 13:22
Copy link
Collaborator

@sfc-gh-ikryvanos sfc-gh-ikryvanos Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prop renaming also will cause non backward compatible changes of opa policy and could open backdoor to remove what actually should't be removed.

To avoid this lets avoid request shape changes, instead send several remove requests to remove single file/dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments