tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

MAKEFLAGS overload



hi-

    I've got a NetBSD/i386 system i recently updated to NetBSD 10.0
and I'm rebuilding /usr/pkg with a current pkgsrc to test it out.

    I noticed that chat/icb fails to build with an error:

===> Building for icb-5.0.9pl1nb7
Making in murgil
make[1]: don't know how to make kmem. Stop

that "kmem" is coming from pkgsrc mk/unprivileged.mk 1.24 where it
was modified to put UNPRIVILEGED_GROUPS into MAKEFLAGS:

1c1
< # $NetBSD: unprivileged.mk,v 1.23 2019/09/02 02:23:02 rillig Exp $
---
> # $NetBSD: unprivileged.mk,v 1.24 2022/11/23 11:59:38 jperkin Exp $
129a130
> MAKEFLAGS+=           UNPRIVILEGED_USER=${UNPRIVILEGED_USER:Q}
132a134
> MAKEFLAGS+=           UNPRIVILEGED_GROUP=${UNPRIVILEGED_GROUP:Q}
135a138
> MAKEFLAGS+=           UNPRIVILEGED_GROUPS=${UNPRIVILEGED_GROUPS:Q}


(where "id -G -n" is 'wheel kmem sys tty operator staff guest nvmm'
on my system...)


looking at the "all" target in work/icb-5.0.9/Makefile it has:

all:            $(PREREQS)
        @for dir in ${DIRS}; do \
                (echo Making in $${dir}; \
                 cd $${dir}; sh ./gen ${MFLAGS} -${MAKEFLAGS}); done

if I add a "@echo MAKEFLAGS=${MAKEFLAGS}" to that rule to debug it
I see that:

MAKEFLAGS= ALLOW_VULNERABLE_PACKAGES= HOST_OSTYPE=NetBSD-10.0-i386 LOWER_OPSYS=netbsd OPSYS=NetBSD OPSYS_VERSION=100000 OS_VERSION=10.0 PKGTOOLS_VERSION=20210410 UNPRIVILEGED_GROUP=wheel UNPRIVILEGED_GROUPS=wheel kmem sys tty operator staff guest nvmm UNPRIVILEGED_USER=root _CC=/usr/bin/gcc _MAKE=/usr/bin/make _PATH_ORIG=/bin:/usr/bin:/sbin:/usr/sbin:/usr/etc:/usr/pkg/bin:/usr/local/bin:. _PKGSRCDIR=/usr/home/netbsd/cur/pkgsrc _PKGSRC_BARRIER=yes _SRC_TOP_=

the content of work/icb-5.0.9/murgil/gen is simply:

#!/bin/sh
make -f ../config -f Make $*


The "make[1]: don't know how to make kmem" error is due to unquoted
spaces from UNPRIVILEGED_GROUPS embedded in MAKEFLAGS.


In trying to figure out what the work/icb-5.0.9/Makefile "all" rule
is trying to do with "-${MAKEFLAGS}" I found this definition of 
MAKEFLAGS that does not appear to match what pkgsrc is doing with it:

https://docs.oracle.com/cd/E19504-01/802-5880/make-65/index.html

    MAKEFLAGS contains flags (that is, single-character options)
    for the make command. Unlike other FLAGS macros, the MAKEFLAGS
    value is a concatenation of flags, without a leading `-'. For
    instance the string eiknp would be a recognized value for
    MAKEFLAGS, while -f x.mk or macro=value would not.


That explains why the work/icb-5.0.9/Makefile thinks it can just
slap a "-" in front of ${MAKEFLAGS} and pass it down to that "gen"
script, but it doesn't really work with the way pkgsrc is using
MAKEFLAGS.  but it only generates a build error with 1.24 of 
unprivileged.mk and an account that is a member of more than one
group (when there is a space embedded in UNPRIVILEGED_GROUPS).


how should we resolve this issue?


chuck


Home | Main Index | Thread Index | Old Index