Subject: Re: buildlink problems
To: None <tech-pkg@netbsd.org>
From: Jonathan Perkin <sketch@rd.bbc.co.uk>
List: tech-pkg
Date: 11/14/2002 22:21:48
On Thu, Nov 14, 2002 at 04:25:12AM +0100, Klaus Heinz wrote:

> Jonathan Perkin wrote:
> 
> > I've been trying to further diagnose this, but having never looked at
> > bsd.buildlink2.mk before it's taking a while to grok :)  Looks like
> > the problem snuck in when moving to a single _BLNK_TRANSFORM_SED.
> 
> I have observed the same problem and reported it on 2002-11-3/4 here
> ('buildlink2 ld script drops -lc').

Indeed, I should have probably checked my mailbox before sending, but
couldn't recall seeing anyone else having the same problems.

> Johnny Lam requested some information which I sent and I guess he's
> added this to his (probably already too big) pile of things to-do.

Well, after a lot of grokking, I found the problem.  My .transform.sed
file had some lovely transformations of the type 's|[^	]*||g' which is
what's nuking any arguments sent to .buildlink/bin/* commands.

Devling further, this is caused by the "r" option to gen-transform.sh,
called from bsd.buildlink.mk to remove hardcoded /usr/pkg and /usr/local
directories, along with $X11BASE.

Now for the lovely bit - in the gen-transform.sh script, IFS is set to
":" near the top, but isn't set back until after all the transformations
have completed.  This *could* be fine, apart from the fact that the "r)"
case uses an ":" to send to the internal _r case, thereby breaking up
what is sent (and deleting everything via the sed transformation.)

An easy way to fix this is to put IFS back as soon as it's finished
with, instead of at the end.  I do not know whether this is "correct"
however, as I'm still finding all this stuff quite hairy, but it's below
anyway (and seems to work fine for me.)


Index: gen-transform.sh
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink2/gen-transform.sh,v
retrieving revision 1.2
diff -u -u -r1.2 gen-transform.sh
--- gen-transform.sh    2002/10/31 22:14:09     1.2
+++ gen-transform.sh    2002/11/14 22:20:11
@@ -23,6 +23,7 @@
        esac
        save_IFS="${IFS}"; IFS=":"
        set -- $1
+       IFS="${save_IFS}"
        case "$1" in
        I|L)
                case "$action" in
@@ -120,7 +121,6 @@
                esac
                ;;
        esac
-       IFS="${save_IFS}"
 }
 
 for arg; do


Ugh, it's 10:30pm and I'm still at work...

-- 
Jonathan Perkin - Internet Operations Engineer - BBC Internet Services
24x7 Hotline: +44 (0)1628 407 777 (x37777) - http://support.bbc.co.uk/