-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
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