Subject: bin/9307: mtree(8) fails when using cksums
To: None <gnats-bugs@gnats.netbsd.org>
From: Der Beagle <sopwith!snoopy@parsely.rain.com>
List: netbsd-bugs
Date: 01/27/2000 13:36:26
>Number:         9307
>Category:       bin
>Synopsis:       mtree(8) fails for some files when using cksums
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 27 13:33:00 2000
>Last-Modified:
>Originator:     Der Beagle
>Organization:
The Daisy Hill Puppy Farm
>Release:        1.4.1
>Environment:
alpha, NetBSD 1.4.1
System: NetBSD sopwith.uucp 1.4.1 NetBSD 1.4.1 (SOPWITH) #0: Tue Jan 4 13:09:00 PST 2000 snoopy@sopwith.uucp:/usr/src/sys/arch/alpha/compile/SOPWITH alpha


>Description:
	Mtree generates bogus cksums for some (not all) files with -c.
	When comparing, it generates correct cksums, which mismatch.

>How-To-Repeat:

#! /bin/bash

# mtree_demo.sh
# Demo a bug in mtree.
#   Mtree generates a bogus checksum for some, but not all, files.

TMP_DIR=/tmp/demo_mtree_bug_$$

mkdir $TMP_DIR
cp /bin/cat /bin/chmod $TMP_DIR

echo "test mtree without cksums (should pass)"
mtree -cp $TMP_DIR | mtree -p $TMP_DIR

echo "now test mtree using cksums"
echo "    fails for 'cat' due to bogus cksum"
echo "    cksum matches for 'chmod'"
mtree -cp $TMP_DIR -K cksum | mtree -p $TMP_DIR

rm -rf $TMP_DIR


Output of above script:

test mtree without cksums (should pass)
now test mtree using cksums
    fails for 'cat' due to bogus cksum
    cksum matches for 'chmod'
cat:    cksum (18446744071646173746, 2231589426)


>Fix:
	
Obviously mtree is doing something different in the way it calculates
(or records?) cksums with and without -c.  Smells like it might be a LP64
problem.

The obvious workaround would be to use md5, but that doesn't work at all in 1.4.1.
(Problem Report #7928 says this is fixed, but appariently didn't make it into 1.4.1.)

-Snoopy
snoopy%sopwith.uucp@parsely.rain.com
>Audit-Trail:
>Unformatted: