Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 332669 - qt4 eclasses (qt4-build, qt4-r2, qt4): CC/CXX need quoting
Summary: qt4 eclasses (qt4-build, qt4-r2, qt4): CC/CXX need quoting
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-13 20:50 UTC by Harald van Dijk (RETIRED)
Modified: 2011-01-20 23:08 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
escape quotes in qt4-build.eclass (qt4-build_escape_quotes.patch,966 bytes, patch)
2010-09-07 16:08 UTC, Andrey
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Harald van Dijk (RETIRED) gentoo-dev 2010-08-13 20:50:35 UTC
qt4-build.eclass:
[...]
    # Bug 282984 && Bug 295530
    sed -e "s:\(^SYSTEM_VARIABLES\):CC=$(tc-getCC)\nCXX=$(tc-getCXX)\nCFLAGS=\"${CFLAGS}\"\nCXXFLAGS=\"${CXXFLAGS}\"\nLDFLAGS=\"${LDFLAGS}\"\n\1:" \
        -i configure || die "sed qmake compilers failed"
    # bug 321335
    if version_is_at_least 4.6; then
        find ./config.tests/unix -name "*.test" -type f -exec grep -lZ \$MAKE '{}' \; | \
            xargs -0 \
            sed -e "s:\(\$MAKE\):\1 CC=$(tc-getCC) CXX=$(tc-getCXX) LD=$(tc-getCXX) LINK=$(tc-getCXX):g" \
                -i || die "sed test compilers failed"
    fi
[...]

CC and CXX (and LD and LINK) need quoting in the same way that CFLAGS, CXXFLAGS and LDFLAGS are quoted. They too can contain whitespace.
Comment 1 Davide Pesavento (RETIRED) gentoo-dev 2010-08-13 22:05:22 UTC
I've seen tons of ebuilds without quotes around CC/CXX, does this mean they're all broken? BTW could you show an example of CC/CXX containing spaces please?
Comment 2 Harald van Dijk (RETIRED) gentoo-dev 2010-08-13 22:49:23 UTC
(In reply to comment #1)
> I've seen tons of ebuilds without quotes around CC/CXX, does this mean they're
> all broken?

Possibly, but not necessarily. There are cases where quoting CC/CXX would be redundant because the shell doesn't do word splitting anyway. There are also cases where quoting CC/CXX would be wrong because you want the shell to do word splitting, because you're trying to compile something.

> BTW could you show an example of CC/CXX containing spaces please?

CC="/usr/bin/x86_64-pc-linux-gnu-gcc -specs=/path/to/my/custom/specs/file"

But if you just want to test to see what fails and doesn't, you can just as easily use CC="/usr/bin/env gcc".

If you do try this, by the way, and notice something breaks, please don't file bug reports here if the wrong quoting is in the upstream package. I'm not going to do that either; those bugs can just go upstream. :)
Comment 3 Davide Pesavento (RETIRED) gentoo-dev 2010-08-13 23:24:28 UTC
(In reply to comment #2)

Thanks a lot for the explanation!
I suppose eqmake4 is broken in a similar way then... around line 252 of qt4-r2.eclass:
    QMAKE_CC=$(tc-getCC) \
    QMAKE_CXX=$(tc-getCXX) \
    QMAKE_LINK=$(tc-getCXX) \
Comment 4 Harald van Dijk (RETIRED) gentoo-dev 2010-08-13 23:43:00 UTC
Yes, thanks, those should be updated too, in both the qt4-r2 and qt4 eclasses.
Comment 5 Markos Chandras (RETIRED) gentoo-dev 2010-08-14 18:00:47 UTC
Fixed. I didn't fix qt4.eclass because it is deprecated anyway
Comment 6 Andrey 2010-09-07 16:04:30 UTC
(In reply to comment #5)
> Fixed. I didn't fix qt4.eclass because it is deprecated anyway

Looks like the fix [1] is incorrect for qt4-build.eclass.
Each quote inside sed argument must be escaped with a backslash.

Let's look through the changesets more carefully:
 sed -e "s:\(\$MAKE\):\1 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getCXX)" LINK="$(tc-getCXX)":g"

It is actually (except spaces):
 sed -e "s:\(\$MAKE\):\1 CC=" \
        $(tc-getCC) \
        " CXX=" \
        $(tc-getCXX) \
        " LD=" \
        $(tc-getCXX) \
        " LINK=" \
        $(tc-getCXX) \
        ":g"


[1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/qt4-build.eclass?r1=1.80&r2=1.82
Comment 7 Andrey 2010-09-07 16:08:31 UTC
Created attachment 246369 [details, diff]
escape quotes in qt4-build.eclass
Comment 8 Andrey 2010-09-07 16:51:29 UTC
I would like to reopen this bug, but I guess, I can't do it.:(
Comment 9 Markos Chandras (RETIRED) gentoo-dev 2010-09-07 17:38:32 UTC
Reopening per request
Comment 10 Davide Pesavento (RETIRED) gentoo-dev 2010-11-24 10:26:27 UTC
Someone fix this please, it's trivial.
Comment 11 Dror Levin (RETIRED) gentoo-dev 2011-01-20 23:08:25 UTC
Ugh, fixed now. Sorry for taking this long for something as trivial as this...

Hope we got it right this time.