Subject: Re: nbmake-xxx failed on OpenBSD
To: Simon J. Gerraty <sjg@crufty.net>
From: Tetsuya Isaki <isaki@par.odn.ne.jp>
List: tech-toolchain
Date: 02/06/2005 14:13:48
Hi,

At Sat,  5 Feb 2005 09:08:42 -0800 (PST),
Simon J. Gerraty wrote:
> 
> >I'm trying to build netbsd-2-0 on OpenBSD/i386-3.6.
> >But MAKEOBJDIR in tools/bin/nbmake-xxx is broken.
> 
> >It seems different interpretation for ','(comma) in
> >variable?  I'm not sure especially '+'(plus) is good
> >separator or not..  Anyway this patch works fine for
> >me.
> 
> First, can we establish that your shell is doing it's part:
> What do you get for the following script:
> 
> TOP=/my/src
> OPTARG=/my/obj
> 
> setmakeenv()
> {
>     set -x
>     eval "$1='$2'; export $1"
>     makeenv="${makeenv} $1"
> }
> 
> setmakeenv MAKEOBJDIR "\${.CURDIR:C,^$TOP,$OPTARG,}"
> 
> If I run that with sh, ksh on Net or Free (plus bash and zsh) I see:
> 
> MAKEOBJDIR=${.CURDIR:C,^/my/src,/my/obj,}

Your script show the same result both OpenBSD and NetBSD.
But I got different result by the following script.

% cat a
#! /usr/bin/env sh
TOP=/my/src
OPTARG=/my/obj

setmakeenv()
{
    set -x
    eval "$1='$2'; export $1"
    makeenv="${makeenv} $1"
}

setmakeenv MAKEOBJDIR "\${.CURDIR:C,^$TOP,$OPTARG,}"

f=MAKEOBJDIR
eval echo "${f}=\'\$$(echo ${f})\'\;\ export\ ${f}"
%

(On NetBSD 2.0_RC4)
% uname -a
NetBSD mai.xxxxxxxxxxxxxxxx.jp 2.0_RC4 NetBSD 2.0_RC4 (MAI) #2: Thu Jan  6 11:46:11 JST 2005  root@mai.xxxxxxxxxxxxxxxx.jp:/usr/src/sys/arch/i386/compile/MAI i386
% ./a
+ eval MAKEOBJDIR='${.CURDIR:C,^/my/src,/my/obj,}'; export MAKEOBJDIR
+ MAKEOBJDIR=${.CURDIR:C,^/my/src,/my/obj,}
+ export MAKEOBJDIR
+ makeenv= MAKEOBJDIR
+ f=MAKEOBJDIR
+ echo MAKEOBJDIR
+ eval echo MAKEOBJDIR=\'$MAKEOBJDIR\'\;\ export\ MAKEOBJDIR
+ echo MAKEOBJDIR='${.CURDIR:C,^/my/src,/my/obj,}'; export MAKEOBJDIR
MAKEOBJDIR='${.CURDIR:C,^/my/src,/my/obj,}'; export MAKEOBJDIR
% 

(On OpenBSD 3.6)
% ./a
+ eval MAKEOBJDIR='${.CURDIR:C,^/my/src,/my/obj,}'; export MAKEOBJDIR
+ MAKEOBJDIR=${.CURDIR:C,^/my/src,/my/obj,}
+ export MAKEOBJDIR
+ makeenv= MAKEOBJDIR
MAKEOBJDIR='$.CURDIR:C'; export MAKEOBJDIR MAKEOBJDIR='$^/my/src'; export MAKEOBJDIR MAKEOBJDIR='$/my/obj'; export MAKEOBJDIR MAKEOBJDIR='$'; export MAKEOBJDIR
% 
---
Tetsuya ISAKI <isaki@par.odn.ne.jp / isaki@NetBSD.org>