From koma2@ksta.ms.u-tokyo.ac.jp  Mon May  9 21:34:48 2005
Return-Path: <koma2@ksta.ms.u-tokyo.ac.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E494416A4EA
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 May 2005 21:34:48 +0000 (GMT)
Received: from ksta.ms.u-tokyo.ac.jp (ksta.ms.u-tokyo.ac.jp [157.82.17.219])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A6A9143D3F
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 May 2005 21:34:48 +0000 (GMT)
	(envelope-from koma2@ksta.ms.u-tokyo.ac.jp)
Received: by ksta.ms.u-tokyo.ac.jp (Postfix, from userid 1003)
	id C1B7756445; Tue, 10 May 2005 06:34:47 +0900 (JST)
Message-Id: <20050509213447.C1B7756445@ksta.ms.u-tokyo.ac.jp>
Date: Tue, 10 May 2005 06:34:47 +0900 (JST)
From: KOMATSU Shinichiro <koma2@lovepeers.org>
Reply-To: KOMATSU Shinichiro <koma2@lovepeers.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: x11-toolkits/linux-gtk: cannot install by non-root user on amd64
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         80837
>Category:       ports
>Synopsis:       x11-toolkits/linux-gtk: cannot install by non-root user on amd64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-emulation
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 09 21:40:02 GMT 2005
>Closed-Date:    Sat Nov 26 01:02:26 GMT 2005
>Last-Modified:  Sat Nov 26 01:02:26 GMT 2005
>Originator:     KOMATSU Shinichiro
>Release:        FreeBSD 5.3-RELEASE-p5 amd64
>Organization:
>Environment:
FreeBSD 5.3-RELEASE-p5 amd64

>Description:

On amd64, when "make install" is run by non-root user,
installation of x11-toolkits/linux-gtk finishes with success 
but nothing is really installed.

    % make install
    ...(snip)...
    ===>  Installing for linux-gtk-1.2_4
    ===>   linux-gtk-1.2_4 depends on file: /compat/linux/usr/X11R6/lib/libX11.so.6 - found
    ===>   Generating temporary packing list
    ===>  Checking if x11-toolkits/linux-gtk already installed
    ===>  Switching to root credentials for 'install' target
    gtk+-1.2.9-4.i386.rpm
    package gtk+-1.2.9-4 is for a different architecture
    ===>   Registering installation for linux-gtk-1.2_4
    ===>  Returning to user credentials

    % pkg_info -qL linux-gtk-1.2_4 | xargs ls -l
    ls: /compat/linux/etc/gtk/gtkrc: No such file or directory
    ls: /compat/linux/etc/gtk/gtkrc.az: No such file or directory
    ...(snip)...

When installed by root, everything is successful.

This is because a separate make process is run (with ${SU_CMD})
when "install" target is executed by non-root user,
and ${ARCH}, which is overwritten to "i386" by the 1st make process,
is passed to the 2nd make, and the following part of the Makefile  
is not interpreted.

    .if (${ARCH} == "amd64")
    ARCH=		i386
    RPMFLAGS+=	--ignorearch
    .endif

This is the same problem as ports/80679 (so portupgrade also fails),
and the same fix should be applied.

>How-To-Repeat:
	
>Fix:

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/x11-toolkits/linux-gtk/Makefile,v
retrieving revision 1.30
diff -u -r1.30 Makefile
--- Makefile	1 Mar 2005 21:51:48 -0000	1.30
+++ Makefile	9 May 2005 21:29:40 -0000
@@ -27,7 +27,7 @@
 
 .include <bsd.port.pre.mk>
 
-.if (${ARCH} == "amd64")
+.if (${MACHINE_ARCH} == "amd64")
 ARCH=		i386
 RPMFLAGS+=	--ignorearch
 .endif
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->freebsd-emulation 
Responsible-Changed-By: arved 
Responsible-Changed-When: Tue May 10 18:12:10 GMT 2005 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80837 
Responsible-Changed-From-To: freebsd-emulation->emulation 
Responsible-Changed-By: gerald 
Responsible-Changed-When: Mon May 16 12:46:56 GMT 2005 
Responsible-Changed-Why:  
Use canonical address of the emulation mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80837 
State-Changed-From-To: open->feedback 
State-Changed-By: vs 
State-Changed-When: Fri Oct 28 14:32:35 GMT 2005 
State-Changed-Why:  
Can you please check if this is still an issue? I'm unable to repeat 
this, albeit with a hand-crafted test-setup. 
Also, using MACHINE_ARCH is usually the wrong solution, please read 
bsd.port.mk for the rationale. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80837 
State-Changed-From-To: feedback->closed 
State-Changed-By: pav 
State-Changed-When: Sat Nov 26 01:02:18 GMT 2005 
State-Changed-Why:  
Feedback timeout (1 month) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80837 
>Unformatted:
