Skip to content
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

solve the undefined: unix.Dup2 compile error on mips64le #680

Merged
merged 1 commit into from
Jun 9, 2020

Conversation

XiaodongLoong
Copy link
Contributor

error in detail:
../internal/remote/output_interceptor_unix.go:41:2: undefined: unix.Dup2
../internal/remote/output_interceptor_unix.go:42:2: undefined: unix.Dup2

there is Dup2 syscall only on amd64, other arch is Dup3 instead.

Signed-off-by: Xiaodong Liu liuxiaodong@loongson.cn

error in detail:
go build
../internal/remote/output_interceptor_unix.go:41:2: undefined: unix.Dup2
../internal/remote/output_interceptor_unix.go:42:2: undefined: unix.Dup2
there is Dup2 syscall on linux/amd64, linux/mips64le is Dup3 instead.

Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
@XiaodongLoong
Copy link
Contributor Author

Search under ther golang.org/x/sys/unix package, I found only Linux OS with some CPU architectures support the Dup3 syscall including mips64le.

[root@localhost unix]# grep -rn "Dup3" .
./syscall_linux.go:871://sys	Dup3(oldfd int, newfd int, flags int) (err error)
./syscall_linux_arm64.go:155:	return Dup3(oldfd, newfd, 0)
./zsyscall_linux_386.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_mips64le.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_ppc64.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_mips64.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_arm64.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_s390x.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_amd64.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_ppc64le.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {
./zsyscall_linux_arm.go:331:func Dup3(oldfd int, newfd int, flags int) (err error) {

"arm" "arm64" "386" "s390" "amd64" "ppc64x" support Dup2 syscall on Linux

grep -rn "Dup2" . |grep linux
./syscall_linux_arm.go:86://sys	Dup2(oldfd int, newfd int) (err error)
./syscall_linux_arm64.go:154:func Dup2(oldfd int, newfd int) (err error) {
./zsyscall_linux_386.go:1212:func Dup2(oldfd int, newfd int) (err error) {
./zsyscall_linux_ppc64.go:1209:func Dup2(oldfd int, newfd int) (err error) {
./syscall_linux_386.go:62://sys	Dup2(oldfd int, newfd int) (err error)
./zsyscall_linux_s390x.go:1192:func Dup2(oldfd int, newfd int) (err error) {
./syscall_linux_s390x.go:13://sys	Dup2(oldfd int, newfd int) (err error)
./zsyscall_linux_amd64.go:1192:func Dup2(oldfd int, newfd int) (err error) {
./syscall_linux_ppc64x.go:11://sys	Dup2(oldfd int, newfd int) (err error)
./syscall_linux_amd64.go:11://sys	Dup2(oldfd int, newfd int) (err error)
./zsyscall_linux_ppc64le.go:1209:func Dup2(oldfd int, newfd int) (err error) {
./zsyscall_linux_arm.go:1381:func Dup2(oldfd int, newfd int) (err error) {

other OS can not support Dup3 syscall, but support Dup2 syscall on a few CPU architectures.

@XiaodongLoong
Copy link
Contributor Author

@onsi PTAL, Thanks!

@onsi onsi merged commit 0624f75 into onsi:master Jun 9, 2020
tklauser added a commit to tklauser/ginkgo that referenced this pull request Jan 12, 2021
The latest version of the golang.org/x/sys/unix package already
implements func Dup2 using Dup3 on platforms which dont have the dup2
syscall. Use Dup2 and let x/sys/unix figure out the correct syscall.

This effectivly reverts PR onsi#680. Verified that ginkgo still correctly
builds on linux/mips64le.
tklauser added a commit to tklauser/ginkgo that referenced this pull request Jan 13, 2021
The latest version of the golang.org/x/sys/unix package already
implements func Dup2 using Dup3 on platforms which dont have the dup2
syscall. Use Dup2 and let x/sys/unix figure out the correct syscall.

This effectivly reverts PR onsi#680. Verified that ginkgo still correctly
builds on linux/mips64le.
onsi pushed a commit that referenced this pull request Jan 19, 2021
…#761)

The latest version of the golang.org/x/sys/unix package already
implements func Dup2 using Dup3 on platforms which dont have the dup2
syscall. Use Dup2 and let x/sys/unix figure out the correct syscall.

This effectivly reverts PR #680. Verified that ginkgo still correctly
builds on linux/mips64le.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants