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

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60379
>Category:       bin
>Synopsis:       file(1) should recognize snapshot files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 28 18:20: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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.