Comment 1 for bug 1517611

Revision history for this message
Menno Finlay-Smits (menno.smits) wrote : Re: TestFilesystemInfo race condition in 1.25

It's a strange one because there's only a single goroutine involved, the test and related implementation code are quite straightforward, and the structs in question are copies (no pointers being passed around). It hard to see how the struct values could be changed in unexpected ways.

I've looked into it on stilson-09 (the ppc build slave) and have found some pretty weird behaviour. The "expected" struct is created here: https://github.com/juju/juju/blob/1.25/state/filesystem_test.go#L259, like this:

    filesystemAttachmentInfo := state.FilesystemAttachmentInfo{MountPoint: "/srv"}

There's a bool field called ReadOnly which isn't being explicitly specified.

If I add:

    fmt.Printf("%+v\n", filesystemAttachmentInfo)

on the next line it almost always emits {MountPoint: , ReadOnly: true}. WTF?!

If I change the line that creates the struct to:

    filesystemAttachmentInfo := state.FilesystemAttachmentInfo{MountPoint: "/srv", ReadOnly: false}

the Printf shows the expected field values and the test consistently passes.

The only explanation I can come up with is a compiler bug. I've sent the above to davecheney and mwhudson. Dave agrees it's probably a compiler bug but that it's unlikely that anyone will both fixing gccgo4.9 given that go1.5 now has the focus in terms of supporting ppc with Go. Waiting to see if Michael has any further comments.