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: TestChdirAndGetwd doesn't restore initial working directory on GOOS=js GOARCH=wasm #37448

Closed
odeke-em opened this issue Feb 25, 2020 · 2 comments
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Soon This needs action soon. (recent regressions, service outages, unusual time-sensitive situations)
Milestone

Comments

@odeke-em
Copy link
Member

Coming here from a test failure that we noticed from @randall77's CL https://go-review.googlesource.com/c/go/+/219143, we got mysterious failures https://go-review.googlesource.com/c/go/+/219143/4#message-18f33eac583b2d9ebefb682fd3d154824e8e5b58 in which even with getting the current working directory totally failed after I had suggested:

Could we perhaps use the current working directory:

   wd, err := Getwd()
   if err != nil {
	t.Fatal(err)
   }
and then
   filepath.Join(wd, ...)

@neelance came in, in https://go-review.googlesource.com/c/go/+/219143/4#message-031f21fab344d60320d779d0ac6b523de9061b22 letting us know that TestChdirAndGetwd is broken on GOOS=js, GOARCH=wasm with

I found the reason: The test TestChdirAndGetwd is unable to restore the initial working directory. This is because fd.Chdir() does not work correctly if the path of fd is relative. This is because NodeJS does not support fchdir so it has to be emulated with chdir.

Here's a possible solution:

	if path[0] != '/' {
		cwd := jsProcess.Call("cwd").String()
		path = cwd + "/" + path
	}
	f := &jsFile{
		path:    path,
		entries: entries,
	}

which is unrelated to Keith's current CL.

I am filing this issue so that we can address that separately and not block Keith's CL.

@odeke-em odeke-em added Soon This needs action soon. (recent regressions, service outages, unusual time-sensitive situations) arch-wasm WebAssembly issues labels Feb 25, 2020
@odeke-em odeke-em added this to the Go1.15 milestone Feb 25, 2020
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 26, 2020
@cagedmantis
Copy link
Contributor

@odeke-em odeke-em added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 27, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/221717 mentions this issue: syscall: fix Fchdir on js/wasm

@golang golang locked and limited conversation to collaborators Mar 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Soon This needs action soon. (recent regressions, service outages, unusual time-sensitive situations)
Projects
None yet
Development

No branches or pull requests

4 participants