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

debug/dwarf: use of path.Join is wrong on Windows #19784

Closed
rsc opened this issue Mar 30, 2017 · 2 comments
Closed

debug/dwarf: use of path.Join is wrong on Windows #19784

rsc opened this issue Mar 30, 2017 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Mar 30, 2017

src/debug/dwarf/line.go's readFileEntry does:

if !path.IsAbs(name) {
	if dirIndex >= len(r.directories) {
		return false, DecodeError{"line", off, "directory index too large"}
	}
	name = path.Join(r.directories[dirIndex], name)
}

We can't use filepath, because we want the processing to be the same on all systems (Windows should be able to process Unix path names correctly, and vice versa). But path isn't right for Windows paths.

In the cmd/link/dwarf_test.go tests, this code runs with r.directories[dirIndex] being C:\workdir\go\src\cmd\link and name being C:/workdir/go/src/runtime/testdata/testprogcgo/main.go. path.IsAbs reports that the latter is not absolute, and then path.Join puts them together as

C:\workdir\go\src\cmd\link/C:/workdir/go/src/runtime/testdata/testprogcgo/main.go

which is unfortunate. Probably we need to have dwarf know that something beginning with [A-Z]:[/\\] is an absolute path.

For now I will change the DWARF test (checking that line number information is present at all) not to notice this problem, so that the more important fix can be cherry-picked cleanly into Go 1.8.1.

/cc @aclements

@rsc rsc added this to the Go1.9Maybe milestone Mar 30, 2017
@gopherbot
Copy link

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

@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label May 24, 2017
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators May 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants