Subject: bin/7928: mtree(1) ignores the "md5" keyword
To: None <gnats-bugs@gnats.netbsd.org>
From: Carl Shapiro <css@2600.com>
List: netbsd-bugs
Date: 07/06/1999 00:50:52
>Number: 7928
>Category: bin
>Synopsis: mtree(1) ignores the "md5" keyword
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 6 00:50:01 1999
>Last-Modified:
>Originator: Carl Shapiro
>Organization:
private
>Release: 1.4
>Environment:
System: NetBSD phalse.2600.com 1.3.3 NetBSD 1.3.3 (PHALSETTO) #6: Mon May 24 23:45:59 EDT 1999 root@phalse.2600.com:/local/netbsd-src/sys/arch/i386/compile/PHALSETTO i386
>Description:
The mtree(1) from 1.4 does not actually support the md5 checksum as
advertised in the man page.
>How-To-Repeat:
"mtree -c -K md5" will not have the md5 field in its output.
>Fix:
The below patch implements the md5 feature.
*** create.c Tue Jul 6 03:00:43 1999
--- create.c.orig Tue Jul 6 02:18:08 1999
***************
*** 49,55 ****
#include <fcntl.h>
#include <fts.h>
#include <grp.h>
- #include <md5.h>
#include <pwd.h>
#include <stdio.h>
#include <string.h>
--- 49,54 ----
***************
*** 133,139 ****
struct passwd *pw;
u_int32_t len, val;
int fd, indent;
- char md5buf[33], *md5cp;
if (S_ISDIR(p->fts_statp->st_mode))
indent = printf("%s", p->fts_name);
--- 132,137 ----
***************
*** 183,193 ****
(void)close(fd);
output(&indent, "cksum=%lu", val);
}
- if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) {
- if ((md5cp = MD5File(p->fts_accpath, md5buf)) == NULL)
- mtree_err("%s: %s", p->fts_accpath, "MD5File");
- output(&indent, "md5=%s", md5cp);
- }
if (keys & F_SLINK &&
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE))
output(&indent, "link=%s", rlink(p->fts_accpath));
--- 181,186 ----
>Audit-Trail:
>Unformatted: