Skip to content

x/sys/unix: AT_REMOVEDIR not defined on OpenBSD #46342

@rudis

Description

@rudis

What version of Go are you using (go version)?

$ go version
go version go1.16.2 openbsd/amd64

Does this issue reproduce with the latest release?

Yes, also tested with 1.16.4 (cross-compiling to OpenBSD).

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="openbsd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="openbsd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/openbsd_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/root/a/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3757805810=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Program:

package main

import (
        "log"
        "golang.org/x/sys/unix"
)

func main() {
        log.Printf("%v", unix.AT_REMOVEDIR)
}

go.sum:

module a

go 1.16

require golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1

What did you expect to see?

The value of AT_REMOVEDIR.

What did you see instead?

# a
./x.go:9:19: undefined: unix.AT_REMOVEDIR

I noticed this when cross-compiling for OpenBSD but the above tests were run directly on OpenBSD.

The constant is present on the system:

$ grep -r AT_REMOVEDIR /usr/include 
/usr/include/fcntl.h:#define    AT_REMOVEDIR            0x08
/usr/include/sys/fcntl.h:#define        AT_REMOVEDIR            0x08

It's defined on other systems (e.g. FreeBSD, Linux, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions