NetBSD Problem Report #26003

Received: (qmail 2397 invoked by uid 605); 21 Jun 2004 22:12:17 -0000
Message-Id: <20040621221214.7025611155@narn.netbsd.org>
Date: Mon, 21 Jun 2004 22:12:14 +0000 (UTC)
From: netbsd-install@home.nl
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: netbsd-install@home.nl
To: gnats-bugs@gnats.NetBSD.org
Subject: piewm not respecting/using GNU_PROGRAM_PREFIX (patch included)
X-Send-Pr-Version: www-1.0

>Number:         26003
>Category:       pkg
>Synopsis:       piewm not respecting/using GNU_PROGRAM_PREFIX (patch included)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    joerg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 21 22:13:00 +0000 2004
>Closed-Date:    Sat Jun 01 21:56:26 +0000 2013
>Last-Modified:  Sat Jun 01 21:56:26 +0000 2013
>Originator:     Noud de Brouwer
>Release:        2.0_BETA
>Organization:
none
>Environment:
NetBSD 192.168.66.11 2.0_BETA NetBSD 2.0_BETA (ME_LAPTOP) #0: Thu Apr 22 09:25:13 CEST 2004  root@host006:/usr/src/sys/arch/i386/compile/ME_LAPTOP i386

>Description:
piewm doesn't use our GNU_PROGRAM_PREFIX environment variable.
worst..piewm uses /usr/bin/m4 w/ unknown option..thus failing.
>How-To-Repeat:
build piewm .. see it failing to read system.twmrc

(piewm 2>>/tmp/X.log) &

/tmp/X.log containing:

m4: unknown option -- s
m4: unknown option -- s
usage: m4 [-Pg] [-Dname[=val]] [-I dirname] [-Uname]
        [-d flags] [-o trfile] [-t macro]

using /usr/bin/m4 w/ unknown option -s
>Fix:
add this patch:

$NetBSD$

--- parse.c	1998-06-03 15:41:45.000000000 +0000
+++ parse.c.new	2004-06-15 21:52:35.000000000 +0000
@@ -1376,7 +1376,7 @@
 		dup2(fids[1], 1);	/* stdout = pipe to parent */
 		/* get_defs("m4", dpy, display_name) */
 		tmp_file = m4_defs(dpy, display_name);
-		execlp("m4", "m4", "-s", tmp_file, "-", NULL); 
+		execlp("@GNU_PROGRAM_PREFIX@m4", "@GNU_PROGRAM_PREFIX@m4", "-s", tmp_file, "-", NULL); 
 		/* If we get here we are screwed... */
 		perror("Can't execlp() m4");
 		exit(124);


and this to Makefile:

post-patch:
	@${CP} ${WRKSRC}/parse.c ${WRKSRC}/parse.c.BK
.if defined(GNU_PROGRAM_PREFIX)
	@${SED} -e "s|@GNU_PROGRAM_PREFIX@|${GNU_PROGRAM_PREFIX}|g" < ${WRKSRC}/parse.c.BK > ${WRKSRC}/parse.c
.else
	@${SED} -e "s|@GNU_PROGRAM_PREFIX@|g|g" < ${WRKSRC}/parse.c.BK > ${WRKSRC}/parse.c
.endif

piewm now respects and uses GNU_PROGRAM_PREFIX.
>Release-Note:
>Audit-Trail:

From: "Julio M. Merino Vidal" <jmmv@menta.net>
To: netbsd-install@home.nl
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26003: piewm not respecting/using GNU_PROGRAM_PREFIX (patch
 included)
