[LU-17219] lfs find: add ability to print extended attributes Created: 23/Oct/23  Updated: 02/Nov/23

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Thomas Bertschinger Assignee: WC Triage
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Related
is related to LU-15837 "lfs find -printf" improvements Open
is related to LU-15743 "lfs find" is missing "-xattr" support Open
is related to LU-13031 store JobID of program that created f... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

"lfs find" should have a printf option to be able to print extended attributes of files.

 

There are some design questions about the correct way for this to work:

  • which xattrs should actually get printed? Should it only print xattrs that are matched with a supplied "-xattr" argument? what if no xattr argument is supplied?
  • if multiple xattrs are printed per file should they be newline separated, or separated with some other character?
  • different formats for printing, e.g., text, hex, base64, etc?

 

One of the main use cases for this would be printing job IDs for files that are matched with something like:
lfs find -xattr "user.job=" /mnt/lustre



 Comments   
Comment by Andreas Dilger [ 24/Oct/23 ]

I'm thinking that the printing option should only print specific xattrs that are requested, though it would be possible to print all of the xattrs with a "*" wildcard. One option is the xattr specified by "--xattr", but that restricts the printing to specific xattrs that match a search criterion. That might be OK because why would we want to print an xattr that is not set on a file?

That said, my preference would be to have an option like "--printf %Lx:XATTR" to print XATTR as ASCII, and "--printf %LX:XATTR" to print XATTR as hex. It isn't totally clear if we want to also print the xattr name, but that could be part of the explicit printf format, like "--printf user.job=%Lx:XATTR" or similar. Alternately, there could be sub-options like "%Lxa:XATTR" to print the value in ASCII format, "%Lxh:XATTR" to print the value in hex, and "%Lxb" to print in base64. I don't think it makes sense to have a "%Lxn:XATTR" to print the xattr name, since that would just be XATTR, unless it is a glob pattern and we want to print the matching xattr names?

Generated at Sat Feb 10 03:33:37 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.