From 40cd2074371ce28a84e2aade449ad984e003afca Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 00:34:25 +0000 Subject: [PATCH] Update module github.com/kevinburke/ssh_config to v1.4.0 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +- .../kevinburke/ssh_config/.gitattributes | 1 - .../kevinburke/ssh_config/AUTHORS.txt | 1 + .../kevinburke/ssh_config/CHANGELOG.md | 13 ++++++ .../github.com/kevinburke/ssh_config/Makefile | 12 ++--- .../kevinburke/ssh_config/README.md | 10 ++--- .../kevinburke/ssh_config/config.go | 45 +++++++++++++++++-- .../kevinburke/ssh_config/parser.go | 8 ++-- vendor/modules.txt | 4 +- 10 files changed, 73 insertions(+), 27 deletions(-) delete mode 100644 vendor/github.com/kevinburke/ssh_config/.gitattributes diff --git a/go.mod b/go.mod index b0d322c7ef..c159167cfa 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/hugelgupf/p9 v0.3.1-0.20250420164440-abc96d20b308 github.com/json-iterator/go v1.1.12 - github.com/kevinburke/ssh_config v1.2.0 + github.com/kevinburke/ssh_config v1.4.0 github.com/klauspost/pgzip v1.2.6 github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422 github.com/mattn/go-shellwords v1.0.12 diff --git a/go.sum b/go.sum index 6c44044e85..4ba66c82bf 100644 --- a/go.sum +++ b/go.sum @@ -246,8 +246,8 @@ github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtL github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= -github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kevinburke/ssh_config v1.4.0 h1:6xxtP5bZ2E4NF5tuQulISpTO2z8XbtH8cg1PWkxoFkQ= +github.com/kevinburke/ssh_config v1.4.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= diff --git a/vendor/github.com/kevinburke/ssh_config/.gitattributes b/vendor/github.com/kevinburke/ssh_config/.gitattributes deleted file mode 100644 index 44db581889..0000000000 --- a/vendor/github.com/kevinburke/ssh_config/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -testdata/dos-lines eol=crlf diff --git a/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt b/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt index 311aeb1b4f..157361b28a 100644 --- a/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt +++ b/vendor/github.com/kevinburke/ssh_config/AUTHORS.txt @@ -5,5 +5,6 @@ Kevin Burke Mark Nevill Scott Lessans Sergey Lukjanov +Simon Josefsson Wayne Ashley Berry santosh653 <70637961+santosh653@users.noreply.github.com> diff --git a/vendor/github.com/kevinburke/ssh_config/CHANGELOG.md b/vendor/github.com/kevinburke/ssh_config/CHANGELOG.md index d32a3f5106..ba84b51b61 100644 --- a/vendor/github.com/kevinburke/ssh_config/CHANGELOG.md +++ b/vendor/github.com/kevinburke/ssh_config/CHANGELOG.md @@ -1,5 +1,18 @@ # Changes +## Version 1.4 (released August 2025) + +- Remove .gitattributes file (which was used to test different line endings, and +caused issues in some build environments). + +## Version 1.3 (released February 2025) + +- Add go.mod file (although this project has no dependencies). + +- Various updates to CI and build environment + +- config: add UserSettings.ConfigFinder + ## Version 1.2 Previously, if a Host declaration or a value had trailing whitespace, that diff --git a/vendor/github.com/kevinburke/ssh_config/Makefile b/vendor/github.com/kevinburke/ssh_config/Makefile index df7ee728be..4ee41ab57a 100644 --- a/vendor/github.com/kevinburke/ssh_config/Makefile +++ b/vendor/github.com/kevinburke/ssh_config/Makefile @@ -1,19 +1,15 @@ BUMP_VERSION := $(GOPATH)/bin/bump_version -STATICCHECK := $(GOPATH)/bin/staticcheck WRITE_MAILMAP := $(GOPATH)/bin/write_mailmap -$(STATICCHECK): - go get honnef.co/go/tools/cmd/staticcheck - -lint: $(STATICCHECK) +lint: go vet ./... - $(STATICCHECK) + go run honnef.co/go/tools/cmd/staticcheck@latest ./... -test: lint +test: @# the timeout helps guard against infinite recursion go test -timeout=250ms ./... -race-test: lint +race-test: go test -timeout=500ms -race ./... $(BUMP_VERSION): diff --git a/vendor/github.com/kevinburke/ssh_config/README.md b/vendor/github.com/kevinburke/ssh_config/README.md index f14b2168f7..705605e2fd 100644 --- a/vendor/github.com/kevinburke/ssh_config/README.md +++ b/vendor/github.com/kevinburke/ssh_config/README.md @@ -82,11 +82,11 @@ file format. [blog]: https://kev.inburke.com/kevin/more-comment-preserving-configuration-parsers/ [hostsfile]: https://github.com/kevinburke/hostsfile -## Donating +## Sponsorships -I don't get paid to maintain this project. Donations free up time to make -improvements to the library, and respond to bug reports. You can send donations -via Paypal's "Send Money" feature to kev@inburke.com. Donations are not tax -deductible in the USA. +Thank you very much to Tailscale and Indeed for sponsoring development of this +library. [Sponsors][sponsors] will get their names featured in the README. You can also reach out about a consulting engagement: https://burke.services + +[sponsors]: https://github.com/sponsors/kevinburke diff --git a/vendor/github.com/kevinburke/ssh_config/config.go b/vendor/github.com/kevinburke/ssh_config/config.go index 00d815c1a9..bb7315a3a8 100644 --- a/vendor/github.com/kevinburke/ssh_config/config.go +++ b/vendor/github.com/kevinburke/ssh_config/config.go @@ -8,7 +8,7 @@ // the host name to match on ("example.com"), and the second argument is the key // you want to retrieve ("Port"). The keywords are case insensitive. // -// port := ssh_config.Get("myhost", "Port") +// port := ssh_config.Get("myhost", "Port") // // You can also manipulate an SSH config file and then print it or write it back // to disk. @@ -43,7 +43,7 @@ import ( "sync" ) -const version = "1.2" +const version = "1.4.0" var _ = version @@ -53,6 +53,8 @@ type configFinder func() string // files are parsed and cached the first time Get() or GetStrict() is called. type UserSettings struct { IgnoreErrors bool + customConfig *Config + customConfigFinder configFinder systemConfig *Config systemConfigFinder configFinder userConfig *Config @@ -203,6 +205,13 @@ func (u *UserSettings) GetStrict(alias, key string) (string, error) { if u.onceErr != nil && u.IgnoreErrors == false { return "", u.onceErr } + // TODO this is getting repetitive + if u.customConfig != nil { + val, err := findVal(u.customConfig, alias, key) + if err != nil || val != "" { + return val, err + } + } val, err := findVal(u.userConfig, alias, key) if err != nil || val != "" { return val, err @@ -228,6 +237,12 @@ func (u *UserSettings) GetAllStrict(alias, key string) ([]string, error) { if u.onceErr != nil && u.IgnoreErrors == false { return nil, u.onceErr } + if u.customConfig != nil { + val, err := findAll(u.customConfig, alias, key) + if err != nil || val != nil { + return val, err + } + } val, err := findAll(u.userConfig, alias, key) if err != nil || val != nil { return val, err @@ -243,16 +258,38 @@ func (u *UserSettings) GetAllStrict(alias, key string) ([]string, error) { return []string{}, nil } +// ConfigFinder will invoke f to try to find a ssh config file in a custom +// location on disk, instead of in /etc/ssh or $HOME/.ssh. f should return the +// name of a file containing SSH configuration. +// +// ConfigFinder must be invoked before any calls to Get or GetStrict and panics +// if f is nil. Most users should not need to use this function. +func (u *UserSettings) ConfigFinder(f func() string) { + if f == nil { + panic("cannot call ConfigFinder with nil function") + } + u.customConfigFinder = f +} + func (u *UserSettings) doLoadConfigs() { u.loadConfigs.Do(func() { - // can't parse user file, that's ok. var filename string + var err error + if u.customConfigFinder != nil { + filename = u.customConfigFinder() + u.customConfig, err = parseFile(filename) + // IsNotExist should be returned because a user specified this + // function - not existing likely means they made an error + if err != nil { + u.onceErr = err + } + return + } if u.userConfigFinder == nil { filename = userConfigFinder() } else { filename = u.userConfigFinder() } - var err error u.userConfig, err = parseFile(filename) //lint:ignore S1002 I prefer it this way if err != nil && os.IsNotExist(err) == false { diff --git a/vendor/github.com/kevinburke/ssh_config/parser.go b/vendor/github.com/kevinburke/ssh_config/parser.go index 2b1e718cb3..fdd6ce9d8e 100644 --- a/vendor/github.com/kevinburke/ssh_config/parser.go +++ b/vendor/github.com/kevinburke/ssh_config/parser.go @@ -21,9 +21,9 @@ type sshParser struct { type sshParserStateFn func() sshParserStateFn // Formats and panics an error message based on a token -func (p *sshParser) raiseErrorf(tok *token, msg string, args ...interface{}) { +func (p *sshParser) raiseErrorf(tok *token, msg string) { // TODO this format is ugly - panic(tok.Position.String() + ": " + fmt.Sprintf(msg, args...)) + panic(tok.Position.String() + ": " + msg) } func (p *sshParser) raiseError(tok *token, err error) { @@ -118,7 +118,7 @@ func (p *sshParser) parseKV() sshParserStateFn { } pat, err := NewPattern(strPatterns[i]) if err != nil { - p.raiseErrorf(val, "Invalid host pattern: %v", err) + p.raiseErrorf(val, fmt.Sprintf("Invalid host pattern: %v", err)) return nil } patterns = append(patterns, pat) @@ -144,7 +144,7 @@ func (p *sshParser) parseKV() sshParserStateFn { return nil } if err != nil { - p.raiseErrorf(val, "Error parsing Include directive: %v", err) + p.raiseErrorf(val, fmt.Sprintf("Error parsing Include directive: %v", err)) return nil } lastHost.Nodes = append(lastHost.Nodes, inc) diff --git a/vendor/modules.txt b/vendor/modules.txt index 1099a7d8f3..a502639bfa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -594,8 +594,8 @@ github.com/jinzhu/copier # github.com/json-iterator/go v1.1.12 ## explicit; go 1.12 github.com/json-iterator/go -# github.com/kevinburke/ssh_config v1.2.0 -## explicit +# github.com/kevinburke/ssh_config v1.4.0 +## explicit; go 1.18 github.com/kevinburke/ssh_config # github.com/klauspost/compress v1.18.0 ## explicit; go 1.22