NetBSD Problem Report #60627

From www@netbsd.org  Fri Aug 21 03:41: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 "YR2" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 69FC81A923B
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 21 Aug 2026 03:41:30 +0000 (UTC)
Message-Id: <20260821034129.5FC0A1A923C@mollari.NetBSD.org>
Date: Fri, 21 Aug 2026 03:41:29 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: restore(8): -M mtree output fails to vis-encode paths
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         60627
>Category:       bin
>Synopsis:       restore(8): -M mtree output fails to vis-encode paths
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 21 03:45:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The NetMtree Restoration, Inc.
>Environment:
>Description:

	The restore(8) `-M mtree' option is supposed to print
	owner/group/mode/link/&c. information in mtree format so it can
	later be passed to mtree(8) to restore those attributes.

	But it passes pathnames through verbatim instead of quoting
	them with vis(3) like the mtree format demands:

    410 void
    411 writemtree(const char *name, const char *type,
    412     const uid_t uid, const gid_t gid, const mode_t mode, const u_long flags)
    413 {
    414 	const char *sep = "";
    415 	if ((name[0] != '.') || (name[1] != '/' && name[1] != '\0'))
    416 		fprintf(Mtreefile, "./");
    417 	fprintf(Mtreefile, "%s type=%s uid=%d gid=%d mode=%#4.4o",
    418 	    name, type, uid, gid,
    419 	    mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISTXT));

https://nxr.netbsd.org/xref/src/sbin/restore/utilities.c?r=1.24#410

>How-To-Repeat:

	code inspection and/or just trip over it, really

>Fix:

	call vis(3) (well, strsnxvisywig or whatever)

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.