andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.58k stars 179 forks source link

Type error when performing trash-restore #285

Open rycee opened 1 year ago

rycee commented 1 year ago

Describe the bug

I'm the maintainer of the trash-cli package in Nixpkgs. We got a bug report https://github.com/NixOS/nixpkgs/issues/212817 which I think may be due to some issue in trash-cli and not in our packaging.

For convenience I'm pasting the error here but it is also available, with a bit of additional information and discussion in the linked issue.

~ ❯ trash-restore
Traceback (most recent call last):
  File "/nix/store/r2y30jfi20krkf2dplf5cj1mvx7j2qbw-trash-cli-0.22.10.20/bin/.trash-restore-wrapped", line 6, in <module>
    sys.exit(main())
  File "/nix/store/r2y30jfi20krkf2dplf5cj1mvx7j2qbw-trash-cli-0.22.10.20/lib/python3.10/site-packages/trashcli/restore.py", line 117, in main
    ).run(sys.argv)
  File "/nix/store/r2y30jfi20krkf2dplf5cj1mvx7j2qbw-trash-cli-0.22.10.20/lib/python3.10/site-packages/trashcli/restore.py", line 307, in run
    trashed_files = sorted(trashed_files,
TypeError: '<' not supported between instances of 'NoneType' and 'datetime.datetime'

From what I can tell it may be due to a failure to parse the deletion date and the sorting then bailing out when a None being encountered.

trash-cli version

Based on the error log the trash-cli version is 0.22.10.20 and the Python version is 3.10.

Are you using the latest version of trash-cli?

Yes, 0.22.10.20 is, as far as I can tell, the latest version.

Operating system:

The NixOS GNU/Linux distro.

To Reproduce

Unfortunately I was unable to reproduce the issue so I think it is something specific about the deleted files of the original reporter, @Schweber.

Expected behavior

Showing a list of the files in trash with index numbers for selecting them to be restored.

andreafrancia commented 1 year ago

Thank for reporting. I think that maybe that it can reproduced with a .trashinfo with a missing or unparsable DeletionDate