You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make touch logic in file_metadata.sh more portable
1. Set `TZ=UTC`. This is for accuracy even more than portability;
it is worthwhile on its own. The effect is not implied by any of
the environment variables we set when running fixtures, and it
has not been included in the date strings, though that could be
done. Doing it this way, rather than by adding something to the
date strings, makes it slightly easier to verify portability by
examination. Without `TZ=UTC` or specifying the time zone in the
date string, an unspecified time zone may be used; this may be
the local time zone, but even if so, that will be incorrect
since Unix timestamps stored in filesystem metadata are
implicitly assumed UTC, so the extreme values we hard-code must
be interpreted that way to have their intended effects.
2. Stop attempting to specify fractions of a second, which often
(always?) does not work better and which requires more complex
logic to express because a fallback is needed for some systems.
The test currently using this fixture does not appear to need or
significantly benefit from the most extreme possible dates, even
if fractional values facilitate that, and the output of `stat`
implementations that show fractional values do not seem to ever
show different values when they are used with `touch`.
3. Having made what was the fallback logic (introduced in #1496)
the primary approach, add a fallback touch command for `future`
to handle how some systems with 32-bit `time_t` remain in use
and have `touch` commands that treat too-large values as hard
errors. The test systems where this was produced are a 32-bit
x86 Ubuntu 18.04 LTS (Extended Security Maintenance) and a
64-bit x86 OmniOS system (where even the 64-bit GNU `touch`
binary fails with an error if the fallback is not used).
See the rewritten comment for details.
0 commit comments