I dunno. Apparently (reading that issue closer) Go registers signal handlers with
SA_RESTART set, which means system calls should be automatically restarted when interrupted. However
man sigaction doesn’t mention
lstat being among the restarted system calls, which for example
stat is. So this is probably an Android bug, having syscalls return errors they normally shouldn’t because it does weird magic underneath those syscalls.
The “solution” is probably for us to retry the call a few times if the returned error code is EINTR. It ought to only be needed for
os.Lstat so it’s not really a heavy burden, even if it’s annoying.
(This was less of an issue before, because we required
Lstat() to return an error that return true for
IsNotExist(), so we didn’t interpret the “interrupted system call” return as a delete. We changed this because other error returns can also indicate a delete, i.e. “not a directory” can be returned for the previous children of a directory that has been replaced with a file.)