[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Non-identical files with identical md5sums on Debian systems?

On Mon, Aug 05, 2013 at 06:44:49AM +0200, Fabian Greffrath wrote:
> Hi all,
> I do occasionally check for identical files on different systems by
> comparing their md5sums. So, just out of interest, could someone tell me
> (how to find out) how many non-identical files with identical md5sums
> there are there on a typical (say, amd64) Debian system?

How about this?

cat /var/lib/dpkg/info/*.md5sums | sort -u > md5sums-files.txt
awk '{print $1}' md5sums-files.txt | uniq -c | awk '$1 > 1 {print $2}' > dup.txt

while read md5; do
    grep "^$md5" md5sums-files.txt | sed -re 's/^[a-f0-9]+[[:space:]]+//' |
        read file
        shasum1=$(sha256sum "$file" | awk '{print $1}')

        while read file; do
            if [ "$(sha256sum "$file" | awk '{print $1}')" != "$shasum1" ]; then
                echo $md5 $file
done < dup.txt

I tried running it, didn't find anything on my Ubuntu installation.

Kind regards,
Loong Jin

Attachment: signature.asc
Description: Digital signature

Reply to: