From koma2@jiro.c.u-tokyo.ac.jp  Mon Jul 29 05:34:47 2002
Return-Path: <koma2@jiro.c.u-tokyo.ac.jp>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B997137B400
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Jul 2002 05:34:47 -0700 (PDT)
Received: from taro.c.u-tokyo.ac.jp (taro.c.u-tokyo.ac.jp [157.82.63.16])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2A4EC43E3B
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Jul 2002 05:34:47 -0700 (PDT)
	(envelope-from koma2@jiro.c.u-tokyo.ac.jp)
Message-Id: <20020729123446.3F84C1934@taro.c.u-tokyo.ac.jp>
Date: Mon, 29 Jul 2002 21:34:45 +0900 (JST)
From: KOMATSU Shinichiro <koma2@jiro.c.u-tokyo.ac.jp>
Reply-To: KOMATSU Shinichiro <koma2@jiro.c.u-tokyo.ac.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: print/acroread5: 2 sed_inplace problems
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41121
>Category:       ports
>Synopsis:       print/acroread5: 2 sed_inplace problems
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    trevor
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 29 05:40:02 PDT 2002
>Closed-Date:    Thu Aug 08 04:52:58 PDT 2002
>Last-Modified:  Mon Aug 19 12:20:01 PDT 2002
>Originator:     KOMATSU Shinichiro
>Release:        FreeBSD 4.6-RELEASE-p3 i386
>Organization:
>Environment:
FreeBSD 4.6-RELEASE-p3 i386

>Description:

o sed_inplace's -i option must take an argument. 
  According to -current's man page of sed(1),

    -i extension
        Edit files in-place, saving backups with the specified extension.
	If a zero-length extension is given, no backup will be saved.

  If no argument is supplied to -i, eg. 

      sed_inplace -i -E 's:Linux):FreeBSD|Linux):g' ${WRKDIR}/INSTALL

  backup file ${WRKDIR}/INSTALL-E is created.
  So, $REINPLACE_ARGS must be -i '' instead of just -i.

o Because sed_inplace -i has a problem with read-only files,
  write permission bit must be set to target file. 

>How-To-Repeat:

Run make as a normal (non-root) user:

    % make
    ......(snip)......
    ===>  Configuring for acroread-5.06
    /usr/local/bin/sed_inplace -i -E 's:Linux):FreeBSD|Linux):g' /usr/local/ports/print/acroread5/work/INSTALL
    sed_inplace: stdout: Bad file descriptor
    *** Error code 1

    Stop in /usr/local/ports/print/acroread5.

This is the second problem.

If make intall is run as root, the second problem does not occur,
but an extra file /usr/local/Acrobat5/bin/acroread-E is created.
This is the first problem.

>Fix:

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/print/acroread5/Makefile,v
retrieving revision 1.41
diff -u -u -r1.41 Makefile
--- Makefile	27 Jul 2002 13:20:22 -0000	1.41
+++ Makefile	28 Jul 2002 19:46:56 -0000
@@ -21,7 +21,7 @@
 
 USE_LINUX=	yes
 USE_REINPLACE=	yes
-REINPLACE_ARGS=	-i
+REINPLACE_ARGS=	-i ''
 NO_FILTER_SHLIBS=	yes
 
 .if ${ARCH} == "i386"
@@ -30,6 +30,7 @@
 WRKSRC=		${WRKDIR}
 
 pre-configure:
+	${CHMOD} u+w ${WRKDIR}/INSTALL
 	${REINPLACE_CMD} -E 's:Linux):FreeBSD|Linux):g' ${WRKDIR}/INSTALL
 
 do-build:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->trevor 
Responsible-Changed-By: naddy 
Responsible-Changed-When: Mon Jul 29 13:30:13 PDT 2002 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41121 
State-Changed-From-To: open->closed 
State-Changed-By: trevor 
State-Changed-When: Thu Aug 8 04:52:27 PDT 2002 
State-Changed-Why:  
committed with some changes--thank you 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41121 

