Repository navigation
cmd/syncthing: Use os.executable in monitor, only fallback to PATH - #8502
Conversation
|
Not sure of the current state, but the compiled binary fails to run at all. |
| // name (like e.g. "syncthing") | ||
| if !strings.ContainsRune(args0, os.PathSeparator) { | ||
| // Check if it's in PATH | ||
| e = "." + string(os.PathSeparator) + args0 |
There was a problem hiding this comment.
I still think we should skip this entire thing, os.Executable() + exec.LookPath() should cover the reasonable scenarios imho. At least I don't see the scenario where it would be required or useful to also look separately in pwd, so despite not seeing how this would cause a problem by itself I don't think we should do it...
There was a problem hiding this comment.
Ok, done. My thinking was that os.Executable should anyway work all the time, but we want to try everything we can to get an executable. I guess we could even get rid of the LookupPath and just do os.Executable and fail if it returns an error?
|
@tomasz1986 there was a merge error or something which I fixed |
calmh
left a comment
There was a problem hiding this comment.
This looks reasonable to me; I've done zero testing of it. :)
|
It seems to run fine on Windows 👍. |
* main: cmd/syncthing: Use os.executable in monitor, only fallback to PATH (syncthing#8502) all: Modernize error wrapping (syncthing#8491) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Work around binary in current dir restriction (fixes syncthing#8499) (syncthing#8500) lib/fs: Cache user lookups (syncthing#8496) all: Make scanning ownership opt-in (syncthing#8497)
* main: (256 commits) cmd/syncthing: Use os.executable in monitor, only fallback to PATH (syncthing#8502) all: Modernize error wrapping (syncthing#8491) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Work around binary in current dir restriction (fixes syncthing#8499) (syncthing#8500) lib/fs: Cache user lookups (syncthing#8496) all: Make scanning ownership opt-in (syncthing#8497) lib/model: Skip paused folders in aggregated completion loop (fixes syncthing#8219) (syncthing#8220) gui: Remove unused strings from translations (syncthing#8288) gui, api: Show internal config and state paths (fixes syncthing#8323) (syncthing#8324) build(deps): bump github.com/go-ldap/ldap/v3 from 3.4.1 to 3.4.4 (syncthing#8475) build: bump actions/setup-go from 2.2.0 to 3.2.1 (syncthing#8492) build: Let dependabot suggest updates to GitHub actions (syncthing#8490) update: Go version in update-docs-translations action (syncthing#8489) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Refactor CLI code to allow passing CLI arguments via function parameter (syncthing#8485) build: Update quic-go for Go 1.19 (syncthing#8483) lib/ur: Properly initialize map in failure data (fixes syncthing#8479) (syncthing#8480) lib/ur: Properly initialize map in failure data (fixes syncthing#8479) gui, man, authors: Update docs, translations, and contributors docs: Clarify docker network mode limitations (syncthing#8472) ...
Use
os.Executableregardless of OS and only fall back to PATH lookups if that fails (not sure why it ever would).Followup for #8500 to be delayed until the next release as it's a behaviour change that warrants a full RC phase of testing (thus draft).