From 836f941e1615c72f2d3033eab746973942d02226 Mon Sep 17 00:00:00 2001 From: CelestialCrafter Date: Fri, 22 Nov 2024 18:20:43 -0600 Subject: [PATCH 1/3] fix: handle completion info check error (#330) * fix: handle completion info check error fixes Rosettea/Hilbish#329 * make changelog more descriptive --- CHANGELOG.md | 4 ++++ complete.go | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adbf1210..fd848c52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # 🎀 Changelog +## Unreleased +### Fixed +- Skip over file and prevent panic if info cannot be retrieved during file completion (due to permission error or anything else) + ## [2.3.3] - 2024-11-04 ### Fixed - Heredocs having issues diff --git a/complete.go b/complete.go index 1c40b20c..86938cb3 100644 --- a/complete.go +++ b/complete.go @@ -157,9 +157,12 @@ func matchPath(query string) ([]string, string) { files, _ := os.ReadDir(path) for _, entry := range files { - // should we handle errors here? file, err := entry.Info() - if err == nil && file.Mode() & os.ModeSymlink != 0 { + if err != nil { + continue + } + + if file.Mode() & os.ModeSymlink != 0 { path, err := filepath.EvalSymlinks(filepath.Join(path, file.Name())) if err == nil { file, err = os.Lstat(path) From 13e6d180f8044b8d2357bd5e17c0b0a3000fa58c Mon Sep 17 00:00:00 2001 From: sammyette Date: Sat, 28 Dec 2024 19:50:06 -0400 Subject: [PATCH 2/3] fix: use global env variables when executing --- exec.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/exec.go b/exec.go index 357c143f..7f8e37bf 100644 --- a/exec.go +++ b/exec.go @@ -434,26 +434,8 @@ func execHandle(bg bool) interp.ExecHandlerFunc { // sh/interp but with our job handling env := hc.Env - envList := make([]string, 0, 64) + envList := os.Environ() env.Each(func(name string, vr expand.Variable) bool { - if name == "PATH" { - pathEnv := os.Getenv("PATH") - envList = append(envList, "PATH="+pathEnv) - return true - } - - if !vr.IsSet() { - // If a variable is set globally but unset in the - // runner, we need to ensure it's not part of the final - // list. Seems like zeroing the element is enough. - // This is a linear search, but this scenario should be - // rare, and the number of variables shouldn't be large. - for i, kv := range envList { - if strings.HasPrefix(kv, name+"=") { - envList[i] = "" - } - } - } if vr.Exported && vr.Kind == expand.String { envList = append(envList, name+"="+vr.String()) } From 14a600f922f17570edff244d901a105e9385b6ba Mon Sep 17 00:00:00 2001 From: sammyette Date: Sat, 28 Dec 2024 19:56:17 -0400 Subject: [PATCH 3/3] chore: bump version related things --- CHANGELOG.md | 4 +++- vars.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd848c52..11851cf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # 🎀 Changelog -## Unreleased +## [2.3.4] - 2024-12-28 ### Fixed - Skip over file and prevent panic if info cannot be retrieved during file completion (due to permission error or anything else) +- Apply environment variables properly after 2.3 shell interpreter changes ## [2.3.3] - 2024-11-04 ### Fixed @@ -784,6 +785,7 @@ This input for example will prompt for more input to complete: First "stable" release of Hilbish. +[2.3.4]: https://github.com/Rosettea/Hilbish/compare/v2.3.3...v2.3.4 [2.3.3]: https://github.com/Rosettea/Hilbish/compare/v2.3.2...v2.3.3 [2.3.2]: https://github.com/Rosettea/Hilbish/compare/v2.3.1...v2.3.2 [2.3.1]: https://github.com/Rosettea/Hilbish/compare/v2.3.0...v2.3.1 diff --git a/vars.go b/vars.go index 55d71a79..c93e2b64 100644 --- a/vars.go +++ b/vars.go @@ -11,7 +11,7 @@ var ( // Version info var ( - ver = "v2.3.3" + ver = "v2.3.4" releaseName = "Alyssum" gitCommit string