os: new runtime.GOOS of "ios" breaks os.User*Dir functions on GoTip for Go1.16 #42878
Labels
FrozenDueToAge
mobile
Android, iOS, and x/mobile
NeedsFix
The path to resolution is known, but the work has not been done.
OS-Darwin
release-blocker
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No, it's only reproducible in TIP
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
An application that I maintain targets iOS, and I compiled it using the master branch of Go in order to get around the CFLAGS breakage that won't be fixed until the Go 1.15.6 release. It always crashed at startup when build with the master branch, and I saw this in the log:
The fact that this wasn't broken before, and that it ends with the incorrect path for the configuration directory led to to investigate where this path was coming from. It's emitted by
os.UserConfigDir
. After some digging, I realized that the logic in this and related OS functions do not handle the newruntime.GOOS
value ofios
.To reproduce, build any code targeting iOS and invoke those functions. You'll fall through to the XDG case instead of the expected
GOOS=darwin, GOARCH=arm64
ones.I believe this was introduced by the changes here.
What did you expect to see?
I expected to be returned the correct config directory path.
What did you see instead?
I got the XDG-style config path instead, which the iOS sandbox prohibits writing to.
I already have a fix for this, and I'll open a PR right after this issue to propose the tweak to fix it. It's really straightforward, I think.
The text was updated successfully, but these errors were encountered: