Add an option to warn and error out for mtree missing entries.

This commit is contained in:
christos 2024-05-08 15:57:56 +00:00
parent 71dca2bb1e
commit 0fe82aa40b
3 changed files with 20 additions and 7 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: makefs.8,v 1.71 2022/11/17 06:40:41 chs Exp $
.\" $NetBSD: makefs.8,v 1.72 2024/05/08 15:57:56 christos Exp $
.\"
.\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
.\" All rights reserved.
@ -33,7 +33,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 4, 2021
.Dd May 8, 2024
.Dt MAKEFS 8
.Os
.Sh NAME
@ -260,6 +260,10 @@ ISO/Ecma UDF file system.
.El
.It Fl x
Exclude file system nodes not explicitly listed in the specfile.
Repeating this flag causes
.Nm
to print a warning for each missing system nodes and exit with an error code
if there are any missing.
.It Fl Z
Create a sparse file for
.Sy ffs .

View File

@ -1,4 +1,4 @@
/* $NetBSD: makefs.c,v 1.57 2024/02/18 16:59:16 christos Exp $ */
/* $NetBSD: makefs.c,v 1.58 2024/05/08 15:57:56 christos Exp $ */
/*
* Copyright (c) 2001-2003 Wasabi Systems, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: makefs.c,v 1.57 2024/02/18 16:59:16 christos Exp $");
__RCSID("$NetBSD: makefs.c,v 1.58 2024/05/08 15:57:56 christos Exp $");
#endif /* !__lint */
#include <assert.h>
@ -261,7 +261,7 @@ main(int argc, char *argv[])
break;
case 'x':
fsoptions.onlyspec = 1;
fsoptions.onlyspec++;
break;
case 'Z':

View File

@ -1,4 +1,4 @@
/* $NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $ */
/* $NetBSD: walk.c,v 1.40 2024/05/08 15:57:56 christos Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $");
__RCSID("$NetBSD: walk.c,v 1.40 2024/05/08 15:57:56 christos Exp $");
#endif /* !__lint */
#include <sys/param.h>
@ -65,6 +65,7 @@ static void apply_specentry(const char *, NODE *, fsnode *);
static fsnode *create_fsnode(const char *, const char *, const char *,
struct stat *);
static fsinode *link_check(fsinode *);
static size_t missing = 0;
/*
* fsnode_cmp --
@ -429,6 +430,9 @@ apply_specfile(const char *specfile, const char *dir, fsnode *parent, int specon
apply_specdir(dir, root, parent, speconly);
free_nodes(root);
if (missing)
errx(EXIT_FAILURE, "Add %zu missing entries in `%s'",
missing, specfile);
}
static void
@ -469,6 +473,11 @@ apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly)
break;
}
if (curnode == NULL) {
if (speconly > 1) {
warnx("missing specfile entry for %s/%s",
dir, curfsnode->name);
missing++;
}
if (debug & DEBUG_APPLY_SPECONLY) {
printf("%s: trimming %s/%s %p\n",
__func__, dir, curfsnode->name,