NetBSD Problem Report #40691

From www@NetBSD.org  Thu Feb 19 15:58:12 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id CEE4563C0CF
	for <gnats-bugs@gnats.netbsd.org>; Thu, 19 Feb 2009 15:58:12 +0000 (UTC)
Message-Id: <20090219155812.A363563BB35@narn.NetBSD.org>
Date: Thu, 19 Feb 2009 15:58:12 +0000 (UTC)
From: kawakubo.pr@gmail.com
Reply-To: kawakubo.pr@gmail.com
To: gnats-bugs@NetBSD.org
Subject: wrapper.sh of pkgtools/pkg_alternatives should use /usr/xpg4/bin/id on Solaris
X-Send-Pr-Version: www-1.0

>Number:         40691
>Category:       pkg
>Synopsis:       wrapper.sh of pkgtools/pkg_alternatives should use /usr/xpg4/bin/id on Solaris
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jmmv
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 19 16:00:00 +0000 2009
>Closed-Date:    Wed Jun 13 15:45:44 +0000 2012
>Last-Modified:  Wed Jun 13 15:45:44 +0000 2012
>Originator:     KAWAKUBO Hiroshi
>Release:        pkgsrc-current on Solaris 10
>Organization:
>Environment:
SunOS XXX 5.10 Generic_137138-09 i86pc i386 i86pc
>Description:
wrapper.sh of pkg_alternatives always prints the following error message on Solaris:

id: illegal option -- u
Usage: id [-ap] [user]
>How-To-Repeat:

>Fix:
The following quick fix works fine for me.

--- wrapper.sh.orig	2005-01-25 13:00:46.000000000 +0000
+++ wrapper.sh
@@ -39,7 +39,16 @@
     exit 1
 fi

-if [ $(id -un) = __ROOT_USER__ ]; then
+case $(uname -s) in
+SunOS)
+    idprog="/usr/xpg4/bin/id"
+    ;;
+*)
+    idprog="id"
+    ;;
+esac
+
+if [ $($idprog -un) = __ROOT_USER__ ]; then
     userfile=
 else
     userfile=~/.pkg_alternatives/${wrapper}

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->jmmv
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Thu, 19 Feb 2009 16:16:51 +0000
Responsible-Changed-Why:
Over to maintainer.


From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/40691: wrapper.sh of pkgtools/pkg_alternatives should use
 /usr/xpg4/bin/id on Solaris
Date: Thu, 19 Feb 2009 10:34:59 -0600 (CST)

 On Thu, 19 Feb 2009, kawakubo.pr@gmail.com wrote:

 > -if [ $(id -un) = __ROOT_USER__ ]; then
 > +case $(uname -s) in
 > +SunOS)
 > +    idprog="/usr/xpg4/bin/id"
 > +    ;;
 > +*)
 > +    idprog="id"
 > +    ;;
 > +esac
 > +
 > +if [ $($idprog -un) = __ROOT_USER__ ]; then


 Or maybe idprog should be based on pkgsrc's TOOLS_PLATFORM.id





   Jeremy C. Reed

 echo 'EhZ[h ^jjf0%%h[[Zc[Z_W$d[j%Xeeai%ZW[ced#]dk#f[d]k_d%' | \
   tr            '#-~'            '\-.-{'

From: "Jonathan Perkin" <jperkin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40691 CVS commit: pkgsrc/pkgtools/pkg_alternatives
Date: Wed, 13 Jun 2012 15:35:32 +0000

 Module Name:	pkgsrc
 Committed By:	jperkin
 Date:		Wed Jun 13 15:35:32 UTC 2012

 Modified Files:
 	pkgsrc/pkgtools/pkg_alternatives: Makefile
 	pkgsrc/pkgtools/pkg_alternatives/files: pkg_alternatives.sh wrapper.sh

 Log Message:
 Update to 1.6, changes:

  - Use the correct id(1) program.  Fixes PR pkg/40691

  - Avoid unprintable characters, some implementations of tr(1) have issues
    with them.  Instead go for what hopefully will be a unique string, as
    well as making use of shell parameter substitution.  Fixes PR pkg/42197

 These changes combined make pkg_alternatives work correctly on Solaris.


 To generate a diff of this commit:
 cvs rdiff -u -r1.17 -r1.18 pkgsrc/pkgtools/pkg_alternatives/Makefile
 cvs rdiff -u -r1.6 -r1.7 \
     pkgsrc/pkgtools/pkg_alternatives/files/pkg_alternatives.sh
 cvs rdiff -u -r1.1.1.1 -r1.2 \
     pkgsrc/pkgtools/pkg_alternatives/files/wrapper.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: jperkin@NetBSD.org
State-Changed-When: Wed, 13 Jun 2012 15:45:44 +0000
State-Changed-Why:
Fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.