NetBSD Problem Report #60379

From www@netbsd.org  Sun Jun 28 18:19:57 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) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4DD841A923A
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 28 Jun 2026 18:19:57 +0000 (UTC)
Message-Id: <20260628181956.3AB391A923B@mollari.NetBSD.org>
Date: Sun, 28 Jun 2026 18:19:56 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: file(1) should recognize snapshot files
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         60379
>Category:       bin
>Synopsis:       file(1) should recognize snapshot files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          pending-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 28 18:20:00 +0000 2026
>Closed-Date:    
>Last-Modified:  Fri Oct 23 16:35:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The NetBSnapD Filer, Inc.
>Environment:
>Description:

	file(1) should recognize snapshot files as such, rather than
	report `regular file, no read permission'.

>How-To-Repeat:

	# fssconfig fss0 / /.snap/20260628T181411Z
	# ls -loa /.snap
	total 8720
	drwxr-xr-x   2 root  wheel  -            512 Jun 28 18:14 .
	drwxr-xr-x  23 root  wheel  -            512 Jun 28 18:13 ..
	-rw-------   1 root  wheel  snap 63763907072 Jun 28 18:14 20260628T181411Z
	# file /.snap/20260628T181411Z
	/.snap/20260628T181411Z: regular file, no read permission

>Fix:

	Yes, please!  Presumably it is just a matter of checking
	st_flags for SF_SNAPSHOT like ls(1) does, via
	flags_to_string(3) in libutil:

    596 					flags =
    597 					    flags_to_string((u_long)sp->st_flags, "-");

https://nxr.netbsd.org/xref/src/bin/ls/ls.c?r=1.79#595

     68 char *
     69 flags_to_string(u_long flags, const char *def)
     70 {
...
     92 	if (flags & SF_SNAPSHOT)
     93 		SAPPEND("snap");

https://nxr.netbsd.org/xref/src/lib/libutil/stat_flags.c?r=1.3#63

	Make sure to update
	https://wiki.NetBSD.org/tutorials/how_to_use_snapshots/
	if this is fixed.

>Release-Note:

>Audit-Trail:

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60379 CVS commit: src/external/bsd/file
Date: Sun, 23 Aug 2026 23:43:38 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sun Aug 23 23:43:38 UTC 2026

 Modified Files:
 	src/external/bsd/file/dist: configure.ac
 	src/external/bsd/file/dist/src: fsmagic.c
 	src/external/bsd/file/include: config.h

 Log Message:
 file(1): Detect internal file system snapshots.

 PR bin/60379: file(1) should recognize snapshot files


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 src/external/bsd/file/dist/configure.ac
 cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/src/fsmagic.c
 cvs rdiff -u -r1.21 -r1.22 src/external/bsd/file/include/config.h

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

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 23 Aug 2026 23:45:59 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-11, pullup-10, pullup-9


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60379 CVS commit: src/tests/dev/fss
Date: Mon, 24 Aug 2026 00:17:35 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Aug 24 00:17:35 UTC 2026

 Modified Files:
 	src/tests/dev/fss: t_fss.sh

 Log Message:
 tests/dev/fss: New test of internal snapshots.

 Verify that ls(1), find(1), and file(1) identify them as such too.

 PR bin/60379: file(1) should recognize snapshot files
 PR bin/60380: find(1) can't find snapshots


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/tests/dev/fss/t_fss.sh

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

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 20 Oct 2026 20:32:35 +0000
State-Changed-Why:
pullup-11 #538
pullup-10 #1384


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60379 CVS commit: [netbsd-11] src
Date: Fri, 23 Oct 2026 16:28:27 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Oct 23 16:28:27 UTC 2026

 Modified Files:
 	src/external/bsd/file/dist [netbsd-11]: configure.ac
 	src/external/bsd/file/dist/src [netbsd-11]: fsmagic.c
 	src/external/bsd/file/include [netbsd-11]: config.h
 	src/lib/libutil [netbsd-11]: stat_flags.c
 	src/tests/dev/fss [netbsd-11]: t_fss.sh

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #538):

 	external/bsd/file/dist/src/fsmagic.c: revision 1.19
 	external/bsd/file/include/config.h: revision 1.22
 	tests/dev/fss/t_fss.sh: revision 1.8
 	lib/libutil/stat_flags.c: revision 1.4
 	lib/libutil/stat_flags.c: revision 1.5
 	external/bsd/file/dist/configure.ac: revision 1.24
 	(all via patch)

 string_to_flags(3): Support `snap' (SF_SNAPSHOT).

 PR bin/60380: find(1) can't find snapshots

 string_to_flags(3): Put `snap' under #ifdef SF_SNAPSHOT.

 Same as in flags_to_string(3).  Not really sure why, but let's keep it
 consistent so there's only one question to ponder and not two.

 PR bin/60380: find(1) can't find snapshots

 file(1): Detect internal file system snapshots.

 PR bin/60379: file(1) should recognize snapshot files

 tests/dev/fss: New test of internal snapshots.
 Verify that ls(1), find(1), and file(1) identify them as such too.
 PR bin/60379: file(1) should recognize snapshot files
 PR bin/60380: find(1) can't find snapshots


 To generate a diff of this commit:
 cvs rdiff -u -r1.22 -r1.22.4.1 src/external/bsd/file/dist/configure.ac
 cvs rdiff -u -r1.18 -r1.18.4.1 src/external/bsd/file/dist/src/fsmagic.c
 cvs rdiff -u -r1.20 -r1.20.2.1 src/external/bsd/file/include/config.h
 cvs rdiff -u -r1.3 -r1.3.6.1 src/lib/libutil/stat_flags.c
 cvs rdiff -u -r1.7 -r1.7.2.1 src/tests/dev/fss/t_fss.sh

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60379 CVS commit: [netbsd-10] src
Date: Fri, 23 Oct 2026 16:30:36 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Fri Oct 23 16:30:36 UTC 2026

 Modified Files:
 	src/external/bsd/file/dist [netbsd-10]: configure.ac
 	src/external/bsd/file/dist/src [netbsd-10]: fsmagic.c
 	src/external/bsd/file/include [netbsd-10]: config.h
 	src/lib/libutil [netbsd-10]: stat_flags.c
 	src/tests/dev/fss [netbsd-10]: t_fss.sh

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #1384):

 	external/bsd/file/dist/src/fsmagic.c: revision 1.19
 	external/bsd/file/include/config.h: revision 1.22
 	tests/dev/fss/t_fss.sh: revision 1.8
 	lib/libutil/stat_flags.c: revision 1.4
 	lib/libutil/stat_flags.c: revision 1.5
 	external/bsd/file/dist/configure.ac: revision 1.24
 	(all via patch)

 string_to_flags(3): Support `snap' (SF_SNAPSHOT).

 PR bin/60380: find(1) can't find snapshots

 string_to_flags(3): Put `snap' under #ifdef SF_SNAPSHOT.

 Same as in flags_to_string(3).  Not really sure why, but let's keep it
 consistent so there's only one question to ponder and not two.

 PR bin/60380: find(1) can't find snapshots

 file(1): Detect internal file system snapshots.

 PR bin/60379: file(1) should recognize snapshot files

 tests/dev/fss: New test of internal snapshots.
 Verify that ls(1), find(1), and file(1) identify them as such too.
 PR bin/60379: file(1) should recognize snapshot files
 PR bin/60380: find(1) can't find snapshots


 To generate a diff of this commit:
 cvs rdiff -u -r1.21 -r1.21.2.1 src/external/bsd/file/dist/configure.ac
 cvs rdiff -u -r1.17 -r1.17.2.1 src/external/bsd/file/dist/src/fsmagic.c
 cvs rdiff -u -r1.18 -r1.18.2.1 src/external/bsd/file/include/config.h
 cvs rdiff -u -r1.3 -r1.3.2.1 src/lib/libutil/stat_flags.c
 cvs rdiff -u -r1.5 -r1.5.2.1 src/tests/dev/fss/t_fss.sh

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

>Unformatted:

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.