NetBSD Problem Report #36371

From cheusov@tut.by  Mon May 21 21:22:13 2007
Return-Path: <cheusov@tut.by>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id EA80C63B880
	for <gnats-bugs@gnats.netbsd.org>; Mon, 21 May 2007 21:22:12 +0000 (UTC)
Message-Id: <s93tzu527ov.fsf@chen.chizhovka.net>
Date: Tue, 22 May 2007 00:22:24 +0300
From: cheusov@tut.by
Reply-To:
To: gnats-bugs@NetBSD.org
Subject: SU_CMD, sudo and cyclic dependancy
X-Send-Pr-Version: 3.95

>Number:         36371
>Category:       pkg
>Synopsis:       SU_CMD, sudo and cyclic dependancy
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    reed
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 21 21:25:00 +0000 2007
>Last-Modified:  Tue May 22 14:12:01 +0000 2007
>Originator:     cheusov@tut.by
>Release:        NetBSD 4.0_BETA2
>Organization:
Best regards, Aleksey Cheusov.
>Environment:
System: NetBSD chen.chizhovka.net 4.0_BETA2 NetBSD 4.0_BETA2 (GENERIC) #16: Mon May 21 00:01:33 EEST 2007 cheusov@chen.chizhovka.net:/srv/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
First, an example in section 8.13

    .if exists(${LOCALBASE}/bin/sudo)
    SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
    .endif

doesn't work because because ${LOCALBASE} is expanded to an empty string.
IMHO it's better to change this example to this

    SUDO=/static/path/to/sudo
    .if exists(${SUDO})
    SU_CMD=        ${SUDO} /bin/sh -c
    .endif

Second, I see here a cyclic dependancy. Building pkgsrc requires
sudo but sudo is installed from pkgsrc. Falling to su
is also bad (in case .exist return false) because it doesn't allow
(or make it a bit problematic) to build everything automatically
without manually inputting password for su.

So, I personally think that plain
    SU_CMD=/usr/bin/sudo /bin/sh -c
  or
    SU_CMD=/usr/local/bin/sudo /bin/sh -c
is much better than the current variant.

At least it makes sense to mention about "cyclic dependancy" in this section
of documentation
or even better to recomend users to use external version of sudo, at least
for those who uses not NetBSD and DragonFlyBSD. 

>How-To-Repeat:

>Fix:

Unknown
>Release-Note:

>Audit-Trail:
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/36371: SU_CMD, sudo and cyclic dependancy
Date: Tue, 22 May 2007 14:27:41 +0200

 On Mon, May 21, 2007 at 09:25:00PM +0000, cheusov@tut.by wrote:
 > First, an example in section 8.13
 > 
 >     .if exists(${LOCALBASE}/bin/sudo)
 >     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
 >     .endif
 > 
 > doesn't work because because ${LOCALBASE} is expanded to an empty string.

 It is assumed in general that you have defined it already. As the
 LOCALBASE is a local setting, the guide can not hard-code values.
 /static/path/to/sudo is even more confusing IMO.

 > Second, I see here a cyclic dependancy. Building pkgsrc requires
 > sudo but sudo is installed from pkgsrc. Falling to su
 > is also bad (in case .exist return false) because it doesn't allow
 > (or make it a bit problematic) to build everything automatically
 > without manually inputting password for su.

 There is no cyclic dependency. If sudo exists, it is used, otherwise
 not. As sudo is not changed very often, the issue is IMO not much
 relevant.

 > So, I personally think that plain
 >     SU_CMD=/usr/bin/sudo /bin/sh -c
 >   or
 >     SU_CMD=/usr/local/bin/sudo /bin/sh -c
 > is much better than the current variant.
 > 
 > At least it makes sense to mention about "cyclic dependancy" in this section
 > of documentation
 > or even better to recomend users to use external version of sudo, at least
 > for those who uses not NetBSD and DragonFlyBSD. 

 Neither NetBSD nor DragonFly have a sudo by default. Pointing to an
 external version is therefore not really helping.

 Joerg

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org,
	pkgsrc-bugs@netbsd.org
Subject: Re: pkg/36371: SU_CMD, sudo and cyclic dependancy
Date: Tue, 22 May 2007 16:18:32 +0300

  >> First, an example in section 8.13
  >> 
  >>     .if exists(${LOCALBASE}/bin/sudo)
  >>     SU_CMD=        ${LOCALBASE}/bin/sudo /bin/sh -c
  >>     .endif
  >> 
  >> doesn't work because because ${LOCALBASE} is expanded to an empty string.
 >  
 >  It is assumed in general that you have defined it already. As the
 >  LOCALBASE is a local setting, the guide can not hard-code values.
 >  /static/path/to/sudo is even more confusing IMO.
 "In general" ;). I believe most people doesn't set LOCALBASE in
 mk.conf and use /usr/pkg set by default.
 So, this example doesn't work for most people.

  >> Second, I see here a cyclic dependancy. Building pkgsrc requires
  >> sudo but sudo is installed from pkgsrc. Falling to su
  >> is also bad (in case .exist return false) because it doesn't allow
  >> (or make it a bit problematic) to build everything automatically
  >> without manually inputting password for su.
 >  
 >  There is no cyclic dependency.
 Formally yes, if...

 >  If sudo exists, it is used, otherwise
 >  not. As sudo is not changed very often, the issue is IMO not much
 >  relevant.
 "not much relevant" because most people make bulk build
 with root priviledges. Neither pkg_chk nor "bulk build" 
 were not ready for SU_CMD two months ago. I'm not sure about others.

  >> So, I personally think that plain
  >>     SU_CMD=/usr/bin/sudo /bin/sh -c
  >>   or
  >>     SU_CMD=/usr/local/bin/sudo /bin/sh -c
  >> is much better than the current variant.
  >> 
  >> At least it makes sense to mention about "cyclic dependancy" in
  >> this section of documentation or even better to recomend users to
  >> use external version of sudo, at least for those who uses not
  >> NetBSD and DragonFlyBSD.
 >  
 >  Neither NetBSD nor DragonFly have a sudo by default. Pointing to an
 >  external version is therefore not really helping.
 I really dislike current example. If you think it is fine,
 you can add another one with static path.
 Two examples with some explanation about potential problem
 (cyclic dependancy or falling to su) is better than one.

 -- 
 Best regards, Aleksey Cheusov.

Responsible-Changed-From-To: pkg-manager->reed
Responsible-Changed-By: reed@netbsd.org
Responsible-Changed-When: Tue, 22 May 2007 14:12:01 +0000
Responsible-Changed-Why:
I will clarify this in the documentation.


>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.