Hello community, here is the log from the commit of package mtree for openSUSE:Factory checked in at 2017-12-08 13:02:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mtree (Old) and /work/SRC/openSUSE:Factory/.mtree.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mtree" Fri Dec 8 13:02:13 2017 rev:7 rq:555140 version:1.0.4 Changes: -------- --- /work/SRC/openSUSE:Factory/mtree/mtree.changes 2015-08-03 17:22:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.mtree.new/mtree.changes 2017-12-08 13:02:20.494951142 +0100 @@ -1,0 +2,7 @@ +Thu Dec 7 23:03:25 UTC 2017 - [email protected] + +- Update to 1.0.4 + + Fix build issue with OpenSSL 1.1.0 (issue #10) + + Added `-V' flag (issue #9) + +------------------------------------------------------------------- Old: ---- 1.0.3.tar.gz New: ---- 1.0.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mtree.spec ++++++ --- /var/tmp/diff_new_pack.JeoXci/_old 2017-12-08 13:02:21.666908816 +0100 +++ /var/tmp/diff_new_pack.JeoXci/_new 2017-12-08 13:02:21.666908816 +0100 @@ -1,7 +1,7 @@ # # spec file for package mtree # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2010 Archie L. Cobbs. # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: mtree -Version: 1.0.3 +Version: 1.0.4 Release: 0 Summary: Tool for creating and verifying file hierarchies License: BSD-3-Clause ++++++ 1.0.3.tar.gz -> 1.0.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/CHANGES new/mtree-port-1.0.4/CHANGES --- old/mtree-port-1.0.3/CHANGES 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/CHANGES 2017-12-07 23:59:27.000000000 +0100 @@ -1,3 +1,8 @@ +Version 1.0.4 Released December 7, 2017 + + - Fix build issue with OpenSSL 1.1.0 (issue #10) + - Added `-V' flag (issue #9) + Version 1.0.3 Released 10 June 2015 - Display symlink, modification time, and file type changes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/README.md new/mtree-port-1.0.4/README.md --- old/mtree-port-1.0.3/README.md 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/README.md 2017-12-07 23:59:27.000000000 +0100 @@ -4,4 +4,4 @@ This port of **mtree** uses the `autoconf` infrastructure to maintain portability. -See the [ManPages](https://github.com/archiecobbs/mtree-port/wiki/ManPages) for details. +See the [ManPages](https://github.com/archiecobbs/mtree-port/wiki/ManPages) for details on usage, and [Downloads](https://github.com/archiecobbs/mtree-port/wiki/Downloads) for where to get it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/compare.c new/mtree-port-1.0.4/compare.c --- old/mtree-port-1.0.3/compare.c 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/compare.c 2017-12-07 23:59:27.000000000 +0100 @@ -247,11 +247,11 @@ tab = "\t"; } #endif -#ifdef HAVE_OPENSSL_MD5_H +#if HAVE_OPENSSL_MD5_H && HAVE_EVP_MD5 if (s->flags & F_MD5) { - char *new_digest, buf[33]; + char *new_digest, result[MD5_DIGEST_LENGTH*2+1]; - new_digest = MD5_File(p->fts_accpath, buf); + new_digest = MD5_File(p->fts_accpath, result); if (!new_digest) { LABEL; printf("%sMD5: %s: %s\n", tab, p->fts_accpath, @@ -265,11 +265,11 @@ } } #endif /* HAVE_OPENSSL_MD5_H */ -#ifdef HAVE_OPENSSL_SHA_H +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA1 if (s->flags & F_SHA1) { - char *new_digest, buf[41]; + char *new_digest, result[SHA_DIGEST_LENGTH*2+1]; - new_digest = SHA1_File(p->fts_accpath, buf); + new_digest = SHA1_File(p->fts_accpath, result); if (!new_digest) { LABEL; printf("%sSHA-1: %s: %s\n", tab, p->fts_accpath, @@ -283,11 +283,11 @@ } } #endif /* HAVE_OPENSSL_SHA_H */ -#ifdef HAVE_OPENSSL_RIPEMD_H +#if HAVE_OPENSSL_RIPEMD_H && HAVE_EVP_RIPEMD160 if (s->flags & F_RMD160) { - char *new_digest, buf[41]; + char *new_digest, result[RIPEMD160_DIGEST_LENGTH*2+1]; - new_digest = RIPEMD160_File(p->fts_accpath, buf); + new_digest = RIPEMD160_File(p->fts_accpath, result); if (!new_digest) { LABEL; printf("%sRIPEMD160: %s: %s\n", tab, @@ -301,11 +301,11 @@ } } #endif /* HAVE_OPENSSL_RIPEMD_H */ -#ifdef HAVE_OPENSSL_SHA_H +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA256 if (s->flags & F_SHA256) { - char *new_digest, buf[65]; + char *new_digest, result[SHA256_DIGEST_LENGTH*2+1]; - new_digest = SHA256_File(p->fts_accpath, buf); + new_digest = SHA256_File(p->fts_accpath, result); if (!new_digest) { LABEL; printf("%sSHA-256: %s: %s\n", tab, p->fts_accpath, @@ -318,6 +318,43 @@ tab = "\t"; } } +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA384 + if (s->flags & F_SHA384) { + char *new_digest, result[SHA384_DIGEST_LENGTH*2+1]; + + // XXX(vbatts) really not sure why SHA384_File is not returning the correct char* + new_digest = SHA384_File(p->fts_accpath, result); + if (!new_digest) { + LABEL; + printf("%sSHA-384: %s: %s\n", tab, p->fts_accpath, + strerror(errno)); + tab = "\t"; + } else if (strcmp(result, s->sha384digest)) { + LABEL; + printf("%sSHA-384 expected %s found %s\n", + tab, s->sha384digest, result); + tab = "\t"; + } + } +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA512 + if (s->flags & F_SHA512) { + char *new_digest, result[SHA512_DIGEST_LENGTH*2+1]; + + new_digest = SHA512_File(p->fts_accpath, result); + if (!new_digest) { + LABEL; + printf("%sSHA-512: %s: %s\n", tab, p->fts_accpath, + strerror(errno)); + tab = "\t"; + } else if (strcmp(new_digest, s->sha512digest)) { + LABEL; + printf("%sSHA-512 expected %s found %s\n", + tab, s->sha512digest, new_digest); + tab = "\t"; + } + } #endif /* HAVE_OPENSSL_SHA_H */ if (s->flags & F_SLINK && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/configure.ac new/mtree-port-1.0.4/configure.ac --- old/mtree-port-1.0.3/configure.ac 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/configure.ac 2017-12-07 23:59:27.000000000 +0100 @@ -2,7 +2,7 @@ # mtree - Utility for creating and verifying file hierarchies # -AC_INIT([mtree Utility for creating and verifying file hierarchies], [1.0.3], [http://www.freebsd.org/], [mtree]) +AC_INIT([mtree Utility for creating and verifying file hierarchies], [1.0.4], [https://github.com/archiecobbs/mtree-port], [mtree]) AC_CONFIG_AUX_DIR(scripts) AM_INIT_AUTOMAKE dnl AM_MAINTAINER_MODE @@ -16,6 +16,7 @@ # Compile flags for Linux AC_DEFINE(_GNU_SOURCE, 1, GNU functions) AC_DEFINE(_BSD_SOURCE, 1, BSD functions) +AC_DEFINE(_DEFAULT_SOURCE, 1, BSD and SVID functions) AC_DEFINE(_XOPEN_SOURCE, 500, XOpen functions) # Compile flags for Mac OS @@ -33,8 +34,9 @@ AC_CHECK_HEADERS(dirent.h err.h errno.h fcntl.h fnmatch.h fts.h grp.h limits.h pwd.h signal.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h unistd.h sys/cdefs.h sys/param.h sys/queue.h sys/stat.h sys/time.h sys/types.h, [], [AC_MSG_ERROR([required header file '$ac_header' missing])]) -# Check for optional header files +# Check for OpenSSL header files and functions AC_CHECK_HEADERS(openssl/md5.h openssl/sha.h openssl/ripemd.h,,) +AC_CHECK_FUNCS(EVP_md5 EVP_sha1 EVP_sha256 EVP_sha384 EVP_sha512 EVP_ripemd160,,) # Check for optional functions AC_CHECK_FUNCS(getmode getline,,) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/create.c new/mtree-port-1.0.4/create.c --- old/mtree-port-1.0.3/create.c 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/create.c 2017-12-07 23:59:27.000000000 +0100 @@ -222,46 +222,67 @@ (void)close(fd); output(indent, &offset, "cksum=%lu", (unsigned long)val); } -#ifdef HAVE_OPENSSL_MD5_H +#if HAVE_OPENSSL_MD5_H && HAVE_EVP_MD5 if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) { - char *digest, buf[33]; + char *digest, result[MD5_DIGEST_LENGTH*2+1]; - digest = MD5_File(p->fts_accpath, buf); + digest = MD5_File(p->fts_accpath, result); if (!digest) err(1, "%s", p->fts_accpath); output(indent, &offset, "md5digest=%s", digest); } #endif /* HAVE_OPENSSL_MD5_H */ -#ifdef HAVE_OPENSSL_SHA_H +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA1 if (keys & F_SHA1 && S_ISREG(p->fts_statp->st_mode)) { - char *digest, buf[41]; + char *digest, result[SHA_DIGEST_LENGTH*2+1]; - digest = SHA1_File(p->fts_accpath, buf); + digest = SHA1_File(p->fts_accpath, result); if (!digest) err(1, "%s", p->fts_accpath); output(indent, &offset, "sha1digest=%s", digest); } #endif /* HAVE_OPENSSL_SHA_H */ -#ifdef HAVE_OPENSSL_RIPEMD_H +#if HAVE_OPENSSL_RIPEMD_H && HAVE_EVP_RIPEMD160 if (keys & F_RMD160 && S_ISREG(p->fts_statp->st_mode)) { - char *digest, buf[41]; + char *digest, result[RIPEMD160_DIGEST_LENGTH*2+1]; - digest = RIPEMD160_File(p->fts_accpath, buf); + digest = RIPEMD160_File(p->fts_accpath, result); if (!digest) err(1, "%s", p->fts_accpath); output(indent, &offset, "ripemd160digest=%s", digest); } #endif /* HAVE_OPENSSL_RIPEMD_H */ -#ifdef HAVE_OPENSSL_SHA_H +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA256 if (keys & F_SHA256 && S_ISREG(p->fts_statp->st_mode)) { - char *digest, buf[65]; + char *digest, result[SHA256_DIGEST_LENGTH*2+1]; - digest = SHA256_File(p->fts_accpath, buf); + digest = SHA256_File(p->fts_accpath, result); if (!digest) err(1, "%s", p->fts_accpath); output(indent, &offset, "sha256digest=%s", digest); } -#endif /* HAVE_OPENSSL_SHA_H */ +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA384 + if (keys & F_SHA384 && S_ISREG(p->fts_statp->st_mode)) { + char *digest, result[SHA384_DIGEST_LENGTH*2+1]; + + // XXX(vbatts) really not sure why SHA384_File is not returning the correct char* + digest = SHA384_File(p->fts_accpath, result); + if (!digest) + err(1, "%s", p->fts_accpath); + output(indent, &offset, "sha384digest=%s", result); + } +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA512 + if (keys & F_SHA512 && S_ISREG(p->fts_statp->st_mode)) { + char *digest, result[SHA512_DIGEST_LENGTH*2+1]; + + digest = SHA512_File(p->fts_accpath, result); + if (!digest) + err(1, "%s", p->fts_accpath); + output(indent, &offset, "sha512digest=%s", digest); + } +#endif if (keys & F_SLINK && (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) output(indent, &offset, "link=%s", rlink(p->fts_accpath)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/extern.h new/mtree-port-1.0.4/extern.h --- old/mtree-port-1.0.3/extern.h 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/extern.h 2017-12-07 23:59:27.000000000 +0100 @@ -60,21 +60,30 @@ void *setmode(const char *p); #endif -#ifdef HAVE_OPENSSL_MD5_H +#if HAVE_OPENSSL_MD5_H && HAVE_EVP_MD5 char * MD5_File(const char *filename, char *result); #endif -#ifdef HAVE_OPENSSL_SHA_H + +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA1 char * SHA1_File(const char *filename, char *result); +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA256 char * SHA256_File(const char *filename, char *result); #endif -#ifdef HAVE_OPENSSL_RIPEMD_H +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA384 +char * SHA384_File(const char *filename, char *result); +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA512 +char * SHA512_File(const char *filename, char *result); +#endif +#if HAVE_OPENSSL_RIPEMD_H && HAVE_EVP_RIPEMD160 char * RIPEMD160_File(const char *filename, char *result); #endif extern int ftsoptions; extern u_int keys; extern int lineno; -extern int dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, wflag; +extern int dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, wflag, vflag; #ifdef MAXPATHLEN extern char fullpath[MAXPATHLEN]; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/misc.c new/mtree-port-1.0.4/misc.c --- old/mtree-port-1.0.3/misc.c 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/misc.c 2017-12-07 23:59:27.000000000 +0100 @@ -44,6 +44,9 @@ #include <stdio.h> #include <unistd.h> +#if HAVE_OPENSSL_MD5_H || HAVE_OPENSSL_SHA_H || HAVE_OPENSSL_RIPEMD_H +#include <openssl/evp.h> +#endif #ifdef HAVE_OPENSSL_MD5_H #include <openssl/md5.h> #endif @@ -84,8 +87,14 @@ {"ripemd160digest", F_RMD160, NEEDVALUE}, #endif #ifdef HAVE_OPENSSL_SHA_H - {"sha1digest", F_SHA1, NEEDVALUE}, - {"sha256digest", F_SHA256, NEEDVALUE}, + {"sha1", F_SHA1, NEEDVALUE}, + {"sha1digest", F_SHA1, NEEDVALUE}, + {"sha256", F_SHA256, NEEDVALUE}, + {"sha256digest",F_SHA256, NEEDVALUE}, + {"sha384", F_SHA384, NEEDVALUE}, + {"sha384digest",F_SHA384, NEEDVALUE}, + {"sha512", F_SHA512, NEEDVALUE}, + {"sha512digest",F_SHA512, NEEDVALUE}, #endif {"size", F_SIZE, NEEDVALUE}, {"time", F_TIME, NEEDVALUE}, @@ -134,43 +143,57 @@ return string; } -#define DIGEST_FILE(PREFIX, CTX, LENGTH) \ +#define DIGEST_FILE(PREFIX, TYPE) \ char * \ -PREFIX ## _File(const char *filename, char *result) \ +PREFIX ## _File(const char *filename, char *result) \ { \ - u_char md[LENGTH]; \ + u_char md[EVP_MAX_MD_SIZE]; \ u_char buf[1024]; \ - CTX ctx; \ + EVP_MD_CTX *ctx; \ + unsigned int i, mdlen; \ FILE *fp; \ size_t r; \ - int i; \ \ - PREFIX ## _Init(&ctx); \ - if ((fp = fopen(filename, "r")) == NULL) \ + if ((ctx = EVP_MD_CTX_create()) == NULL) \ + return NULL; \ + EVP_DigestInit_ex(ctx, EVP_ ## TYPE(), NULL); \ + if ((fp = fopen(filename, "r")) == NULL) { \ + EVP_MD_CTX_destroy(ctx); \ return NULL; \ + } \ while ((r = fread(buf, 1, sizeof(buf), fp)) != 0) \ - PREFIX ## _Update(&ctx, buf, r); \ + EVP_DigestUpdate(ctx, buf, r); \ if (ferror(fp)) { \ fclose(fp); \ + EVP_MD_CTX_destroy(ctx); \ return NULL; \ } \ fclose(fp); \ - PREFIX ## _Final(md, &ctx); \ - for (i = 0; i < LENGTH; i++) \ + EVP_DigestFinal_ex(ctx, md, &mdlen); \ + for (i = 0; i < mdlen; i++) \ sprintf(result + 2 * i, "%02x", md[i]); \ + EVP_MD_CTX_destroy(ctx); \ return result; \ } -#ifdef HAVE_OPENSSL_MD5_H -DIGEST_FILE(MD5, MD5_CTX, MD5_DIGEST_LENGTH); +#if HAVE_OPENSSL_MD5_H && HAVE_EVP_MD5 +DIGEST_FILE(MD5, md5); #endif -#ifdef HAVE_OPENSSL_SHA_H -DIGEST_FILE(SHA1, SHA_CTX, SHA_DIGEST_LENGTH); -DIGEST_FILE(SHA256, SHA256_CTX, SHA256_DIGEST_LENGTH); +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA1 +DIGEST_FILE(SHA1, sha1); +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA256 +DIGEST_FILE(SHA256, sha256); +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA384 +DIGEST_FILE(SHA384, sha384); +#endif +#if HAVE_OPENSSL_SHA_H && HAVE_EVP_SHA512 +DIGEST_FILE(SHA512, sha512); #endif -#ifdef HAVE_OPENSSL_RIPEMD_H -DIGEST_FILE(RIPEMD160, RIPEMD160_CTX, RIPEMD160_DIGEST_LENGTH); +#if HAVE_OPENSSL_RIPEMD_H && HAVE_EVP_RIPEMD160 +DIGEST_FILE(RIPEMD160, ripemd160); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/mtree.8 new/mtree-port-1.0.4/mtree.8 --- old/mtree-port-1.0.3/mtree.8 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/mtree.8 2017-12-07 23:59:27.000000000 +0100 @@ -36,7 +36,7 @@ .Nd map a directory hierarchy .Sh SYNOPSIS .Nm -.Op Fl LPUcdeinqruxw +.Op Fl LPUcdeinqruVwx .Bk -words .Op Fl f Ar spec .Ek @@ -164,12 +164,18 @@ Use the file hierarchy rooted in .Ar path , instead of the current directory. +.It Fl r +Remove any files in the file hierarchy that are not described in the specification. .It Fl s Ar seed Display a single checksum to the standard error output that represents all of the files for which the keyword .Cm cksum was specified. The checksum is seeded with the specified value. +.It Fl V +When +.Fl r +is specified, also recursively remove non-empty directories. .It Fl X Ar exclude-list The specified file contains .Xr fnmatch 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/mtree.c new/mtree-port-1.0.4/mtree.c --- old/mtree-port-1.0.3/mtree.c 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/mtree.c 2017-12-07 23:59:27.000000000 +0100 @@ -55,7 +55,7 @@ #include "extern.h" int ftsoptions = FTS_PHYSICAL; -int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag, wflag; +int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag, wflag, vflag; u_int keys; char fullpath[MAXPATHLEN]; @@ -75,7 +75,7 @@ spec1 = stdin; spec2 = NULL; - while ((ch = getopt(argc, argv, "cdef:I:iK:k:LnPp:qrs:UuwxX:")) != -1) + while ((ch = getopt(argc, argv, "cdef:I:iK:k:LnPp:qrs:UuwVxX:")) != -1) switch((char)ch) { case 'c': cflag = 1; @@ -151,6 +151,9 @@ case 'w': wflag = 1; break; + case 'V': + vflag = 1; + break; case 'x': ftsoptions |= FTS_XDEV; break; @@ -190,7 +193,7 @@ usage(void) { (void)fprintf(stderr, -"usage: mtree [-LPUcdeinqruxw] [-f spec] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n" +"usage: mtree [-LPUcdeinqruVxw] [-f spec] [-K key] [-k key] [-p path] [-s seed]\n" "\t[-X excludes]\n"); exit(1); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/mtree.h new/mtree-port-1.0.4/mtree.h --- old/mtree-port-1.0.3/mtree.h 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/mtree.h 2017-12-07 23:59:27.000000000 +0100 @@ -53,6 +53,8 @@ char *md5digest; /* MD5 digest */ char *sha1digest; /* SHA-1 digest */ char *sha256digest; /* SHA-256 digest */ + char *sha384digest; /* SHA-384 digest */ + char *sha512digest; /* SHA-512 digest */ char *rmd160digest; /* RIPEMD160 digest */ char *slink; /* symbolic link reference */ uid_t st_uid; /* uid */ @@ -62,38 +64,40 @@ u_long st_flags; /* flags */ nlink_t st_nlink; /* link count */ -#define F_CKSUM 0x0001 /* check sum */ -#define F_DONE 0x0002 /* directory done */ -#define F_GID 0x0004 /* gid */ -#define F_GNAME 0x0008 /* group name */ -#define F_IGN 0x0010 /* ignore */ -#define F_MAGIC 0x0020 /* name has magic chars */ -#define F_MODE 0x0040 /* mode */ -#define F_NLINK 0x0080 /* number of hardlinks */ -#define F_SIZE 0x0100 /* size */ -#define F_SLINK 0x0200 /* symbolic link path */ -#define F_TIME 0x0400 /* modification time */ -#define F_TYPE 0x0800 /* file type */ -#define F_UID 0x1000 /* uid */ -#define F_UNAME 0x2000 /* user name */ -#define F_VISIT 0x4000 /* file visited */ -#define F_MD5 0x8000 /* MD5 digest */ -#define F_NOCHANGE 0x10000 /* If owner/mode "wrong", do */ - /* not change */ -#define F_SHA1 0x20000 /* SHA-1 digest */ -#define F_RMD160 0x40000 /* RIPEMD160 digest */ -#define F_FLAGS 0x80000 /* file flags */ -#define F_SHA256 0x100000 /* SHA-256 digest */ -#define F_OPT 0x200000 /* existence optional */ +#define F_CKSUM 0x000001 /* check sum */ +#define F_DONE 0x000002 /* directory done */ +#define F_GID 0x000004 /* gid */ +#define F_GNAME 0x000008 /* group name */ +#define F_IGN 0x000010 /* ignore */ +#define F_MAGIC 0x000020 /* name has magic chars */ +#define F_MODE 0x000040 /* mode */ +#define F_NLINK 0x000080 /* number of hardlinks */ +#define F_SIZE 0x000100 /* size */ +#define F_SLINK 0x000200 /* symbolic link path */ +#define F_TIME 0x000400 /* modification time */ +#define F_TYPE 0x000800 /* file type */ +#define F_UID 0x001000 /* uid */ +#define F_UNAME 0x002000 /* user name */ +#define F_VISIT 0x004000 /* file visited */ +#define F_MD5 0x008000 /* MD5 digest */ +#define F_NOCHANGE 0x010000 /* If owner/mode "wrong", do */ + /* not change */ +#define F_SHA1 0x020000 /* SHA-1 digest */ +#define F_RMD160 0x040000 /* RIPEMD160 digest */ +#define F_FLAGS 0x080000 /* file flags */ +#define F_SHA256 0x100000 /* SHA-256 digest */ +#define F_OPT 0x200000 /* existence optional */ u_int flags; /* items set */ +#define F_SHA384 0x400000 /* SHA-384 digest */ +#define F_SHA512 0x800000 /* SHA-512 digest */ -#define F_BLOCK 0x001 /* block special */ -#define F_CHAR 0x002 /* char special */ -#define F_DIR 0x004 /* directory */ -#define F_FIFO 0x008 /* fifo */ -#define F_FILE 0x010 /* regular file */ -#define F_LINK 0x020 /* symbolic link */ -#define F_SOCK 0x040 /* socket */ +#define F_BLOCK 0x001 /* block special */ +#define F_CHAR 0x002 /* char special */ +#define F_DIR 0x004 /* directory */ +#define F_FIFO 0x008 /* fifo */ +#define F_FILE 0x010 /* regular file */ +#define F_LINK 0x020 /* symbolic link */ +#define F_SOCK 0x040 /* socket */ u_char type; /* file type */ char name[1]; /* file name (must be last) */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/spec.c new/mtree-port-1.0.4/spec.c --- old/mtree-port-1.0.3/spec.c 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/spec.c 2017-12-07 23:59:27.000000000 +0100 @@ -201,6 +201,16 @@ if(!ip->sha256digest) errx(1, "strdup"); break; + case F_SHA384: + ip->sha384digest = strdup(val); + if(!ip->sha384digest) + errx(1, "strdup"); + break; + case F_SHA512: + ip->sha512digest = strdup(val); + if(!ip->sha512digest) + errx(1, "strdup"); + break; case F_RMD160: ip->rmd160digest = strdup(val); if(!ip->rmd160digest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/specspec.c new/mtree-port-1.0.4/specspec.c --- old/mtree-port-1.0.3/specspec.c 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/specspec.c 2017-12-07 23:59:27.000000000 +0100 @@ -90,6 +90,10 @@ printf(" rmd160digest=%s", n->rmd160digest); if (f & F_SHA256) printf(" sha256digest=%s", n->sha256digest); + if (f & F_SHA384) + printf(" sha384digest=%s", n->sha384digest); + if (f & F_SHA512) + printf(" sha512digest=%s", n->sha512digest); if (f & F_FLAGS) printf(" flags=%s", flags_to_string(n->st_flags)); printf("\n"); @@ -170,6 +174,10 @@ differs |= F_RMD160; if (FS(n1, n2, F_SHA256, sha256digest)) differs |= F_SHA256; + if (FS(n1, n2, F_SHA384, sha384digest)) + differs |= F_SHA384; + if (FS(n1, n2, F_SHA512, sha512digest)) + differs |= F_SHA512; if (FF(n1, n2, F_FLAGS, st_flags)) differs |= F_FLAGS; if (differs) { @@ -220,19 +228,22 @@ } } if (c1 == NULL && c2->type == F_DIR) { - asprintf(&np, "%s%s/", path, c2->name); + if (asprintf(&np, "%s%s/", path, c2->name) == -1) + err(1, "asprintf"); i = walk_in_the_forest(c1, c2, np); free(np); i += compare_nodes(c1, c2, path); } else if (c2 == NULL && c1->type == F_DIR) { - asprintf(&np, "%s%s/", path, c1->name); + if (asprintf(&np, "%s%s/", path, c1->name) == -1) + err(1, "asprintf"); i = walk_in_the_forest(c1, c2, np); free(np); i += compare_nodes(c1, c2, path); } else if (c1 == NULL || c2 == NULL) { i = compare_nodes(c1, c2, path); } else if (c1->type == F_DIR && c2->type == F_DIR) { - asprintf(&np, "%s%s/", path, c1->name); + if (asprintf(&np, "%s%s/", path, c1->name) == -1) + err(1, "asprintf"); i = walk_in_the_forest(c1, c2, np); free(np); i += compare_nodes(c1, c2, path); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mtree-port-1.0.3/verify.c new/mtree-port-1.0.4/verify.c --- old/mtree-port-1.0.3/verify.c 2015-06-10 16:32:22.000000000 +0200 +++ new/mtree-port-1.0.4/verify.c 2017-12-07 23:59:27.000000000 +0100 @@ -55,6 +55,7 @@ static void miss(NODE *, char *); static int vwalk(void); +static int recursive_delete(char *dir); int mtree_verifyspec(FILE *fi) @@ -142,10 +143,17 @@ if (!eflag) { (void)printf("%s extra", RP(p)); if (rflag) { - if ((S_ISDIR(p->fts_statp->st_mode) - ? rmdir : unlink)(p->fts_accpath)) { - (void)printf(", not removed: %s", - strerror(errno)); + if ((S_ISDIR(p->fts_statp->st_mode) ? rmdir : unlink)(p->fts_accpath)) { + if (errno == ENOTEMPTY && vflag) { + if (recursive_delete(p->fts_accpath) == -1) { + (void)printf(", not removed: %s", + strerror(errno)); + } else + (void)printf(", removed"); + } else { + (void)printf(", not removed: %s", + strerror(errno)); + } } else (void)printf(", removed"); } @@ -159,6 +167,51 @@ return (rval); } +static int +recursive_delete(char *dir) +{ + char *const files[] = { dir, NULL }; + FTSENT *ent; + FTS *fts; + + // Open dir + if ((fts = fts_open(files, FTS_NOCHDIR | FTS_PHYSICAL | FTS_XDEV, NULL)) == NULL) + return -1; + + // Recurse and delete + while ((ent = fts_read(fts)) != NULL) { + switch (ent->fts_info) { + case FTS_NS: + case FTS_DNR: + case FTS_ERR: + printf(", error visiting %s: %s", ent->fts_accpath, strerror(ent->fts_errno)); + fts_close(fts); + errno = ENOTEMPTY; + return -1; + + case FTS_DP: + case FTS_F: + case FTS_SL: + case FTS_SLNONE: + case FTS_DEFAULT: + if (remove(ent->fts_accpath) == -1) { + printf(", error removing %s: %s", ent->fts_accpath, strerror(errno)); + fts_close(fts); + errno = ENOTEMPTY; + return -1; + } + break; + + default: + break; + } + } + + // Done + fts_close(fts); + return 0; +} + static void miss(NODE *p, char *tail) {
