#566998 perforate: finddup's "oldresult" is broken

Package:
perforate
Source:
perforate
Description:
Utilities to save disk space
Submitter:
Yan Li
Date:
2017-10-25 13:27:05 UTC
Severity:
important
#566998#5
Date:
2010-01-26 14:25:46 UTC
From:
To:
The "oldresult" function of finddup is totally broken.

To test it, make a test directory:
# mkdir test
# echo "hello" > "test/file 1"
# echo "hello" > "test/file 2"

Run finddup in dryrun mode and get its output:
# finddup -n -v -l -i -d test >finddup.out

Rerun it and use --oldresult
# finddup -v -l -i -d test -o finddup.out

And see it's weird output:
L�nge: 2.3 Files:				test/file 2

L�nge: 2.3 Files:	L�nge: 6 Files:	test/file 1

Use of uninitialized value $reffile in concatenation (.) or string at /usr/bin/finddup line 87, <> line 3.
L�nge: 2.3 Files:

And files in test directory are not linked correctly.

#566998#10
Date:
2017-10-24 22:09:56 UTC
From:
To:
The reason that finddup fails in this case is that it was run in verbose
mode (in two ways: first by passing the -v option, and secondly by passing
the -n option, which implies -v).

The verbose mode’s messages are sent to stdout, and so get into the output
file finddup.out.

finddup does not know how to parse this, so it doesn’t work properly when it
is run on that file.

Finally, the -o option does not take an argument; rather, the old output
must be supplied on stdin.

The following two commands work correctly, after the test setup given by the
reporter:

# finddup -d test > finddup.out
# finddup -o < finddup.out

To make it less likely to get into this mess, I’ve changed -v to print to
stderr in my recent improvements (shortly coming as version 1.3).