Skip to content

path/filepath: needless dot appear in filepath.Dir(\\server\share) #18783

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

Closed
mattn opened this issue Jan 25, 2017 · 4 comments
Closed

path/filepath: needless dot appear in filepath.Dir(\\server\share) #18783

mattn opened this issue Jan 25, 2017 · 4 comments
Milestone

Comments

@mattn
Copy link
Member

mattn commented Jan 25, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version devel +c1730ae Wed Jan 18 15:40:33 2017 +0000 windows/amd64

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

windows amd64

What did you do?

package main

import (
	"path/filepath"
)

func main() {
	println(filepath.Dir(`\\foo\bar\`))
	println(filepath.Dir(`\\foo\bar`))
}

What did you expect to see?

\\foo\bar\
\\foo\bar

What did you see instead?

\\foo\bar\
\\foo\bar.

Needless last dot.

@mattn mattn changed the title path/filepath path/filepath: needless dot appear in filepath.Dir(\\server\share) Jan 25, 2017
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/35690 mentions this issue.

@bradfitz bradfitz added this to the Go1.9 milestone Jan 25, 2017
@bradfitz
Copy link
Contributor

You didn't say whether this is a regression from Go 1.7, so I'm assuming this is for Go 1.9.

@mattn
Copy link
Member Author

mattn commented Jan 26, 2017

@bradfitz I'm sorry. I'm finding the last change of commit from blame, which commit break Dir. However, this may be early release before go1.9. Because this bug make hang when finding parent directory like below.

parent := ""
current, _ := path
for {
    parent = filepath.Dir(current)
    if parent == current {
        break
    }
   current = parent
}

For example, search .project file or .git from UNC.

@mattn
Copy link
Member Author

mattn commented Jan 26, 2017

It seems older than this commit. So It's not regression from Go 1.7 .

https://github.com/golang/go/commits/c007ce824d9a4fccb148f9204e04c23ed2984b71/src/os/path.go

@golang golang locked and limited conversation to collaborators Feb 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants