• Anton Gyllenberg's avatar
    cmd/go: prevent infinite loop in QueryPackage() · 54f5a667
    Anton Gyllenberg authored
    p = path.Dir(p) converges to either "." or "/". The current
    implementation of modload.QueryPackage() has a loop that
    terminates only on ".", not "/". This leads to the go command
    hanging in an infinite loop if the user manages to supply
    a file path starting with "/" as package path.
    
    An example of the issue is if the user (incorrectly) attempts
    to use an absolute directory path in an import statement within
    a module (import "/home/bob/myproj") and then runs go list.
    
    Fixes #27558
    
    Change-Id: Iaa6a4f7b05eba30609373636e50224ae2e7d6158
    GitHub-Last-Rev: 3a70d3a4277395c2dd8bb50f61b1ac3e44caee28
    GitHub-Pull-Request: golang/go#27976
    Reviewed-on: https://go-review.googlesource.com/c/139098
    Run-TryBot: Bryan C. Mills <bcmills@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBryan C. Mills <bcmills@google.com>
    54f5a667
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...