Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make touch logic in file_metadata.sh more portable #1648

Merged
merged 1 commit into from
Oct 29, 2024

Commits on Oct 24, 2024

  1. 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 GitoxideLabs#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.
    EliahKagan committed Oct 24, 2024
    Configuration menu
    Copy the full SHA
    c430897 View commit details
    Browse the repository at this point in the history