From cd6c7375d49edd52de557b0ec1cc5f37889ecaae Mon Sep 17 00:00:00 2001 From: Jani Monoses Date: Fri, 4 Nov 2011 15:07:34 -0400 Subject: [PATCH] goinstall: allow packages from launchpad.net/~user branches. The permitted filename characters should include ~ to allow the names of user-owned branches in Launchpad. R=golang-dev, rsc, n13m3y3r, gustavo CC=golang-dev, gustavo.niemeyer https://golang.org/cl/5280052 --- src/cmd/goinstall/make.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/goinstall/make.go b/src/cmd/goinstall/make.go index c724cda47be..7445c9c2073 100644 --- a/src/cmd/goinstall/make.go +++ b/src/cmd/goinstall/make.go @@ -109,7 +109,7 @@ func makeMakefile(dir, pkg string, tree *build.Tree, isCmd bool) ([]byte, error) return buf.Bytes(), nil } -var safeBytes = []byte("+-./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz") +var safeBytes = []byte("+-~./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz") func safeName(s string) bool { if s == "" { @@ -118,6 +118,9 @@ func safeName(s string) bool { if strings.Contains(s, "..") { return false } + if s[0] == '~' { + return false + } for i := 0; i < len(s); i++ { if c := s[i]; c < 0x80 && bytes.IndexByte(safeBytes, c) < 0 { return false