NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/46750: make oddity expanding variables assigned to with +=

>Number:         46750
>Category:       toolchain
>Synopsis:       make oddity expanding variables assigned to with +=
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 28 17:55:00 +0000 2012
>Originator:     Edgar Fuß
>Release:        NetBSD 6.0_BETA2
        Mathematisches Institut der Uni Bonn
System: NetBSD 6.0_BETA2 NetBSD 6.0_BETA2 (MI12serv) #3: 
Wed Jul 25 14:41:45 CEST 2012
Architecture: x86_64
Machine: amd64
        Variables that have been assigned to with += expand oddly.
        The variable's full expansion will start with a space, while
        the first element's expansion doesn't.
        Explicitly transforming to space separation (e.g. ":ts ")
        also makes the leading space disappear.
        The following Makefile:
                x+= foo bar

                        echo _${x}
                        echo _${x:[1]}
                        echo _${x:ts }
                echo _ foo bar
                _ foo bar
                echo _foo
                echo _foo bar
                _foo bar

        So while asking for x's first element gives "foo" (not " foo"),
        x nevertheless expands to " foo bar" (not "foo bar").
        And explicitely asking the words to be separated by a space
        gives the expected result (no leading space).

        If you just assign to x (e.g. "x= foo bar"), it works as expected.


Home | Main Index | Thread Index | Old Index