If the trashed file's name has a length that is permitted by the file system, but any longer filename is not permitted, this loop will keep trying various suffixes forever, always being denied.
Some better behavior IMO is to shrink the base name such that there's enough room for the suffix (I think, I don't know the details of the trashing standard), or aborting with an error, or skipping that one file and reporting it to the user.
At https://github.com/andreafrancia/trash-cli/blob/master/trashcli/put.py#L428 there's a
while True:
loop, which tries to create a file whose name is the trashed file's name plus a suffix.If the trashed file's name has a length that is permitted by the file system, but any longer filename is not permitted, this loop will keep trying various suffixes forever, always being denied.
Some better behavior IMO is to shrink the base name such that there's enough room for the suffix (I think, I don't know the details of the trashing standard), or aborting with an error, or skipping that one file and reporting it to the user.