Skip to content

Commit 9b72c61

Browse files
authored
Merge pull request #1496 from EliahKagan/touch
Have `touch` in test fixture fall back to portable format
2 parents 96d3470 + bbbd1eb commit 9b72c61

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env bash
22
set -eu -o pipefail
33

4-
# The largest-possible date for Ext4, nanos are special there, but ont usually on other filesystems
5-
touch -d "2446-05-10 22:38:55.111111111" future
6-
# The smallest-possible date for Ext4, nanos are special there, but ont usually on other filesystems
7-
touch -d "1901-12-13 20:45:52.222222222" past
4+
# Attempt to create files with the latest and earliest possible dates for ext4. Nanoseconds are
5+
# special there, but not usually on other filesystems. In some touch implementations, the format
6+
# may be rejected. So if a command fails, we try again with a more extreme date that is out of
7+
# range, because some implementations will clip it to the edge of the range (but they may fail).
8+
touch -d '2446-05-10 22:38:55.111111111' future || touch -d '2446-05-11 22:38:56' future
9+
touch -d '1901-12-13 20:45:52.222222222' past || touch -d '1901-12-13 20:45:52' past

0 commit comments

Comments
 (0)