Date: Tue, 22 Jun 2004 12:57:04 +0200

 On Mon, 21 Jun 2004 22:12:14 +0000 (UTC)
 netbsd-install@home.nl wrote:

 > -		execlp("m4", "m4", "-s", tmp_file, "-", NULL); 
 > +		execlp("@GNU_PROGRAM_PREFIX@m4", "@GNU_PROGRAM_PREFIX@m4", "-s", tmp_file, "-", NULL); 

 I guess it'd be better to change m4 with @M4@ and have the package Makefile
 decide which is the right value for it (instead of just adding the gnu
 program prefix).  That way it can be set to a full path (using execl instead
 of execlp probably).

 > and this to Makefile:
 > 
 > post-patch:
 > 	@${CP} ${WRKSRC}/parse.c ${WRKSRC}/parse.c.BK
 > .if defined(GNU_PROGRAM_PREFIX)
 > 	@${SED} -e "s|@GNU_PROGRAM_PREFIX@|${GNU_PROGRAM_PREFIX}|g" < ${WRKSRC}/parse.c.BK > ${WRKSRC}/parse.c
 > .else
 > 	@${SED} -e "s|@GNU_PROGRAM_PREFIX@|g|g" < ${WRKSRC}/parse.c.BK > ${WRKSRC}/parse.c
 > .endif

 This is wrong for two reasons:
 1) You have to include bsd.prefs.mk before this chunk.  That way,
    GNU_PROGRAM_PREFIX is _always_ defined, and you can safely use its value.
 2) You have to use the subst.mk framework instead of calling SED directly
    in the post-patch stage (and the stage is wrong anyway, as it should be
    pre-configure).  There are plenty of examples of this in pkgsrc;
    just grep for SUBST_CLASSES in package Makefiles (for example, x11/gdm).

 Cheers

 -- 
 Julio M. Merino Vidal <jmmv@menta.net>
 The NetBSD Project - http://www.NetBSD.org/

From: Noud de Brouwer <netbsd-install@home.nl>
To: "Julio M. Merino Vidal" <jmmv@menta.net>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26003: piewm not respecting/using GNU_PROGRAM_PREFIX 
 (patchincluded)
Date: Tue, 22 Jun 2004 23:32:47 +0200

 "Julio M. Merino Vidal" wrote:

 > On Mon, 21 Jun 2004 22:12:14 +0000 (UTC)
 > netbsd-install@home.nl wrote:
 >
 > > -             execlp("m4", "m4", "-s", tmp_file, "-", NULL);
 > > +             execlp("@GNU_PROGRAM_PREFIX@m4", "@GNU_PROGRAM_PREFIX@m4", "-s", tmp_file, "-", NULL);
 >
 > I guess it'd be better to change m4 with @M4@ and have the package Makefile
 > decide which is the right value for it (instead of just adding the gnu

 if i understand correctly, add:
 m4=  ${PREFIX}/bin/${GNU_PROGRAM_PREFIX}m4
 to Makefile and alter extra patch-file to:

 $NetBSD$

 --- parse.c 1998-06-03 17:41:45.000000000 +0200
 +++ parse.c.new 2004-06-22 20:58:25.000000000 +0200
 @@ -1376,9 +1376,9 @@
    dup2(fids[1], 1); /* stdout = pipe to parent */
    /* get_defs("m4", dpy, display_name) */
    tmp_file = m4_defs(dpy, display_name);
 -  execlp("m4", "m4", "-s", tmp_file, "-", NULL);
 +  execl("@m4@", "@m4@", "-s", tmp_file, "-", NULL);
    /* If we get here we are screwed... */
 -  perror("Can't execlp() m4");
 +  perror("Can't execl() @m4@");
    exit(124);
   }
   /* Parent */

 > program prefix).  That way it can be set to a full path (using execl instead
 > of execlp probably).

 just did test, does run at NetBSD 2.0_BETA (JORNADA720) #0: Tue Jun  8 20:25:42 UTC 2004

 > > and this to Makefile:
 > >
 > > post-patch:
 > >       @${CP} ${WRKSRC}/parse.c ${WRKSRC}/parse.c.BK
 > > .if defined(GNU_PROGRAM_PREFIX)
 > >       @${SED} -e "s|@GNU_PROGRAM_PREFIX@|${GNU_PROGRAM_PREFIX}|g" < ${WRKSRC}/parse.c.BK > ${WRKSRC}/parse.c
 > > .else
 > >       @${SED} -e "s|@GNU_PROGRAM_PREFIX@|g|g" < ${WRKSRC}/parse.c.BK > ${WRKSRC}/parse.c
 > > .endif
 >
 > This is wrong for two reasons:
 > 1) You have to include bsd.prefs.mk before this chunk.  That way,
 >    GNU_PROGRAM_PREFIX is _always_ defined, and you can safely use its value.

 i did test without including, like:
 post-patch:
  @${ECHO} ${GNU_PROGRAM_PREFIX}
 this still gave me a "g".
 ??
 (not all pkgs that do use GNU_PROGRAM+PREFIX do include)

 > 2) You have to use the subst.mk framework instead of calling SED directly
 >    in the post-patch stage (and the stage is wrong anyway, as it should be
 >    pre-configure).  There are plenty of examples of this in pkgsrc;

 (pre-configure, so patchfiles are more easily modified if needed during development.)
 i'm not exactly sure (yet) why it's more a pre-configure as being a post-patch (??)

 subst.mk framework is new to me..so new patch against Makefile would become:

 --- Makefile 2004-06-22 20:16:25.000000000 +0000
 +++ Makefile.new 2004-06-22 20:22:14.000000000 +0000
 @@ -12,6 +12,16 @@
  USE_IMAKE= yes
  USE_BUILDLINK3= yes

 +.include "../../mk/bsd.prefs.mk"
 +
 +m4=  ${PREFIX}/bin/${GNU_PROGRAM_PREFIX}m4
 +
 +SUBST_CLASSES=  m4
 +SUBST_STAGE.m4=  pre-configure
 +SUBST_FILES.m4=  parse.c
 +SUBST_SED.m4=  -e "s|@m4@|${m4}|g"
 +SUBST_MESSAGE.m4= "Fixing m4 call."
 +
  .include "../../graphics/xpm/buildlink3.mk"

  .include "../../mk/bsd.pkg.mk"

 >    just grep for SUBST_CLASSES in package Makefiles (for example, x11/gdm).
 >
 > Cheers

 thanks ..and thanks the pointers!
 Noud

 >
 > --
 > Julio M. Merino Vidal <jmmv@menta.net>
 > The NetBSD Project - http://www.NetBSD.org/


