-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/cgo: ${SRCDIR} doesn't properly handle paths with spaces #11868
Comments
Please, provide instructions to reproduce your issue. Thank you. Alex |
|
This is depend on behavior of escape arguments on unix-shell or cmd.exe. |
Thank you @mattn. This is how it works on linux too:
It appears we don't allow space inside of #cgo line parameters. I don't know why is that. Leaving for others to explain. Alex |
It's a bug. I don't know if changing safeCgoName in go/build/build.go is sufficient, or whether we need to add quoting somewhere. |
gcc doesn't allows |
Have there been any more thoughts on how this can be fixed? If someone could point me in the right direction, I'd be happy to try to fix it myself. |
@jtsylve Thanks--I would start with my suggestion above: look at safeCgoName in go/build/build.go. Fix that to accept spaces. Then make sure any necessary quoting is done. |
It is important that an attempted fix here does not allow spaces in other places. Changing safeCgoName sounds dangerous. It does seem reasonable that ${SRCDIR}'s expansion should be properly handled even when that variable contains spaces. |
The issue is more complicated than just changing |
CL https://golang.org/cl/16302 mentions this issue. |
Under which cases is |
Given a cgo directive like the following
//#cgo CFLAGS: -I${SRCDIR}/../../include
I get the following error
Neither of the following seem to make much of a difference
//#cgo CFLAGS: -I"${SRCDIR}/../../include"
//#cgo CFLAGS: -I\"${SRCDIR}/../../include\"
Tested on go1.5beta2 on both 32 and 64 bit Windows.
The text was updated successfully, but these errors were encountered: