Skip to content

os: TestRootConsistencyStat/Lstat failures on XFS due to size of directories not being the same #80015

Description

@perrinjerome

Go version

go version go1.24.10 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/srv/slapgrid/slappart82/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/srv/slapgrid/slappart82/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build682903046=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/srv/slapgrid/slappart82/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/srv/slapgrid/slappart82/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/srv/slapgrid/slappart82/srv/runner/shared/golang1.24/8b98c5a01f12c3408c83115065009684/.build/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/srv/slapgrid/slappart82/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/srv/slapgrid/slappart82/srv/runner/shared/golang1.24/8b98c5a01f12c3408c83115065009684/.build/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.10'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

run bash all.bash to compile golang 1.24.10 using an XFS filesystem for /tmp.

test failed with:

--- FAIL: TestRootConsistencyStat (0.02s)
    --- FAIL: TestRootConsistencyStat/dir_slash_dot (0.00s)
        root_test.go:841: with root:    res=name:"." size:26 mode:drwxr-xr-x isdir:true
        root_test.go:842:               err=<nil>
        root_test.go:843: without root: res=name:"." size:18 mode:drwxr-xr-x isdir:true
        root_test.go:844:               err=<nil>
        root_test.go:845: want consistent results, got mismatch
    --- FAIL: TestRootConsistencyStat/dot_slash (0.00s)
    --- FAIL: TestRootConsistencyStat/symlink_slash_dot (0.00s)
    --- FAIL: TestRootConsistencyLstat/dir_slash_dot (0.00s)
    --- FAIL: TestRootConsistencyLstat/dot_slash (0.00s)
    --- FAIL: TestRootConsistencyLstat/symlink_slash_dot (0.00s)

If I understand correctly, this test checks that two different directories have the same size, but on XFS the size of a directory depends on the inode number, see this minimal reproduction, the size is either 18 or 26:

$ mkdir /tmp/a /tmp/b ; touch /tmp/a/file /tmp/b/file ;  stat  /tmp/a/. /tmp/b/.  ; rm -rf /tmp/a /tmp/b
  File: /tmp/a/.
  Size: 18              Blocks: 0          IO Block: 4096   directory
Device: fe02h/65026d    Inode: 2206925354  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (  915/slapuser82)   Gid: ( 1083/slapuser82)
Access: 2026-06-15 11:40:04.095537868 +0300
Modify: 2026-06-15 11:40:04.095537868 +0300
Change: 2026-06-15 11:40:04.095537868 +0300
 Birth: 2026-06-15 11:40:04.095537868 +0300
  File: /tmp/b/.
  Size: 26              Blocks: 0          IO Block: 4096   directory
Device: fe02h/65026d    Inode: 4373669975  Links: 2
Access: (0755/drwxr-xr-x)  Uid: (  915/slapuser82)   Gid: ( 1083/slapuser82)
Access: 2026-06-15 11:40:04.095537868 +0300
Modify: 2026-06-15 11:40:04.095537868 +0300
Change: 2026-06-15 11:40:04.095537868 +0300
 Birth: 2026-06-15 11:40:04.095537868 +0300

apparently the code is https://github.com/torvalds/linux/blob/36808d5e983985bbda87e01059cccc071fe3ec8d/fs/xfs/libxfs/xfs_da_format.h#L233-L237 but basically it seems that this test is making assumptions on the size of directories that are not true for all filesystems.

What did you see happen?

sometimes test fails when running all.bash

What did you expect to see?

test pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Linux

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions