jessek / hashdeep

Other
702 stars 132 forks source link

md5deep relative path doesn't work with recursive option #337

Closed Autiwa closed 9 years ago

Autiwa commented 9 years ago

I'm using md5deep v4.2 (installed in Ubuntu).

I want to process a directory recursively with md5deep, but I want to store relative path.

if I chdir into the right directory, then : md5deep -lr . >checklist.md5 works

But when launching the following command into an arbitrary directory, path are absolute, even if the option -l is specified : md5deep -lr /home/autiwa/test>checklist.md5

I don't know if this is the expected result. For my purpose I found another solution, but still, I'm reporting this behaviour in hoping it will help you improve your already awesome piece of software.

Best regards, Autiwa

jessek commented 9 years ago

This is the expected behavior. In the second command line you gave, the paths being displayed are relative to the path you specified.

Autiwa commented 9 years ago

In the first command, the CWD is : /home/autiwa/test

file path is of the form : dad46f06df533ee7802f50e8a7dcdfb6 ./linux/debuter avec Linux.out 4ed6af2644bd649e7b59f43051e6bf2e ./linux/debuter avec Linux.toc b62672db92836e18e83061b0d88859f7 ./linux/debuter avec Linux.tex.backup

In the second command, the CWD is /home/autiwa

file path is of the form : dad46f06df533ee7802f50e8a7dcdfb6 /home/autiwa/test/linux/debuter avec Linux.out 2c4dc9b04f190e8b776c011775048b9b /home/autiwa/test/linux/debuter avec Linux.aux 4ed6af2644bd649e7b59f43051e6bf2e /home/autiwa/test/linux/debuter avec Linux.toc

In the second command, the path isn't relative to any directory, not the current working directory, not the specified directory either.

I would have expected one of the following : ./linux/debuter avec Linux.out ./test/linux/debuter avec Linux.out

jessek commented 9 years ago

When working in relative path mode, md5deep displays paths relative to the argument it was presented at the command line. In this case:

$ md5deep -lr /home/autiwa/test

Will display paths relative to /home/autiwa/test. If you want the output to be in the form

dad46f06df533ee7802f50e8a7dcdfb6 ./linux/debuter avec Linux.out

You have to call md5deep with '.' as a command line argument as you did in the first command line.

The program isn't looking at the CWD, it's looking at what you specified on the command line. :)

Autiwa commented 9 years ago

Ok ! :)

I find this behavior very weird, but maybe it's just me.

Taking : CWD = /home/autiwa Argument = /home/autiwa/test

If I take the following file : /home/autiwa/test/linux/debuter avec Linux.out

For me, relative path to CWD lead to : ./test/linux/debuter avec Linux.out

and relative path to the argument lead to : ./linux/debuter avec Linux.out

because "relative" path mean we suppress the entire part associated to the reference.

Thanks for your quick answer !