jvirkki / dupd

CLI utility to find duplicate files
http://www.virkki.com/dupd
GNU General Public License v3.0
112 stars 16 forks source link

Supplying a relative --path can break behaviour of dupd query commands #39

Closed Avaq closed 3 years ago

Avaq commented 3 years ago

Thank you for this very useful tool! :heart: I think I found a small bug.

Description

Not knowing for sure what dupd scan would scan by default, I issued dupd scan --hidden -p .. This led dupd report to show paths like this: /path/to/cwd/./some-file (note that ./ in the middle).

I didn't think much of it, until I tried to run dupd ls or dupd file on a file that I knew (from the report output) to be duplicate.

Expected behaviour

Files listed in the output of dupd report are reported as DUPLICATE by dupd ls and dupd file.

Actual behaviour

All files queried are considered UNIQUE.

Suspected cause

dupd performs path-based matches that don't normalize the path, and so /path/to/cwd/./some-file is treated as distinct from /path/to/cwd/some-file, and so when dupd scan made an index with . in the path, dupd file can't find any matches for a given input file.

I have verified this theory by running dupd file -f /path/to/cwd/./some-file (with the ./ explicitly) and this did lead to a DUPLICATE match.