[PATCH] D139980: [lld-macho][test][nfc] Update stabs.s to use touch -d instead of -t

Pengxuan Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 14:14:43 PST 2022


pzheng added a comment.

Thanks for checking, @haowei!

I noticed this test failure only when running the test in a singularity container (guest os: Ubuntu16 and host os: SLES12). To be clear, this test runs fine on the same host outside the container. The failure seems to be a result of the container failing to honor the UTC time zone when executing the touch command. For example, here is what it looks like when running touch inside the container.

  Singularity> env TZ=UTC touch -t "197001010000.16" /tmp/test.o
  Singularity> stat /tmp/test.o
    File: '/tmp/test.o'
    Size: 1256            Blocks: 8          IO Block: 4096   regular file
  Device: fe03h/65027d    Inode: 180093152   Links: 1
  Access: 1970-01-01 00:00:16.000000000 -0800
  Modify: 1970-01-01 00:00:16.000000000 -0800
  Change: 2022-12-14 17:28:25.501357159 -0800

As you can see, the modification time of the file was not set correctly. Looks like the container messed up the time zone? Instead of using UTC time zone, the container seemed to use the default time zone which is PST. Running the same command outside the container on the same host shows the correct result.

  >env TZ=UTC touch -t "197001010000.16" /tmp/test.o
  >stat /tmp/test.o
    File: '/tmp/test.o'
    Size: 1256            Blocks: 8          IO Block: 4096   regular file
  Device: fe03h/65027d    Inode: 180093152   Links: 1
  Access: 1969-12-31 16:00:16.000000000 -0800
  Modify: 1969-12-31 16:00:16.000000000 -0800
  Change: 2022-12-14 17:37:48.101538639 -0800

This looks like a bug of the singularity container since executing the same command on the same host outside the container produces correct results.

The workaround I found is to set the time zone to GMT instead of UTC. The container seems to honor TZ=GMT correctly.

  Singularity> env TZ=GMT touch -t "197001010000.16" /tmp/test.o
  Singularity> stat /tmp/test.o
    File: '/tmp/test.o'
    Size: 1256            Blocks: 8          IO Block: 4096   regular file
  Device: fe03h/65027d    Inode: 180093152   Links: 1
  Access: 1969-12-31 16:00:16.000000000 -0800
  Modify: 1969-12-31 16:00:16.000000000 -0800
  Change: 2022-12-14 17:46:03.521219660 -0800


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139980/new/

https://reviews.llvm.org/D139980



More information about the llvm-commits mailing list