Bug 10403

Summary: [PATCH] configure --cflags breaks when CFLAGS contain commas
Product: [Yocto Project Subprojects] Pseudo Reporter: dominik
Component: pseudoAssignee: Mark Hatle <mark.hatle>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: joshuagloe, seebs, yp.pseudo.watcher, yp.watcher
Version: unspecified   
Target Milestone: 2.3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
configure: support using comma (,) in flags passed to --cflags none

Description dominik 2016-10-09 22:06:00 UTC
Created attachment 3464 [details]
configure: support using comma (,) in flags passed to --cflags

Preconditions/Environment
-------------------------
pseudo-1.8.1 on Fedora rawhide

Triggering Action/Cause
-----------------------
./configure --bits=64 --cflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --enable-memory-db --enable-xattr --enable-xattrdb --libdir=/usr/lib64/pseudo --prefix=/usr --without-rpath

Expectation
-----------
No errors.

Actual Result
-------------
SQLite header for version 3014002 found in /usr.
sed: -e expression #1, char 239: unknown option to `s'

Reproducibility
---------------
100%

That's because the sed expression at configure:321 uses commas as sed expression separator. The solution is to use another separator that doesn't occur in CFLAGS, like !, which is what is done for RPATH already. Proposed patch attached.
Comment 1 Joshua Lock 2016-10-13 14:48:57 UTC
Adding Seebs to CC.

Peter, Mark — do we prefer pseudo patches to the mailing list?
Comment 2 Seebs 2016-10-13 14:50:35 UTC
In general, yeah, but this one's probably fine. Of course the real problem is that ! can also occur in cflags. LOTS of things can occur in cflags. I think the workaround I usually use is to first run cflags through s/,/\\,/ or something. I'll poke it a bit.
Comment 3 Seebs 2016-10-13 16:06:48 UTC
Added fix in upstream. One-line configure change:

+arch_flags=$(echo "$arch_flags" | sed -e 's/,/\\,/g')
Comment 4 Seebs 2016-10-13 16:14:12 UTC
Fixed in upstream. Doesn't seem to affect yocto. (Fix is only in master, but it'll be included in next bugfix/point release.)