Bruno Haible via GNU coreutils General Discussion <coreutils@gnu.org>
writes:
> The test tests/stat/stat-nanoseconds fails on FreeBSD 14.0 and NetBSD 10.0.
>
> Here's the output on FreeBSD:
>
>
> FAIL: tests/stat/stat-nanoseconds
> =================================
>
> -rw-r--r-- 1 root wheel 0 1970-01-01 18:43:33.023456789 +0000 k
> FAIL tests/stat/stat-nanoseconds.sh (exit status: 1)
This one took me an annoyingly long time to investigate. I am tempted to
just remove it because I don't think the behavior is that important and
I can see a few places where it can go wrong.
The specific issue here is that FreeBSD (and probably NetBSD) use
attributes set to -1 to indicate that the vnode should not have it's
corresponding attribute updated. In this case we are calling futimens
with two "struct timespec" values identically defined to:
(struct timespec) { .tv_sec = -1, .tv_usec = 123456789 }
When FreeBSD goes to update the vnode, it sees tv_sec == -1 for both
timestamps and doesn't update them. So it is pretty much a useless call.
I suspect you also may run into issues with file systems using unsigned
integers from the epoch to represent time stamps. I don't have any
evidence of that yet, but it doesn't seem impossible. Perhaps a file
system expert can correct me.
Pádraig, any opinion on the attached patch vs. just removing this test?
I think I am 50/50 on it right now...
Collin