NetBSD Problem Report #57891

From  Mon Jan 29 21:36:25 2024
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id D9FBB1A9238
	for <>; Mon, 29 Jan 2024 21:36:25 +0000 (UTC)
Message-Id: <>
Date: Mon, 29 Jan 2024 21:36:24 +0000 (UTC)
Subject: stat(1) should interpret st_flags as it does with st_mode
X-Send-Pr-Version: www-1.0

>Number:         57891
>Category:       bin
>Synopsis:       stat(1) should interpret st_flags as it does with st_mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 29 21:40:00 +0000 2024
>Last-Modified:  Fri Feb 02 22:59:48 +0000 2024
>Originator:     Ricardo Branco
>Release:        NetBSD 10.0_RC3
The only output for st_flags in stat(1) is numeric.

This patch allows "-f %Sf" to display the file flags symbolically.

With this patch:

$ touch /tmp/abc
$ chflags uchg /tmp/abc
$ ./stat -f '%Sf %N' /tmp/abc
uchg /tmp/abc

This is an adaptation of a fix I submitted years ago to FreeBSD:



From: "Christos Zoulas" <>
Subject: PR/57891 CVS commit: src/usr.bin/stat
Date: Mon, 29 Jan 2024 16:55:24 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Mon Jan 29 21:55:24 UTC 2024

 Modified Files:
 	src/usr.bin/stat: Makefile stat.1 stat.c

 Log Message:
 PR/57891: Roberto Branco: add symbolic flags printing (from FreeBSD)

 To generate a diff of this commit:
 cvs rdiff -u -r1.13 -r1.14 src/usr.bin/stat/Makefile
 cvs rdiff -u -r1.46 -r1.47 src/usr.bin/stat/stat.1
 cvs rdiff -u -r1.48 -r1.49 src/usr.bin/stat/stat.c

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


NetBSD Home
NetBSD PR Database Search

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