Skip to content

cmd/go: infinite loop when an import path starts with / #42891

Closed
@heschi

Description

@heschi

@leitzler reported an infinite loop in the go command when an import path starts with /. The stack trace implicates the loop that calls path.Dir in cmd/go/internal/modload.keepSums, which terminates on .. That assumes that the import path is "relative". If the path happens to start with a slash, the path is "absolute" and the fixed point for path.Dir is /, not ., and the loop is infinite.

cc @jayconrod, who added this code in https://golang.org/cl/262781. FWIW, when I wrote a version of this somewhere I did it such that it terminated when path.Dir(s) == s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions