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

os: Windows-style absolute paths are not recognized correctly in wasm environments #68820

Open
Zxilly opened this issue Aug 9, 2024 · 6 comments · May be fixed by #68255
Open

os: Windows-style absolute paths are not recognized correctly in wasm environments #68820

Zxilly opened this issue Aug 9, 2024 · 6 comments · May be fixed by #68255
Labels
arch-wasm WebAssembly issues FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done. OS-JS
Milestone

Comments

@Zxilly
Copy link
Contributor

Zxilly commented Aug 9, 2024

Go version

go version devel go1.24-c5430dc1d8 Wed Jul 24 01:01:48 2024 0000 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=on
set GOARCH=wasm
set GOBIN=
set GOCACHE=C:\Users\zxilly\AppData\Local\go-build
set GOENV=C:\Users\zxilly\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\zxilly\go\pkg\mod
set GONOPROXY=1
set GONOSUMDB=
set GOOS=js
set GOPATH=C:\Users\zxilly\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=E:/Temp/go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=E:\Temp\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.24-c5430dc1d8 Wed Jul 24 01:01:48 2024  0000
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\zxilly\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g  
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\zxilly\AppData\Local\Temp\go-build1954128060=/tmp/go-build -gno-record-gcc-switches

What did you do?

Assume a basic file open program located at E:\Temp\bug

package main

import (
	"fmt"
	"os"
)

func main() {
	filePath := "E:\Temp\bug\file.txt"

	file, err := os.Open(filePath)
	if err != nil {
		fmt.Printf("Failed to open file: %v\n", err)
		return
	}
	defer file.Close() 

	fmt.Println("File opened successfully!")
}

Compile to wasm and run it with node.js wrapper.

What did you see happen?

open E:\Temp\bug\E:\Temp\bug\file.txt: No such file or directory

What did you expect to see?

Open success.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/595797 mentions this issue: syscall,misc/wasm: fix path expansion on non-unix platforms

@seankhliao
Copy link
Member

related #43768
cc @golang/wasm

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. arch-wasm WebAssembly issues OS-JS labels Aug 9, 2024
@dmitshur dmitshur added this to the Go1.24 milestone Aug 9, 2024
@dmitshur dmitshur added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Aug 9, 2024
@Zxilly
Copy link
Contributor Author

Zxilly commented Aug 9, 2024

I'm wondering if this fix can't be introduced in 1.23? I don't know much about Go's release process.

@dmitshur
Copy link
Contributor

dmitshur commented Aug 9, 2024

Bugs are first fixed on the main branch, where development for the upcoming major release (Go 1.24) is happening. If appropriate, fixes may be backported to supported minor versions. See https://go.dev/s/release and https://go.dev/wiki/MinorReleases.

@Zxilly
Copy link
Contributor Author

Zxilly commented Aug 9, 2024

I hope this fix gets a backport, at least for 1.23. One of my applications requires complex relative position calculations in order to workaround this bug. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly issues FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done. OS-JS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants