Open
Description
#!stacks
"bug.Reportf" && "cache.port.matches:+5"
Issue created by stacks.
func (p port) matches(path string, content []byte) bool {
ctxt := build.Default // make a copy
ctxt.UseAllFiles = false
path = filepath.Clean(path)
if !filepath.IsAbs(path) {
bug.Reportf("non-abs file path %q", path) // <---------
return false // fail closed
...
This stack NaAAKw
was reported by telemetry:
gopls/bug
golang.org/x/tools/gopls/internal/util/bug.report:+35
golang.org/x/tools/gopls/internal/util/bug.Reportf:+1
golang.org/x/tools/gopls/internal/cache.port.matches:+5
golang.org/x/tools/gopls/internal/cache.matchingView[...]:+23
golang.org/x/tools/gopls/internal/cache.(*Session).viewOfLocked:+15
golang.org/x/tools/gopls/internal/cache.(*Session).DidModifyFiles:+138
golang.org/x/tools/gopls/internal/server.(*server).didModifyFiles:+36
golang.org/x/tools/gopls/internal/server.(*server).DidOpen:+20
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+253
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0
golang.org/x/tools/gopls@v0.17.0-pre.2 go1.23.2 windows/amd64 vscode (2)
Dups: HAiIaQ TeKpaQ odV-aw TO9VqA
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
gabyhelp commentedon Nov 27, 2024
Related Issues
master" for standalone file #69331 (closed)(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
adonovan commentedon Nov 27, 2024
This implies that session.DidModifyFiles was passed a list of modifications that include relative paths. This is most likely because DidOpen (among others) was passed a relative path that it should have either rejected or absolutized.
findleyr commentedon Nov 27, 2024
Agreed. The bug is not that the client sent bad paths, but that they weren't rejected earlier.
I feel like there's a whole category of bad inputs that gopls could do a better job of catching and handling. In this case, there's no good way to reject a bad notification, so gopls needs raise a message or diagnostic (or both) alerting the user that their client is misbehaving.
adonovan commentedon Jan 6, 2025
This stack
HAiIaQ
was reported by telemetry:gopls/bug
golang.org/x/tools/gopls/internal/util/bug.report:+35
golang.org/x/tools/gopls/internal/util/bug.Reportf:+1
golang.org/x/tools/gopls/internal/cache.port.matches:+5
golang.org/x/tools/gopls/internal/cache.matchingView[...]:+23
golang.org/x/tools/gopls/internal/cache.(*Session).viewOfLocked:+15
golang.org/x/tools/gopls/internal/cache.(*Session).SnapshotOf:+3
golang.org/x/tools/gopls/internal/server.(*server).fileOf:+1
golang.org/x/tools/gopls/internal/server.(*server).DocumentSymbol:+4
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+302
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0
adonovan commentedon Jan 20, 2025
This stack
TeKpaQ
was reported by telemetry:gopls/bug
golang.org/x/tools/gopls/internal/util/bug.report:+35
golang.org/x/tools/gopls/internal/util/bug.Reportf:+1
golang.org/x/tools/gopls/internal/cache.port.matches:+5
golang.org/x/tools/gopls/internal/cache.matchingView[...]:+23
golang.org/x/tools/gopls/internal/cache.selectViewDefs:+59
golang.org/x/tools/gopls/internal/cache.(*Session).DidModifyFiles:+93
golang.org/x/tools/gopls/internal/server.(*server).didModifyFiles:+36
golang.org/x/tools/gopls/internal/server.(*server).DidOpen:+20
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+253
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0
adonovan commentedon Feb 18, 2025
This stack
odV-aw
was reported by telemetry:gopls/bug
golang.org/x/tools/gopls/internal/util/bug.report:+35
golang.org/x/tools/gopls/internal/util/bug.Reportf:+1
golang.org/x/tools/gopls/internal/cache.port.matches:+5
golang.org/x/tools/gopls/internal/cache.matchingView[...]:+23
golang.org/x/tools/gopls/internal/cache.(*Session).viewOfLocked:+15
golang.org/x/tools/gopls/internal/cache.(*Session).DidModifyFiles:+141
golang.org/x/tools/gopls/internal/server.(*server).didModifyFiles:+36
golang.org/x/tools/gopls/internal/server.(*server).DidOpen:+20
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+253
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0
adonovan commentedon May 15, 2025
This stack
TO9VqA
was reported by telemetry:gopls/bug
golang.org/x/tools/gopls/internal/util/bug.report:+35
golang.org/x/tools/gopls/internal/util/bug.Reportf:+1
golang.org/x/tools/gopls/internal/cache.port.matches:+5
golang.org/x/tools/gopls/internal/cache.matchingView[...]:+23
golang.org/x/tools/gopls/internal/cache.selectViewDefs:+59
golang.org/x/tools/gopls/internal/cache.(*Session).DidModifyFiles:+96
golang.org/x/tools/gopls/internal/server.(*server).didModifyFiles:+36
golang.org/x/tools/gopls/internal/server.(*server).DidOpen:+20
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+253
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0