Skip to content
  • Simon McVittie's avatar
    glocalfile: Never require G_LOCAL_FILE_STAT_FIELD_ATIME · 642baa50
    Simon McVittie authored
    Some filesystems don't have meaningful access times under at least some
    circumstances (see #2189, #2205). In this situation the traditional stat()
    and related kernel interfaces have to put something meaningless in the
    st_atime field, and have no way to signal that it is meaningless.
    
    However, statx() does have a way to signal that the atime is meaningless:
    if the filesystem doesn't provide a useful access time, it will unset
    the STATX_ATIME bit (as well as filling in the same meaningless value
    for the stx_atime field that stat() would have used, for compatibility).
    We don't actually *need* the atime, so never include it in the required
    mask. This was already done for one code path in commit 6fc143bb
    "gio: Allow no atime from statx" to fix #2189, but other callers were
    left unchanged in that commit, and receive the same change here.
    
    It is not actually guaranteed that *any* of the flags in the
    returned stx_mask will be set (the only guarantee is that items in
    STATX_BASIC_STATS have at least a harmless compatibility value, even if
    their corresponding flag is cleared), so it might be better to follow
    this up by removing the concept of the required mask entirely. However,
    as of Linux 5.8 it looks as though STATX_ATIME is the only flag in
    STATX_BASIC_STATS that might be cleared in practice, so this simpler
    change fixes the immediate regression.
    
    Resolves: #2205
    
    
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    642baa50