-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os: there is no procfs on OpenBSD #19453
Comments
Ok, in my case it seems its not coming from go core, but from https://github.com/kardianos/osext/blob/master/osext_procfs.go Which also had nearly the same code as in go core:
But this was removed with this commit: Maybe go core should do the same thing? |
And with this commit it uses the core executable(). So an update of osext won't fix this if you want to use go 1.8: |
/cc @mdempsky |
The report is correct: there's no procfs on OpenBSD. But unfortunately, there's also no alternative kernel API for implementing os.Executable. (This has a long contentious history within OpenBSD.) So at best we can emit a better "not implemented" error instead of complaining that /proc doesn't exist. Or we can try looking for os.Argv[0] in $PATH, and hope it's right. (I believe this is what apps ported to OpenBSD usually do when trying to port this functionality.) |
CC @minux |
As mentioned kardianos/osext has an workaround for this problem from an OpenBSD Developer: kardianos/osext@b4814f4 Maybe this can be included in go core? CC @ajacoutot |
What I implemented in osext is not a workaround per se; as mentioned it's a "best effort" :-) |
@ianlancetaylor will copy the gccgo AIX code for argv[0] into std for openbsd. And then enable the test: func TestExecutable(t *testing.T) {
testenv.MustHaveExec(t) // will also execlude nacl, which doesn't support Executable anyway
ep, err := os.Executable()
if err != nil {
switch goos := runtime.GOOS; goos {
case "openbsd": // procfs is not mounted by default
t.Skipf("Executable failed on %s: %v, expected", goos, err)
} We have OpenBSD trybots. |
CL https://golang.org/cl/46004 mentions this issue. |
On OpenBSD, Executable relies on Args[0]. Removing the forgery on that OS allows the rest of the test to run. See #19453 Change-Id: Idf99f86894de5c702893791bc3684f8665f4019d Reviewed-on: https://go-review.googlesource.com/46398 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
It seems that someone else finally caught onto the fact that the OpenBSD mechanism was broken in the os package's implementation: kardianos/osext#22 golang/go#19453 A fix will be available in Go 1.9, and in the mean time the osext package has been updated to use its old method. Once 1.9 rolls out, we'll get rid of the osext dependency.
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
Compiled and started gitlab-ci-multi-runner on openbsd/amd64.
On startup I see this Warning:
Apparently go tries to Readlink /proc/curproc/file in https://github.com/golang/go/blob/master/src/os/executable_procfs.go#L26
But there is no (optional) procfs on OpenBSD anymore. mount_procfs(8) was shipped last time with OpenBSD 5.5:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/mount_procfs/
The text was updated successfully, but these errors were encountered: