Closed
Description
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?
It reproduces with the latest version of x/term
(v0.0.0-20210503060354-a79de5458b56).
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/fooman/.cache/go-build" GOENV="/home/fooman/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="openbsd" GOINSECURE="" GOMODCACHE="/home/fooman/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="openbsd" GOPATH="/home/fooman/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="/home/fooman/tmp_1m/readpw_win/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-build3256633254=/tmp/go-build -gno-record-gcc-switches"
I'm cross compiling from OpenBSD for Windows.
What did you do?
I ran the following program on the Windows 10 operating system:
package main
import (
"fmt"
"golang.org/x/term"
"os"
)
func main() {
tty, err := os.Open("CON:")
if err != nil {
panic(err)
}
defer tty.Close()
pw, err := term.ReadPassword(int(tty.Fd()))
if err != nil {
panic(err)
}
fmt.Println(string(pw))
}
What did you expect to see?
I expected the program to prompt me for password input and to then print the entered password.
What did you see instead?
When running the program (either as normal user or as administator) I get this output:
panic: Access is denied.
goroutine 1 [running]:
main.main()
/home/fooman/tmp_1m/readpw_win/readpw_win.go:17 +0x197