Subject: Re: debugging pkgsrc on Solaris
To: None <joerg@britannica.bec.de>
From: Raymond Meyer <raymond.meyer@rambler.ru>
List: tech-pkg
Date: 07/06/2006 00:19:55
On Thu, 6 Jul 2006 01:07:30 +0200
joerg@britannica.bec.de wrote:

> On Wed, Jul 05, 2006 at 11:49:30PM +0100, Raymond Meyer wrote:
> > 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??
> 
> Before going into the for loops, the variables should be checked once
> more whether they are empty. Seems that Solaris doesn't allow that.
> 
> Joerg


[root@ultra10-lan] diff -u bsd.pkg.mk.orig bsd.pkg.mk     
--- bsd.pkg.mk.orig     Thu Jul  6 00:15:28 2006
+++ bsd.pkg.mk  Thu Jul  6 00:18:13 2006
@@ -703,12 +703,16 @@
 .    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
+.      if defined(PKG_FAIL_REASON)
+               @for str in ${PKG_FAIL_REASON}; do                      \
+                       ${ERROR_MSG} "$$str";                           \
+               done
+.      endif
+.      if defined(PKG_SKIP_REASON)
+               @for str in ${PKG_SKIP_REASON}; do                      \
+                       ${WARNING_MSG} "$$str";                         \
+               done
+.      endif
 .    endif
 .    if defined(PKG_FAIL_REASON)
        @${FALSE}