]> Cypherpunks repositories - gostls13.git/commit
syscall: fix Fchdir on js/wasm
authorRichard Musiol <mail@richard-musiol.de>
Sun, 1 Mar 2020 16:01:58 +0000 (17:01 +0100)
committerRichard Musiol <neelance@gmail.com>
Sun, 1 Mar 2020 21:02:40 +0000 (21:02 +0000)
commite44cda3aa97ba0870806e65fc66641eb2cf6682a
tree2dcb7c82cd2e46c5df8b88a06c530f2cfa94e1cd
parent7913f7dfcf2c281b99c6ddd278aa851de47ada9d
syscall: fix Fchdir on js/wasm

NodeJS does not support fchdir so it has to be emulated with chdir by
saving the path when opening a directory.

However, if the path opened is relative, saving this path is not
sufficient, because after changing the working directory the path
does not resolve correctly any more, thus a subsequent fd.Chdir() fails.

This change fixes the issue by resolving a relative path when
opening the directory and saving the absolute path instead.

Fixes #37448

Change-Id: Id6bc8c4232b0019fc11e850599a526336608ce54
Reviewed-on: https://go-review.googlesource.com/c/go/+/221717
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
src/os/os_test.go
src/syscall/fs_js.go