Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-16560

'lfs find -printf %w' does not print birth time

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • None
    • None
    • 3
    • 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
      

      Attachments

        Issue Links

          Activity

            People

              georgea Anjus George
              adilger Andreas Dilger
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: