NetBSD Problem Report #59985

From www@netbsd.org  Sun Feb  8 17:47:30 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2CEE41A923D
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  8 Feb 2026 17:47:30 +0000 (UTC)
Message-Id: <20260208174729.01C6C1A923E@mollari.NetBSD.org>
Date: Sun,  8 Feb 2026 17:47:28 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: makefs(8): way to flag files in spec missing from fs
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         59985
>Category:       bin
>Synopsis:       makefs(8): way to flag files in spec missing from fs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 08 17:50:00 +0000 2026
>Last-Modified:  Mon Feb 09 07:05:01 +0000 2026
>Originator:     Taylor R Campbell
>Release:        
>Organization:
The MakeBSD Filesystemation
>Environment:
>Description:

        If the mtree specfile lists a file, but it's not in the input
        directory, makefs(8) will create an empty file in its place:

     -F mtree-specfile
           Use mtree-specfile as an mtree(8) `specfile' specification.
...
           In the opposite case (where a specfile entry does not have an entry
           in the underlying file system) the following occurs: If the
           specfile entry is marked optional, the specfile entry is ignored.
           Otherwise, the entry will be created in the image, and it is
           necessary to specify at least the following parameters in the
...
           used.  Missing regular file entries will be created as zero-length
           files.

	While this may be useful for, e.g., populating device nodes
	from a portable context that may not allow device nodes in the
	input directory, it's a little troublesome for regular files: a
	manually crafted specfile might have a typo, and the result
	will be (a) the wrongly spelled name will manifest as an empty
	file, while (b) the rightly spelled name will missing, all
	without a hint of warning from makefs(8).

	It would be nice if there were a way to request that makefs(8)
	verify regular files listed in the mtree specfile exist in the
	input directory, or else make the operation fail.

>How-To-Repeat:

	$ mkdir foo
	$ echo hello > foo/bar
	$ echo world > foo/quux
	$ cat >foo/.mtree <<EOF
	. type=dir
	./baz type=file uname=root gname=wheel mode=0644
	./quux type=file uname=root gname=wheel mode=0644
	EOF
	$ makefs -F foo/.mtree -s 1m foo.img foo
	Calculated size of `foo.img': 1048576 bytes, 6 inodes
	Extent size set to 8192
	foo.img: 1.0MB (2048 sectors) block size 8192, fragment size 1024
		using 1 cylinder groups of 1.00MB, 128 blks, 64 inodes.
	super-block backups (for fsck -b #) at:
	 32,
	Populating `foo.img'
	Image `foo.img' complete
	$ 

>Fix:

	- Maybe another command line option to makefs(8)?
	- Maybe some syntax or tag or option in mtree specfiles?

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/59985: makefs(8): way to flag files in spec missing from fs
Date: Mon, 9 Feb 2026 08:00:32 +0100

 On Sun, Feb 08, 2026 at 05:50:00PM +0000, campbell+netbsd@mumble.net via gnats wrote:
 > 	It would be nice if there were a way to request that makefs(8)
 > 	verify regular files listed in the mtree specfile exist in the
 > 	input directory, or else make the operation fail.

 Side note: for totally unrelated reasons it would be great if mtree specfiles
 would allow marking entries as optional or explicitly spell out various
 alternatives (e.g. a directory that could optionally be a symlink instead,
 but would cause an error message if neither was there or something else
 under the same name).

 Martin

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.