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
>Organization:
        Mathematisches Institut der Uni Bonn
>Environment:
        
        
System: NetBSD trave.math.uni-bonn.de 6.0_BETA2 NetBSD 6.0_BETA2 (MI12serv) #3: 
Wed Jul 25 14:41:45 CEST 2012 
support%trave.math.uni-bonn.de@localhost:/usr/obj/sys/arch/amd64/compile/mi12serv
 amd64
Architecture: x86_64
Machine: amd64
>Description:
        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.
>How-To-Repeat:
        The following Makefile:
        
                x=
                x+= foo bar

                default:
                        echo _${x}
                        echo _${x:[1]}
                        echo _${x:ts }
        
        outputs:
        
                echo _ foo bar
                _ foo bar
                echo _foo
                _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.
>Fix:
        

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index