From: "Julio M. Merino Vidal" <jmmv@menta.net>
To: Noud de Brouwer <netbsd-install@home.nl>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26003: piewm not respecting/using GNU_PROGRAM_PREFIX 
 (patchincluded)
Date: Wed, 23 Jun 2004 00:01:16 +0200

 On Tue, 22 Jun 2004 23:32:47 +0200
 Noud de Brouwer <netbsd-install@home.nl> wrote:

 > "Julio M. Merino Vidal" wrote:
 > 
 > > On Mon, 21 Jun 2004 22:12:14 +0000 (UTC)
 > > netbsd-install@home.nl wrote:
 > >
 > > > -             execlp("m4", "m4", "-s", tmp_file, "-", NULL);
 > > > +             execlp("@GNU_PROGRAM_PREFIX@m4", "@GNU_PROGRAM_PREFIX@m4", "-s", tmp_file, "-", NULL);
 > >
 > > I guess it'd be better to change m4 with @M4@ and have the package Makefile
 > > decide which is the right value for it (instead of just adding the gnu
 > 
 > if i understand correctly, add:
 > m4=  ${PREFIX}/bin/${GNU_PROGRAM_PREFIX}m4
 > to Makefile and alter extra patch-file to:
 > 
 > $NetBSD$
 > 
 > --- parse.c 1998-06-03 17:41:45.000000000 +0200
 > +++ parse.c.new 2004-06-22 20:58:25.000000000 +0200
 > @@ -1376,9 +1376,9 @@
 >    dup2(fids[1], 1); /* stdout = pipe to parent */
 >    /* get_defs("m4", dpy, display_name) */
 >    tmp_file = m4_defs(dpy, display_name);
 > -  execlp("m4", "m4", "-s", tmp_file, "-", NULL);
 > +  execl("@m4@", "@m4@", "-s", tmp_file, "-", NULL);
 >    /* If we get here we are screwed... */
 > -  perror("Can't execlp() m4");
 > +  perror("Can't execl() @m4@");
 >    exit(124);
 >   }
 >   /* Parent */

 Yes, but in uppercase, like all other variables.

 > > This is wrong for two reasons:
 > > 1) You have to include bsd.prefs.mk before this chunk.  That way,
 > >    GNU_PROGRAM_PREFIX is _always_ defined, and you can safely use its value.
 > 
 > i did test without including, like:
 > post-patch:
 >  @${ECHO} ${GNU_PROGRAM_PREFIX}
 > this still gave me a "g".
 > ??

 Maybe you have it explicitly set in mk.conf?

 > > 2) You have to use the subst.mk framework instead of calling SED directly
 > >    in the post-patch stage (and the stage is wrong anyway, as it should be
 > >    pre-configure).  There are plenty of examples of this in pkgsrc;
 > 
 > (pre-configure, so patchfiles are more easily modified if needed during development.)
 > i'm not exactly sure (yet) why it's more a pre-configure as being a post-patch (??)

 $ make patch
 $ cd work*/*
 $ edit patches by hand
 $ cd -
 $ mkpatches

 and if you have done automatic patching from post-patch, you get these
 automatic changes in the generated patches.

 > subst.mk framework is new to me..so new patch against Makefile would become:
 > 
 > --- Makefile 2004-06-22 20:16:25.000000000 +0000
 > +++ Makefile.new 2004-06-22 20:22:14.000000000 +0000
 > @@ -12,6 +12,16 @@
 >  USE_IMAKE= yes
 >  USE_BUILDLINK3= yes
 > 
 > +.include "../../mk/bsd.prefs.mk"
 > +
 > +m4=  ${PREFIX}/bin/${GNU_PROGRAM_PREFIX}m4
 > +
 > +SUBST_CLASSES=  m4
 > +SUBST_STAGE.m4=  pre-configure
 > +SUBST_FILES.m4=  parse.c
 > +SUBST_SED.m4=  -e "s|@m4@|${m4}|g"
 > +SUBST_MESSAGE.m4= "Fixing m4 call."
 > +

 Yeah, like that.  I'd s/call/path/, but well.  And i guess the indentation
 is broken due pasting?

 Cheers

 -- 
 Julio M. Merino Vidal <jmmv@menta.net>
 The NetBSD Project - http://www.NetBSD.org/

From: Noud de Brouwer <netbsd-install@home.nl>
To: "Julio M. Merino Vidal" <jmmv@menta.net>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26003: piewm not respecting/using GNU_PROGRAM_PREFIX 
 (patchincluded)
Date: Wed, 23 Jun 2004 01:44:08 +0200

 "Julio M. Merino Vidal" wrote:

 > On Tue, 22 Jun 2004 23:32:47 +0200
 > Noud de Brouwer <netbsd-install@home.nl> wrote:
 >
 > > "Julio M. Merino Vidal" wrote:
 > >
 > > > On Mon, 21 Jun 2004 22:12:14 +0000 (UTC)
 > > > netbsd-install@home.nl wrote:

 > > m4=  ${PREFIX}/bin/${GNU_PROGRAM_PREFIX}m4

 > Yes, but in uppercase, like all other variables.

 i had some twisted thought..by using $m4 Makefile can bypass bsd.prefs.mk
 but if $M4 is used Makefile can bypass bsd.prefs.mk as well.

 > > > This is wrong for two reasons:
 > > > 1) You have to include bsd.prefs.mk before this chunk.  That way,
 > > >    GNU_PROGRAM_PREFIX is _always_ defined, and you can safely use its value.
 > >
 > > i did test without including, like:
 > > post-patch:
 > >  @${ECHO} ${GNU_PROGRAM_PREFIX}
 > > this still gave me a "g".
 > > ??
 >
 > Maybe you have it explicitly set in mk.conf?

 odd..no,
 even had to name an environment variable GNU_PROGRAM_PREFIX to see a value change.

 > and if you have done automatic patching from post-patch, you get these

 indeed & thanks the patch-explanation

 > Yeah, like that.  I'd s/call/path/, but well.  And i guess the indentation

 yup path sounds better/more to it.

 > is broken due pasting?

 yes -(
 (maybe, even combined w/ a non-netbsd Makefile tabsize)

 >
 > Cheers

 thanks,
 Noud

 >
 > --
 > Julio M. Merino Vidal <jmmv@menta.net>
 > The NetBSD Project - http://www.NetBSD.org/

Responsible-Changed-From-To: pkg-manager->jmmv
Responsible-Changed-By: joerg@netbsd.org
Responsible-Changed-When: Thu, 05 Oct 2006 16:21:39 +0000
Responsible-Changed-Why:
Want to finally fix this based on the tool framework?


Responsible-Changed-From-To: jmmv->joerg
Responsible-Changed-By: jmmv@NetBSD.org
Responsible-Changed-When: Tue, 20 Jul 2010 16:24:25 +0000
Responsible-Changed-Why:
No, not me (as you can guess from the 4-year delay).  Unassign if you are not going to fix it yourself either.


State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 01 Jun 2013 21:56:26 +0000
State-Changed-Why:
/usr/bin/m4 supports -s since 2009 (on netbsd anyway)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.