After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778971 - g-ir-scanner splits CFLAGS/CPPFLAGS/LDFLAGS incorrectly
g-ir-scanner splits CFLAGS/CPPFLAGS/LDFLAGS incorrectly
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
2.43.x
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-02-20 17:47 UTC by Nirbheek Chauhan
Modified: 2017-03-21 09:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use shlex.split() for env variable splitting (2.49 KB, patch)
2017-02-20 17:47 UTC, Nirbheek Chauhan
committed Details | Review

Description Nirbheek Chauhan 2017-02-20 17:47:12 UTC
Created attachment 346279 [details] [review]
Use shlex.split() for env variable splitting

str.split() does not handle quoting, so if you have spaces in your CFLAGS, it will be split incorrectly. For instance:


    CFLAGS="'-I/opt/some dir' -DFOO=bar"

    >>> os.environ['CFLAGS'].split()
    ["'-I/opt/some", "dir'", '-DFOO=bar']
    >>> shlex.split(os.environ['CFLAGS'])
    ['-I/opt/some dir', '-DFOO=bar']

The attached patch fixes this.
Comment 1 Emmanuele Bassi (:ebassi) 2017-02-20 17:50:00 UTC
Review of attachment 346279 [details] [review]:

Thanks; it's indeed correct.