mtree-port icon indicating copy to clipboard operation
mtree-port copied to clipboard

keywords listed in man page as supported are not processed

Open brucelilly opened this issue 3 years ago • 3 comments

Listed keywords in the mtree(8) man page as supported do nothing when used with mtree -c -k.

Specific do-nothing keywords listed are: md5digest sha1digest sha256digest ripemd160digest

Example:

$ mkdir foo ; echo fribble > foo/bar
$  ./mtree -c -k size,md5digest,sha1digest,sha256digest -p foo
#          user: bruce
#       machine: x555l.blilly.net
#          tree: /src/mtree/mtree-1.0.4/foo
#          date: Wed Aug 12 16:41:05 2020

# .
/set type=file
.               type=dir size=4096
    bar         size=8
..
$

Note that the NetBSD code at ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/pkgtools/mtree/files mentioned in https://github.com/archiecobbs/mtree-port/issues/11 along with https://github.com/jgoerzen/libnbcompat (referenced in Issue 11) builds and works fine (oddly, the libnbcompat code requires bmake, but the NetBSD code builds fine with gmake), and also supports the "all" keyword mentioned in more recent versions of the mtree man page. Example as above:

$ mkdir foo ; echo fribble > foo/bar
$ ./mtree -c -k all -p foo                                   
#          user: bruce
#       machine: x555l.blilly.net
#          tree: /src/mtree/netbsd/foo
#          date: Wed Aug 12 16:45:32 2020

# .
/set type=file uname=root gname=root mode=0644 nlink=1 flags=none
.               type=dir mode=0755 nlink=2 time=1597265116.0
    bar         size=8 time=1597265116.0 cksum=4040704387 \
                md5=f0bc5c5ab65929dff257e1a4b6cf5978 \
                rmd160=c2ba195c0ca4808b45d39bf67eb8b84b26010a82 \
                sha1=57240574d35ba37615aba75bd6c0a38fcd2d31c9 \
                sha256=61f7df8b81f654f59bfdf3ee819dfd71015f4c7e5abc7a7c8875b6df0dda1edf \
                sha384=383f5e77ea456e8c503956087b49404f58ead660d0ae466e9b5b27342ee78acb7cee6028b95354261fed8d7e28c724d6 \
                sha512=8847a8e6829ea27258fdde9769f5253e0707f708c61fecdd78152853dd5d7c565c0157bb9ff038bef942cdbd542646e1c15f04cf7c48eb5e1f70208670de283e
$

So I guess you could count this as a vote for the Item #11 request, which also improves the identification problem: $ echo $PWD ; what mtree ; ident mtree /src/mtree/mtree-1.0.4 mtree: mtree: ident warning: no id keywords in mtree $ $ echo $PWD ; what mtree ; ident mtree /src/mtree/netbsd mtree: Copyright (c) 1989, 1990, 1993 mtree: $NetBSD: compare.c,v 1.7 2013/09/08 16:20:10 ryoon Exp $ $NetBSD: crc.c,v 1.5 2010/03/21 16:30:17 joerg Exp $ $NetBSD: create.c,v 1.9 2013/09/08 16:20:10 ryoon Exp $ $NetBSD: excludes.c,v 1.4 2004/08/21 04:10:45 jlam Exp $ $NetBSD: misc.c,v 1.3 2008/11/06 02:14:52 jschauma Exp $ $NetBSD: mtree.c,v 1.3 2004/08/21 04:10:45 jlam Exp $ $NetBSD: spec.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ $NetBSD: verify.c,v 1.6 2010/03/21 16:30:17 joerg Exp $ $NetBSD: stat_flags.c,v 1.5 2011/07/27 15:31:00 seb Exp $ $NetBSD: pack_dev.c,v 1.5 2008/11/06 02:14:52 jschauma Exp $ $NetBSD: rmd160hl.c,v 1.8 2008/10/06 12:36:20 joerg Exp $ $NetBSD: rmd160.c,v 1.9 2015/06/08 00:44:46 joerg Exp $

Addendum: The ".0" in the time field bothers me; it looks like the bug mentioned in the FreeBSD man page at https://www.freebsd.org/cgi/man.cgi?mtree(8):

The netbsd6 flavor	does not replicate the historical bug that reported
     time as seconds.nanoseconds without zero padding nanosecond values	less
     than 100000000.
time	 The last modification time of the file, in seconds and
		 nanoseconds.  The value should	include	a period character and
		 exactly nine digits after the period.

I think the NetBSD create.c and spec.c files should use "time=%ld.%09ld" as the format string; I'm going to rebuild here with that modification and submit a bug report to the NetBSD folks. Bug report at http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=55565

brucelilly avatar Aug 12 '20 20:08 brucelilly

Hi @brucelilly , You inspired me to create a new Linux port based on the NetBSD code.

Please check out these new repos:

  • https://github.com/archiecobbs/libnbcompat
  • https://github.com/archiecobbs/nmtree

I've only done very minimal testing.

archiecobbs avatar Aug 17 '20 19:08 archiecobbs

Sorry for the delay in responding; I've been busy. I'll try to take a look in the next couple of days.

brucelilly avatar Aug 21 '20 16:08 brucelilly

No prob, thanks for checking.

FYI here are the OBS projects:

  • https://build.opensuse.org/package/show/utilities/nmtree
  • https://build.opensuse.org/package/show/devel:libraries:c_c++/libnbcompat-devel

archiecobbs avatar Aug 21 '20 16:08 archiecobbs