NetBSD Problem Report #57891

From www@netbsd.org  Mon Jan 29 21:36:25 2024
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))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D9FBB1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 29 Jan 2024 21:36:25 +0000 (UTC)
Message-Id: <20240129213624.63A251A9239@mollari.NetBSD.org>
Date: Mon, 29 Jan 2024 21:36:24 +0000 (UTC)
From: rbranco@suse.de
Reply-To: rbranco@suse.de
To: gnats-bugs@NetBSD.org
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
>Organization:
>Environment:
>Description:
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
```
>How-To-Repeat:

>Fix:
This is an adaptation of a fix I submitted years ago to FreeBSD:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=124349

Fix: https://github.com/NetBSD/src/pull/27

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
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.

>Unformatted:

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-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.