Subject: wrapper cc does into infinite loop
To: None <tech-pkg@netbsd.org>
From: Georg Schwarz <georg.schwarz@freenet.de>
List: tech-pkg
Date: 11/13/2004 20:30:34
With the current pkgsrc, when I try to compile a package it goes into an
endless loop (until the machine runs out of processes) as soon as the wrapper
cc is called.
Some investigation shows that work/.wrapper/bin/cc calls itself (recursively)
with the eval $cmd statement at the end of the script.
In the beginning of work/.wrapper/bin/cc cmd is inistailized to
cmd="/usr/people/schwarz/pkgsrc/net/netcat/work/.wrapper/bin/cc" (as an example
for net/netcat; same with other packages).
This happens because in mk/wrapper/wrapper.sh it reads
cmd="@WRAPPEE@".
Now this is substituted in bsd.wrapper.mk by
"s|@WRAPPEE@|$${absdir}${_WRAP_PKG_${_wrappee_}:Q}|g"

Before that, absdir is set like this:

        case $${wrappee} in                                             \
        /*)                                                             \
                absdir=;                                                \
                ;;                                                      \
        *)                                                              \
                save_IFS="$$IFS";                                       \
                IFS=":";                                                \
                for dir in $${PATH}; do                                 \
                        case $${dir} in                                 \
                        *${BUILDLINK_DIR}*)                             \
                                ;;                                      \
                        *)                                              \
                                if [ -f $${dir}/$${wrappee} ] ||        \
                                   [ -h $${dir}/$${wrappee} ] &&        \
                                   [ -x $${dir}/$${wrappee} ]; then     \
                                        absdir=$${dir}/;                \
                                        wrappee=$${absdir}$${wrappee};  \
                                        break;                          \
                                fi;                                     \
                                ;;                                      \
                        esac;                                           \
                done;                                                   \


I assume that PATH contains work/.wrapper/bin, so this is why absdir must be
set accordingly. I'm not sure why this happens, nor do I understand why absdir
is necessary at all (before finally calling eval cmd, work/.wrapper/bin/cc sets
PATH so that it includes the compiler's bin dir).

I removed the absdir mumbo from bsd.wrapper.mk, and then it worked.   
  

-- 
Georg Schwarz    http://home.pages.de/~schwarz/
 georg.schwarz@freenet.de   +49 177 8811442