Subject: Re: debugging pkgsrc on Solaris
To: David Laight <david@l8s.co.uk>
From: Raymond Meyer <raymond.meyer@rambler.ru>
List: pkgsrc-users
Date: 07/05/2006 23:49:30
On Wed, 5 Jul 2006 23:21:15 +0100
David Laight <david@l8s.co.uk> wrote:

> On Wed, Jul 05, 2006 at 11:05:07PM +0100, Raymond Meyer wrote:
> > 
> > both /usr/bin/ksh and /usr/xpg4/bin/sh result in the same error described
> > above
> > 
> > only when
> > 
> > ln -s /usr/bin/bash sh
> > 
> > the error goes away
> 
> one option might be to replace /bin/sh with (something like):
> #! /bin/ksh
> [ -n "$ECHOARGS" ] && echo args: "$@" >>/tmp/arglist
> exec /bin/sh.save "$@"
> 
> Although doing that with 'sh' might generate more output than you want!
> I also remember someone finding a script that accidentally did a bash-specific
> variable substitution.
> 
> running under 'truss -eaf -vall -wall -rall' (if I remember the args)
> might generate somthing in the GB of trace.
> 
> 	David
> 
> -- 
> David Laight: david@l8s.co.uk

Thanks, I used truss command:

24420:  execve("/bin/sh", 0x00044488, 0x0004C068)  argc = 3
24420:   argv: /bin/sh -c
24420:    for str in ; do                                /usr/ucb/echo 1>&2 "ERR
OR:" "$str";                                     done

This is coming from mk/bsd.pkg.mk
Lines of the following form cause problems, I think:

#
# Now print some error messages that we know we should ignore the pkg
#
.  if defined(PKG_FAIL_REASON) || defined(PKG_SKIP_REASON)
.PHONY: do-check-pkg-fail-or-skip-reason
fetch checksum extract patch configure all build install package \
update depends do-check-pkg-fail-or-skip-reason:
.    if defined(SKIP_SILENT)
        @${DO_NADA}
.    else
        @for str in ${PKG_FAIL_REASON}; do                              \
                ${ERROR_MSG} "$$str";                                   \
        done
        @for str in ${PKG_SKIP_REASON}; do                              \
                ${WARNING_MSG} "$$str";                                 \
        done
.    endif
.    if defined(PKG_FAIL_REASON)
        @${FALSE}
.    endif
.  endif # SKIP
.endif # !NO_SKIP

What would be a proper fix for this??