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: MkdirAll error has junk characters on Plan 9 #24921

Closed
petter9 opened this issue Apr 18, 2018 · 4 comments
Closed

os: MkdirAll error has junk characters on Plan 9 #24921

petter9 opened this issue Apr 18, 2018 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Plan9
Milestone

Comments

@petter9
Copy link

petter9 commented Apr 18, 2018

What version of Go are you using (go version)?

go version go1.10.1 plan9/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/p/lib/cache/go-build'
GOEXE=''
GOHOSTARCH='amd64'
GOHOSTOS='plan9'
GOOS='plan9'
GOPATH='/usr/p/go'
GORACE=''
GOROOT='/sys/go/1.10.1'
GOTMPDIR=''
GOTOOLDIR='/sys/go/1.10.1/pkg/tool/plan9_amd64'
GCCGO='gccgo'
CC='6c'
CXX='g++'
CGO_ENABLED='0'
CGO_CFLAGS='-g -O2'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-g -O2'
CGO_FFLAGS='-g -O2'
CGO_LDFLAGS='-g -O2'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build510394034=/tmp/go-build -gno-record-gcc-switches'

What did you do?

package main

import (
        "fmt"
        "os"
)

func main() {
        fmt.Printf("%s\n", os.MkdirAll("foo/bar/baz", 0000))
        fmt.Printf("%s\n", os.MkdirAll("foo/bar/baz", 0000))
        fmt.Printf("%s\n", os.MkdirAll("foo/bar/baz", 0000))
        fmt.Printf("%s\n", os.MkdirAll("foo/bar/baz", 0000))
        fmt.Printf("%s\n", os.MkdirAll("foo/bar/baz", 0000))
}

What did you expect to see?

mkdir foo/bar: 'foo/bar' does not exist
mkdir foo/bar: 'foo/bar' does not exist
mkdir foo/bar: 'foo/bar' does not exist
mkdir foo/bar: 'foo/bar' does not exist
mkdir foo/bar: 'foo/bar' does not exist

What did you see instead?

mkdir foo/bar: 'foo/bar' does not exist existst
mkdir foo/bar: 'foo/bar' does not existes not ex
mkdir foo/bar: 'foo/bar' does not existon denied
mkdir foo/bar: 'foo/bar' does not existon denied
mkdir foo/bar: 'foo/bar' does not existon denied

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 18, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Apr 18, 2018
@ianlancetaylor
Copy link
Contributor

CC @0intro

@0intro 0intro self-assigned this Apr 18, 2018
@0intro
Copy link
Member

0intro commented Apr 18, 2018

Thanks for reporting. I think this is related to issue #24767

@millerresearch
Copy link
Contributor

In fact this is another case of issue #13770, where all syscall error strings in Plan 9 are aliased to the same underlying byte array. The symptom in MkdirAll occurs when a Mkdir syscall fails, followed by an Lstat which fails and overwrites the Mkdir error string before it's used.
A local workaround would be to save a copy of the first error string. But really we should get rid of the aliasing behaviour, which is contrary to Go string semantics, by reworking this revision which introduced it.
I had a tentative correction a while ago, but I wasn't entirely happy with it. I'll make another attempt now.

@gopherbot
Copy link

Change https://golang.org/cl/111195 mentions this issue: syscall: eliminate aliasing of syscall error strings in Plan 9

@golang golang locked and limited conversation to collaborators May 8, 2019
@rsc rsc unassigned 0intro Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Plan9
Projects
None yet
Development

No branches or pull requests

5 participants