trapexit / mergerfs-tools

Optional tools to help manage data in a mergerfs pool
ISC License
372 stars 42 forks source link

mergerfs.dedup FileNotFoundError #110

Open ibidani opened 3 years ago

ibidani commented 3 years ago

Thanks @trapexit for your hard work and being super engaged contributor to mergerfs users. I'm trying to consolidate a few disks using mergerfs.dedup, seems like some of those characters triggered maybe an escaping problem. It's not a big issue for me but maybe to someone else in the future

root@mymedia:/srv/0e191110-567c-41cf-970e-359f647b8dd3/Media# mergerfs.dedup -v -d newest /srv/0e191110-567c-41cf-970e-359f647b8dd3/Media/ Traceback (most recent call last): File "/usr/local/bin/mergerfs.dedup", line 548, in main() File "/usr/local/bin/mergerfs.dedup", line 533, in main total_size += dedup(fullpath,verbose,ignorefun,execute,dedupfun) File "/usr/local/bin/mergerfs.dedup", line 359, in dedup paths = getxattr(fullpath,b'user.mergerfs.allpaths').split('\0') File "/usr/local/bin/mergerfs.dedup", line 337, in getxattr attr = lgetxattr(path,key) File "/usr/local/bin/mergerfs.dedup", line 50, in lgetxattr raise IOError(err,os.strerror(err),path) FileNotFoundError: [Errno 2] No such file or directory: b'/srv/0e191110-567c-41cf-970e-359f647b8dd3/Media/Backup/Backup-Fedoraidan/idan/.local/share/Trash/info/\x10\x03\x01l\udc9a\x7f.trashinfo'

trapexit commented 3 years ago

The problem is the encoding of the filename. ::sigh:: I've spent more time screwing with Python's annoying encoding/decoding than working on real shit. I should just rewrite everything in C++.

ibidani commented 3 years ago

Some bugs are not worth solving, at least not in a priority of the more impactful ones

koelie commented 1 year ago

ran into this bug, fixed by replacing:

path = path.encode(errors='backslashreplace')

with

os.fsencode(path)

and replacing:

attr.decode('utf-8')

with:

os.fsdecode(attr)