[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #64088] find should support file attribute flags (immutable, append

From: anonymous
Subject: [bug #64088] find should support file attribute flags (immutable, append-only, fscrypt, etc.)
Date: Fri, 21 Apr 2023 18:55:43 -0400 (EDT)


                 Summary: find should support file attribute flags (immutable,
append-only, fscrypt, etc.)
                   Group: findutils
               Submitter: None
               Submitted: Fri 21 Apr 2023 10:55:41 PM UTC
                Category: find
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Andreas Dilger
        Originator Email: adilger.gnufind@dilger.ca
             Open/Closed: Open
                 Release: None
         Discussion Lock: Any
           Fixed Release: None


Follow-up Comments:

Date: Fri 21 Apr 2023 10:55:41 PM UTC By: Anonymous
It should be possible to use find to locate files and directories with or
without specific file attribute flags, such as append-only, immutable, nodump,
fscrypt, verity, dax, projinherit, etc.

Some of these flags are Linux-specific, or filesystem-specific, but some of
them are available on multiple OSes and filesystems (e.g. append-only,
immutable, nodump).   On Linux the file attributes are available via the
"statx(3)" syscall so there is no extra overhead to fetching them, otherwise
if statx(3) is not available they can be accessed on multiple filesystems
(ext2, ext4, XFS, btrfs, etc.) via:

    long flags;

    ioctl(fd, FS_IOC_GETFLAGS, &flags);

This allows finding e.g. files that meet specific security or administrative
requirements (e.g. should be immutable, encrypted, have project quotas,

I would suggest to use "[!] -attr [^]ATTR[,[^]ATTR]" to find files
with/without the named attributes. [^] means files do NOT have the named
attribute, which allows specifying a mix of attributes that are or are not set
on a single file, as opposed to unlisted attributes that are ignored.

It should also be possible to print a comma-separated list of file attribute
names (or hex number for unknown attributes) with "-printf", possibly "%e"
could be used (vs. "%x" for -xattr which is different), since it is unused by
both "find" and "stat(1)".


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]