From a6cf4989b6663da4ffbb7d4e4aa7bdc8357e94b9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 17 May 2023 12:51:26 +0100 Subject: [PATCH] local: fix crash with --metadata on Android Before this change we called statx which causes a SIGSYS: bad system call fault. After this we force Android to use fstatat Fixes #7006 --- backend/local/metadata_linux.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/local/metadata_linux.go b/backend/local/metadata_linux.go index 9d9c43355..47294adba 100644 --- a/backend/local/metadata_linux.go +++ b/backend/local/metadata_linux.go @@ -5,6 +5,7 @@ package local import ( "fmt" + "runtime" "sync" "time" @@ -23,7 +24,7 @@ func (o *Object) readMetadataFromFile(m *fs.Metadata) (err error) { // Check statx() is available as it was only introduced in kernel 4.11 // If not, fall back to fstatat() which was introduced in 2.6.16 which is guaranteed for all Go versions var stat unix.Statx_t - if unix.Statx(unix.AT_FDCWD, ".", 0, unix.STATX_ALL, &stat) != unix.ENOSYS { + if runtime.GOOS != "android" && unix.Statx(unix.AT_FDCWD, ".", 0, unix.STATX_ALL, &stat) != unix.ENOSYS { readMetadataFromFileFn = readMetadataFromFileStatx } else { readMetadataFromFileFn = readMetadataFromFileFstatat