[LU-16560] 'lfs find -printf %w' does not print birth time Created: 15/Feb/23  Updated: 11/May/23

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

Type: Bug Priority: Minor
Reporter: Andreas Dilger Assignee: Anjus George
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Related
is related to LU-5170 lfs usability Open
is related to LU-15837 "lfs find -printf" improvements Open
is related to LU-15504 "lfs find" is missing "-ls" support Open
is related to LU-10378 "lfs find" is missing "-printf" support Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

I was using "lfs find -printf" to generate output similar to "find -ls" until LU-15504 is implemented, and incorrectly used "%w" instead of "%t" to print the timestamp.

This showed that the birth time is not being printed properly, always printing the epoch zero time for the birth time:

$ lfs find /myth/tmp/adilger  -size +512k -printf "%Li %LF %b %U %G %s %w %p\n"
4 0x20003b551:0xb:0x0 266240 1000 1000 136314880 Wed Dec 31 17:00:00 1969 /myth/tmp/adilger/pflfile2
1 0x200035f67:0xd55:0x0 16384 1000 1000 8388608 Wed Dec 31 17:00:00 1969 /myth/tmp/adilger/pflfile8

Using the "%t" format showed that it is printing the mtime properly:

$ lfs find /myth/tmp/adilger  -size +512k -printf "%Li %LF %b %U %G %s %t %p\n"
4 0x20003b551:0xb:0x0 266240 1000 1000 136314880 Fri Jul 29 16:28:17 2022 /myth/tmp/adilger/pflfile2
1 0x200035f67:0xd55:0x0 16384 1000 1000 8388608 Fri Aug 12 19:16:28 2022 /myth/tmp/adilger/pflfile8

Running the statx tool on the file showed that the birth time was correctly set on the inode and being returned by statx() syscall to userspace, so the problem appears to be in the "lfs find -printf" handling for this attribute:

$ ./lustre/tests/statx /myth/tmp/adilger/pflfile{2,8}
  File: /myth/tmp/adilger/pflfile2
  Size: 136314880 	Blocks: 266240     IO Block: 4194304 regular file
Device: 9a6023aeh/2589991854d	Inode: 144119265358774283  Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/ adilger)   Gid: ( 1000/ adilger)
Context: unconfined_u:object_r:unlabeled_t:s0
Access: 2022-07-29 16:28:48.000000000 -0600
Modify: 2022-07-29 16:28:17.000000000 -0600
Change: 2022-07-29 16:28:48.000000000 -0600
 Birth: 2022-07-29 16:27:51.000000000 -0600
  File: /myth/tmp/adilger/pflfile8
  Size: 8388608   	Blocks: 16384      IO Block: 4194304 regular file
Device: 9a6023aeh/2589991854d	Inode: 144118896360688981  Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/ adilger)   Gid: ( 1000/ adilger)
Context: system_u:object_r:unlabeled_t:s0
Access: 2022-08-12 19:21:46.000000000 -0600
Modify: 2022-08-12 19:16:28.000000000 -0600
Change: 2022-08-12 19:21:46.000000000 -0600
 Birth: 2022-08-12 19:16:28.000000000 -0600


 Comments   
Comment by Andreas Dilger [ 15/Feb/23 ]

Anjus, would you be able to take a look at this issue?

Comment by Anjus George [ 16/Feb/23 ]

Andreas, thanks for reporting. This is interesting. And yes I will take a look at it.

Comment by Gerrit Updater [ 11/May/23 ]

"Anjus George <georgea@ornl.gov>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/50958
Subject: LU-16560 utils: correct lfs find printf btime
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 8f598c273443a4af654cade5407c0857bb514989

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