BIND 10 #2661: handle space in "-L /path/to/lib" output from python-config

BIND 10 Development do-not-reply at isc.org
Fri Feb 8 14:26:49 UTC 2013


#2661: handle space in "-L /path/to/lib" output from python-config
-------------------------------------+-------------------------------------
            Reporter:  jinmei        |                        Owner:
                Type:  defect        |  jinmei
            Priority:  medium        |                       Status:
           Component:  build system  |  reviewing
            Keywords:                |                    Milestone:
           Sensitive:  0             |  Sprint-20130219
         Sub-Project:  Core          |                   Resolution:
Estimated Difficulty:  2             |                 CVSS Scoring:
         Total Hours:  0             |              Defect Severity:  N/A
                                     |  Feature Depending on Ticket:
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
Changes (by jelte):

 * owner:  jelte => jinmei


Comment:

 Ah, I think I finally figured it out.

 My python3.2-config --ldflags output is:
 -L/usr/lib/python3.2/config-3.2mu -lpthread -ldl -lutil -lm -lpython3.2mu
 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions

 And I have been testing several variations of sed in scripts and
 configure.ac; the problems here seems to be that the blockquotes don't
 survive (it works in raw shellscript but not in configure.ac).

 If I add these lines in configure.ac (PYCONFIG added for easy grepping):
 {{{
     echo "PYCONFIG command: ${PYTHON}-config --ldflags"

     P=`${PYTHON}-config --ldflags`
     echo "PYCONFIG output: '$P'"

     P=`${PYTHON}-config --ldflags | sed -ne 's/\([ \t]*-L\)[ ]*\([^ \t]*[
 \t]*\)/\1\2/pg'`
     echo "PYCONFIG output after sed: '$P'"

     P=[`${PYTHON}-config --ldflags | sed -ne 's/\([ \t]*-L\)[ ]*\([^ \t]*[
 \t]*\)/\1\2/pg'`]
     echo "PYCONFIG output after sed quoted: '$P'"
 }}}

 The output is:

 {{{
 PYCONFIG command: /usr/bin/python3.2-config --ldflags
 PYCONFIG output: '-L/usr/lib/python3.2/config-3.2mu -lpthread -ldl -lutil
 -lm -lpython3.2mu -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-
 functions'
 PYCONFIG output after sed: ''
 PYCONFIG output after sed quoted: '-L/usr/lib/python3.2/config-3.2mu
 -lpthread -ldl -lutil -lm -lpython3.2mu -Xlinker -export-dynamic -Wl,-O1
 -Wl,-Bsymbolic-functions'
 }}}

 And, additionally, because it only prints matching lines, it would fail if
 my output did not happen to have an -L value.

 So I suggest we quote the command, and either first make sure -L is
 present in the first place, or also let it replace -l[ ]*; e.g.
 {{{
         python_config_ldflags=[`${PYTHON}-config --ldflags | sed -ne
 's/\([ \t]*-[lL]\)[ ]*\([^ \t]*[ \t]*\)/\1\2/pg'`]
 }}}

 Removing spaces after -l is in principle unnecessary in itself, but at
 least it would always match if there is something useful in the -config
 output.

 The only question is whether that would break with any other version of
 autoconf :)

-- 
Ticket URL: <http://bind10.isc.org/ticket/2661#comment:9>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list