jRimbault / yadf

Yet Another Dupes Finder
MIT License
55 stars 0 forks source link

Panic during invalid UTF-8 Path serialization #3

Closed DarrienG closed 3 years ago

DarrienG commented 3 years ago

Looks like there was a problem with a path containing invalid UTF-characters:

name = 'yadf'
operating_system = 'unix:Unknown'
crate_version = '0.12.2'
explanation = '''
Panic occurred in file 'src/main.rs' at line 36
'''
cause = 'called `Result::unwrap()` on an `Err` value: Error("path contains invalid UTF-8 characters", line: 0, column: 0)'
method = 'Panic'
backtrace = '''

   0:   0x638283 - <unresolved>
   1:   0x40e7e6 - <unresolved>
   2:   0x42c443 - <unresolved>
   3:   0x431a09 - <unresolved>
   4:   0x5ffc99 - <unresolved>
   5:   0x40fdf2 - <unresolved>''

This is the second time I ran yadf though, and it only crashed with the JsonPretty option pointing to the same path. This is running on a Synology NAS version DSM 6.2.3-25426 Update 3 using btrfs file system.

jRimbault commented 3 years ago

I expected that to happen someday, it's due to serde_json's Path serialization serde_json#465. I can certainly "fix" it, in the sense that it won't crash, but the output certainly won't be as correct, I just need to escape the underlying OsString. I'll work on it soon-ish. In the meantime, sorry for the inconvenience.

Edit : for my own reference :

DarrienG commented 3 years ago

No worries! This free utility is probably better than what I could write in my own time. I look forward to when the fix is implemented :D

jRimbault commented 3 years ago

Just a quick FYI.

If you're running yadf somewhere with non utf-8 paths, I'd advise raising the log level to something like :

yadf -vv path/to/somewhere | script.sh

Where script.sh consumes the output of yadf (in whatever chosen format), this will let you see the warnings about those paths more easily. (Or just pipe to /dev/null)