From owner-freebsd-bugs Sun Aug 4 9:20: 9 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 37CF937B400 for ; Sun, 4 Aug 2002 09:20:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9347543E4A for ; Sun, 4 Aug 2002 09:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g74GK2JU069836 for ; Sun, 4 Aug 2002 09:20:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g74GK26q069835; Sun, 4 Aug 2002 09:20:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A2D7037B400 for ; Sun, 4 Aug 2002 09:14:16 -0700 (PDT) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 821E343E70 for ; Sun, 4 Aug 2002 09:14:15 -0700 (PDT) (envelope-from marck@woozle.rinet.ru) Received: (from marck@localhost) by woozle.rinet.ru (8.11.6/8.11.6) id g74GEDY84314; Sun, 4 Aug 2002 20:14:13 +0400 (MSD) (envelope-from marck) Message-Id: <200208041614.g74GEDY84314@woozle.rinet.ru> Date: Sun, 4 Aug 2002 20:14:13 +0400 (MSD) From: Dmitry Morozovsky Reply-To: Dmitry Morozovsky To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/41317: reflect kernel building user for sudo-ers Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 41317 >Category: kern >Synopsis: reflect kernel building user for sudo-ers >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 04 09:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Dmitry Morozovsky >Release: FreeBSD 4-STABLE i386 >Organization: Cronyx Plus LLC (RiNet ISP) >Environment: System: FreeBSD 4-STABLE >Description: When using sudo instead of su, environment is slightly different. In particular, both $USER and $LOGNAME are set to root after sudo -s. There is at least one annoying side effect of this: kernel build user mentioned is always 'root'. In this case the only reliable way to get logged-in user name is /usr/bin/logname. Following patch utilizes it. >How-To-Repeat: For example, using old-way kernel compile: sudo -s cd /usr/src/sys/i386/conf config GENERIC cd ../../compile/GENERIC make vers.c grep compile vers.c >Fix: Index: newvers.sh =================================================================== RCS file: /home/ncvs/src/sys/conf/newvers.sh,v retrieving revision 1.44.2.24 diff -u -r1.44.2.24 newvers.sh --- newvers.sh 16 Jun 2002 00:31:54 -0000 1.44.2.24 +++ newvers.sh 4 Aug 2002 15:30:14 -0000 @@ -85,7 +85,8 @@ fi touch version -v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date` +u=`/usr/bin/logname` +v=`cat version` u=${u-root} d=`pwd` h=`hostname` t=`date` cat << EOF > vers.c $COPYRIGHT char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message