Module Name:    src
Committed By:   christos
Date:           Wed May  8 15:57:56 UTC 2024

Modified Files:
        src/usr.sbin/makefs: makefs.8 makefs.c walk.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/walk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.71 src/usr.sbin/makefs/makefs.8:1.72
--- src/usr.sbin/makefs/makefs.8:1.71	Thu Nov 17 01:40:41 2022
+++ src/usr.sbin/makefs/makefs.8	Wed May  8 11:57:56 2024
@@ -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 .

Index: src/usr.sbin/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.57 src/usr.sbin/makefs/makefs.c:1.58
--- src/usr.sbin/makefs/makefs.c:1.57	Sun Feb 18 11:59:16 2024
+++ src/usr.sbin/makefs/makefs.c	Wed May  8 11:57:56 2024
@@ -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':

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.39 src/usr.sbin/makefs/walk.c:1.40
--- src/usr.sbin/makefs/walk.c:1.39	Wed Apr 24 17:59:39 2024
+++ src/usr.sbin/makefs/walk.c	Wed May  8 11:57:56 2024
@@ -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 
 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, con
 	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 *spe
 					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,

Reply via email to