Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: xcaddy run on windows with go 1.19 #117

Merged
merged 1 commit into from
Sep 12, 2022
Merged

fix: xcaddy run on windows with go 1.19 #117

merged 1 commit into from
Sep 12, 2022

Conversation

ydylla
Copy link
Contributor

@ydylla ydylla commented Sep 11, 2022

Hi @mholt,
you were right #116 is a windows specific problem. I found this more detailed issue golang/go#43724 were the reasons for the change are described.

To recap how we got here, the fundamental problem is that lots of Go programs do things like exec.Command("prog") and expect that prog will come from a system directory listed in the PATH. It is a surprise and in some cases a security problem that on Windows prog will be taken from dot instead when prog.exe (or prog.bat, prog.com, ...) exists.

Because there is a special case in getCaddyOutputFile for windows xcaddy does exactly that, but it really wants to use the binary from the current directory.

Programs that want to require the current directory to be used (ignoring PATH) can change "prog" to "./prog" (that works on both Unix and Windows systems). This change ("prog" to "./prog") is compatible with older versions of os/exec.

For me run and build also works without the windows special case, but #33 explicitly added the .exe ending so I kept it.

Closes #116

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging into this one and figuring it out! LGTM.

@mholt mholt merged commit 25c412f into caddyserver:master Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xcaddy run with go 19 does not work
2 participants