From: Niall Brady <bradyn@maths.tcd.ie>
To: freebsd-gnats-submit@FreeBSD.org
Cc: koma2@jiro.c.u-tokyo.ac.jp, freebsd-ports@FreeBSD.org
Subject: Re: ports/41121: print acroread5: 2 sed_inplace problems
Date: Mon, 19 Aug 2002 19:31:29 +0100

 Just spotted this today.  We're running 4.6-STABLE, with freshly
 cvsupped ports tree (i.e.  r1.42 of print/acroread/Makefile).
 
 I'm not sure if I'm seeing a problem here (not knowing sed_inplace
 ;-), but as the "-i" argument to ${REINPLACE_ARGS} was removed
 between 1.41, and 1.42, the "make install" stage doesn't patch the
 installed file.
 
 The patch below seems to fix it for me, using either sed_inplace, or
 pure sed, on STABLE.
 
 However, if there's some newer version of sed_inplace out there,
 that doesn't require the "-i" argument, then REINPLACE_ARGS might
 want to be made part of a conditional which tests for ${OSVERSION},
 similar to that used in bsd.port.mk for REINPLACE_CMD (as I'm
 buggered if I know how to make conditionals work with multi-word
 strings in BSD make ;-)
 
 [also minor nit fixed with  an extraneous "-E" argument].
 
 -- 
 	Niall
 
 
 
 --- Makefile.orig	Mon Aug 19 19:00:44 2002
 +++ Makefile	Mon Aug 19 19:04:15 2002
 @@ -21,7 +21,7 @@
  
  USE_LINUX=	yes
  USE_REINPLACE=	yes
 -REINPLACE_ARGS=	-E
 +REINPLACE_ARGS=	-i '' -E
  NO_FILTER_SHLIBS=	yes
  
  .if ${ARCH} == "i386"
 @@ -44,7 +44,7 @@
  	${REINPLACE_CMD} 's:Linux):FreeBSD|Linux):g' ${PREFIX}/Acrobat5/bin/acroread
  	-@/compat/linux/usr/bin/strip ${PREFIX}/Acrobat5/Reader/intellinux/bin/acroread
  	@brandelf -t Linux ${PREFIX}/Acrobat5/Reader/intellinux/bin/acroread
 -	${REINPLACE_CMD} -E 's:OSF1):FreeBSD|OSF1):g' ${PREFIX}/Acrobat5/bin/acroread
 +	${REINPLACE_CMD} 's:OSF1):FreeBSD|OSF1):g' ${PREFIX}/Acrobat5/bin/acroread
  	@cd ${PREFIX}/Acrobat5/bin && \
  	  ${INSTALL_SCRIPT} ${PREFIX}/Acrobat5/bin/acroread \
  	     ${PREFIX}/bin/acroread5

From: Trevor Johnson <trevor@jpj.net>
To: Niall Brady <bradyn@maths.tcd.ie>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: ports/41121: print acroread5: 2 sed_inplace problems
Date: Mon, 19 Aug 2002 15:17:40 -0400 (EDT)

 Niall Brady wrote:
 
 >  --- Makefile.orig	Mon Aug 19 19:00:44 2002
 >  +++ Makefile	Mon Aug 19 19:04:15 2002
 >  @@ -21,7 +21,7 @@
 >
 >   USE_LINUX=	yes
 >   USE_REINPLACE=	yes
 >  -REINPLACE_ARGS=	-E
 >  +REINPLACE_ARGS=	-i '' -E
 >   NO_FILTER_SHLIBS=	yes
 >
 >   .if ${ARCH} == "i386"
 >  @@ -44,7 +44,7 @@
 >   	${REINPLACE_CMD} 's:Linux):FreeBSD|Linux):g' ${PREFIX}/Acrobat5/bin/acroread
 >   	-@/compat/linux/usr/bin/strip ${PREFIX}/Acrobat5/Reader/intellinux/bin/acroread
 >   	@brandelf -t Linux ${PREFIX}/Acrobat5/Reader/intellinux/bin/acroread
 >  -	${REINPLACE_CMD} -E 's:OSF1):FreeBSD|OSF1):g' ${PREFIX}/Acrobat5/bin/acroread
 >  +	${REINPLACE_CMD} 's:OSF1):FreeBSD|OSF1):g' ${PREFIX}/Acrobat5/bin/acroread
 >   	@cd ${PREFIX}/Acrobat5/bin && \
 >   	  ${INSTALL_SCRIPT} ${PREFIX}/Acrobat5/bin/acroread \
 >   	     ${PREFIX}/bin/acroread5
 
 Thank you for the patch.  I have applied it.
 -- 
 Trevor Johnson
 
>Unformatted:
