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
cmd/go: can't handle relative TMPDIR #23264
Comments
I'm not sure this is something we want to worry about supporting. It seems simple enough to not do that. Do most Unix tools support a relative |
I think if this is not supported, we should at least provide a more useful error message (the current error message is something along the lines of |
This sounds like a good idea, if $TMPDIR doesn't fit through
https://godoc.org/path/filepath#IsAbs the go tool (or compiler, or both?)
should quit early with a reasonable error.
…On Thu, Dec 28, 2017 at 11:22 AM, Axel Wagner ***@***.***> wrote:
I think if this is not supported, we should at least provide a more useful
error message (the current error message is something along the lines of could
not create $WORK/src/a/a.a: No such file or directory which took us a
while to figure out).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#23264 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA-11VBTRNJgjqEBD5dMrWXSlaad0ks5tEt8ogaJpZM4RN5Up>
.
|
Change https://golang.org/cl/85596 mentions this issue: |
I started adding this, but it doesn't reproduce anymore on tip, presumably because of the build cache changes. Some go commands still fail, if TMPDIR does not exist, even if they shouldn't use it at all (like I think supporting a relative TMPDIR in the go tool would be as simple as erroring out: We can just call filepath.Abs on what os.TempDir returns to get an absolute path and use that. So I sent a CL to that effect. I tried some of the POSIX interfaces to create temporary files and they all seem to do the same thing as Go in that regard: Use it just like /tmp and return a relative path. Meaning Go is consistent here with POSIX and that any C tool with a similar case (calling chdir(1), potentially in a child process). We could also consider doing that in os.TempDir directly, eliminating this problem in all Go code, but I'm not sure it's actually always the right thing to do. |
Change https://golang.org/cl/91075 mentions this issue: |
Change https://golang.org/cl/103236 mentions this issue: |
Change https://golang.org/cl/123876 mentions this issue: |
Most programs seem to accept a relative temp dir, as weird as that might be. Also, the meaning of relative is a little more fluid on Windows: TMP=\temp is relative (to the current drive) but will work well enough. Also, Windows GetTempPath automatically converts a relative %TMP% into an absolute path, so we'd be imposing different behavior for GOTMPDIR vs TMP. It seems easier and more consistent to just impose the obvious meaning than to add an error we can only implement some of the time. Originally got here because "cmd/go:" should be"go:" in error message, but the error message is gone now. Fixes #23264. Change-Id: I3c3fb801cbd5e652364f1f62bb3881e9317e3581 Reviewed-on: https://go-review.googlesource.com/123876 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
It seems like go build is not able to handle non-absolute
TMPDIR
and fails to build instead.go version
go version go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
go build
(3) in script above succeed as well as (1) and (2)What did you see instead?
go build
(3) in script above failing.The text was updated successfully, but these errors were encountered: