• Didier Spezia's avatar
    go/build: fix cgo ${SRCDIR} substitution when that variable contains spaces · 8818cc88
    Didier Spezia authored
    When the source directory path contains spaces, cgo directives
    cannot be properly validated:
    
    $ pwd
    /root/src/issue 11868
    
    $ cat main.go
    package main
    //#cgo CFLAGS: -I${SRCDIR}/../../include
    import "C"
    func main() {
    }
    
    $ go build
    can't load package: package issue 11868: /root/src/issue 11868/main.go:
     malformed #cgo argument: -I/root/src/issue 11868/../../include
    
    Make sure spaces are tolerated in ${SRCDIR} when this variable
    is expanded. This applies to ${SRCDIR} only. Shell safety
    checks are still done in the same exact way for anything else.
    
    Fixes #11868
    
    Change-Id: I93d1d2b5ab167caa7ae353fe46fb8f69f1f06969
    Reviewed-on: https://go-review.googlesource.com/16302Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    8818cc88
Name
Last commit
Last update
..
ast Loading commit data...
build Loading commit data...
constant Loading commit data...
doc Loading commit data...
format Loading commit data...
importer Loading commit data...
internal Loading commit data...
parser Loading commit data...
printer Loading commit data...
scanner Loading commit data...
token Loading commit data...
types Loading commit data...