NetBSD Problem Report #26551
Received: (qmail 18639 invoked by uid 605); 5 Aug 2004 00:50:10 -0000
Message-Id: <20040804222603.DF1A811152@narn.netbsd.org>
Date: Wed, 4 Aug 2004 22:26:03 +0000 (UTC)
From: dgriffi@cs.csubak.edu
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: dgriffi@cs.csubak.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: pkgtools/pkg_tarup crashes when invoked as a normal user
X-Send-Pr-Version: www-1.0
>Number: 26551
>Category: pkg
>Synopsis: pkgtools/pkg_tarup crashes when invoked as a normal user
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 05 00:51:00 +0000 2004
>Closed-Date: Mon Aug 09 21:15:39 +0000 2004
>Last-Modified: Mon Aug 09 21:15:39 +0000 2004
>Originator: David Griffith
>Release: 1.6.1
>Organization:
>Environment:
NetBSD zaphod 1.6.2 NetBSD 1.6.2 (ZAPHOD) #0: Sat Jun 5 04:50:05 PDT 2004 dave@arthur:/usr/src/sys/arch/i386/compile/ZAPHOD i386
>Description:
Attempting to create a package with pkg_tarup while a nonroot user, the following happens:
zaphod:~$ pkg_tarup foobar
Becoming root@zaphod to create a binary package
/usr/bin/su Password:
Illegal variable name.
zaphod:~$
This does not happen when the user is root (ie, using sudo), but it is rather annoying.
>How-To-Repeat:
See above
>Fix:
It seems clear to me that the following section of code in the pkg_tarup script is at fault:
if [ `${ID} -u` != 0 ]; then
${ECHO} "Becoming root@`/bin/hostname` to create a binary package"
${ECHO} -n "`${ECHO} ${SU} | ${SED} -e's/[[:space:]].*//'` ";\
exec ${SU} root -c "$0 \"\$@\"" "$0" "$@"
fi
Those escapes, which appeared in pkg_tarup 1.6, used with the exec call seem to be the problem. I don't know just what is being attempted there. Whoever did it, please explain and hopefully fix it.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->hubertf
Responsible-Changed-By: cube
Responsible-Changed-When: Thu Aug 5 11:40:47 UTC 2004
Responsible-Changed-Why:
Hubert will handle it.
Responsible-Changed-From-To: hubertf->pkg-manager
Responsible-Changed-By: cube
Responsible-Changed-When: Thu Aug 5 11:44:02 UTC 2004
Responsible-Changed-Why:
hubertf will not handle it after all. erh seems to be the
responsible for the breakage, i'll ask him to handle it.
meanwhile, reverting to pkg-manager.
From: Quentin Garnier <qgarnier@eve-team.com>
To: dgriffi@cs.csubak.edu
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26551: pkgtools/pkg_tarup crashes when invoked as a normal
user
Date: Thu, 5 Aug 2004 14:20:39 +0200
On Wed, 4 Aug 2004 22:26:03 +0000 (UTC)
dgriffi@cs.csubak.edu wrote:
>
> >Number: 26551
> >Category: pkg
> >Synopsis: pkgtools/pkg_tarup crashes when invoked as a normal
[...]
> >Description:
> Attempting to create a package with pkg_tarup while a nonroot user,
> the following happens:
>
> zaphod:~$ pkg_tarup foobar
> Becoming root@zaphod to create a binary package
> /usr/bin/su Password:
> Illegal variable name.
> zaphod:~$
>
> This does not happen when the user is root (ie, using sudo), but it is
> rather annoying.
> >How-To-Repeat:
> See above
> >Fix:
> It seems clear to me that the following section of code in the
> pkg_tarup script is at fault:
>
> if [ `${ID} -u` != 0 ]; then
> ${ECHO} "Becoming root@`/bin/hostname` to create a binary
> package"${ECHO} -n "`${ECHO} ${SU} | ${SED}
> -e's/[[:space:]].*//'` ";\ exec ${SU} root -c "$0 \"\$@\""
> "$0" "$@"
> fi
>
> Those escapes, which appeared in pkg_tarup 1.6, used with the exec
> call seem to be the problem. I don't know just what is being
> attempted there. Whoever did it, please explain and hopefully fix it.
I can't reproduce the issue (and I don't find the escapes bogus either).
Can you send me the whole pkg_tarup script you have generated so I can
understand better what happens?
Quentin Garnier.
From: Hubert Feyrer <hubert@feyrer.de>
To: gnats-bugs@gnats.netbsd.org
Cc: cube@netbsd.org, pkg-manager@netbsd.org
Subject: Re: pkg/26551
Date: Thu, 5 Aug 2004 15:18:37 +0200 (CEST)
On Thu, 5 Aug 2004 cube@netbsd.org wrote:
> Synopsis: pkgtools/pkg_tarup crashes when invoked as a normal user
For the record: the problem here is that pkg_tarup tries to do a
su-on-demand, which it never was designed for. The error happens there,
and IMHO that whole su-on-demand handling should be removed.
- Hubert
--
,,_
If wishes were wings, o" )~ would fly. -- Go www.NetBSD.org!
''''
From: cube@cubidou.net
To: Hubert Feyrer <hubert@feyrer.de>
Cc: gnats-bugs@gnats.netbsd.org, pkg-manager@netbsd.org
Subject: Re: pkg/26551
Date: Thu, 5 Aug 2004 15:26:45 +0200
On Thu, Aug 05, 2004 at 03:18:37PM +0200, Hubert Feyrer wrote:
> On Thu, 5 Aug 2004 cube@netbsd.org wrote:
> > Synopsis: pkgtools/pkg_tarup crashes when invoked as a normal user
>
> For the record: the problem here is that pkg_tarup tries to do a
> su-on-demand, which it never was designed for. The error happens there,
> and IMHO that whole su-on-demand handling should be removed.
Look at the code. It doesn't "su-on-demand", it merely re-exec itself
as root if it detects it's not root. It's fine.
I think there is an issue with the submitter's environment, since I
wasn't able to reproduce the issue on various systems.
Quentin Garnier.
From: Dave <dgriffi@cs.csubak.edu>
To: Quentin Garnier <qgarnier@eve-team.com>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26551: pkgtools/pkg_tarup crashes when invoked as a normal
user
Date: Thu, 5 Aug 2004 12:10:29 -0700 (PDT)
On Thu, 5 Aug 2004, Quentin Garnier wrote:
> > Those escapes, which appeared in pkg_tarup 1.6, used with the exec
> > call seem to be the problem. I don't know just what is being
> > attempted there. Whoever did it, please explain and hopefully fix it.
>
> I can't reproduce the issue (and I don't find the escapes bogus either).
> Can you send me the whole pkg_tarup script you have generated so I can
> understand better what happens?
I don't know if the escapes are truly bogus or not. I came to the
conclusion that they were causing problems by inserting lines here and
there to isolate where the crash occurred.
I put the pkg_tarup script in question at
http://www.cs.csubak.edu/~dgriffi/pkg_tarup.gz
--
David Griffith
dgriffi@cs.csubak.edu
From: Quentin Garnier <cube@NetBSD.org>
To: Dave <dgriffi@cs.csubak.edu>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26551: pkgtools/pkg_tarup crashes when invoked as a normal
user
Date: Fri, 6 Aug 2004 00:13:53 +0200
Le Thu, 5 Aug 2004 12:10:29 -0700 (PDT)
Dave a ecrit :
> On Thu, 5 Aug 2004, Quentin Garnier wrote:
>
> > > Those escapes, which appeared in pkg_tarup 1.6, used with the exec
> > > call seem to be the problem. I don't know just what is being
> > > attempted there. Whoever did it, please explain and hopefully fix
> > > it.
> >
> > I can't reproduce the issue (and I don't find the escapes bogus
> > either). Can you send me the whole pkg_tarup script you have generated
> > so I can understand better what happens?
>
> I don't know if the escapes are truly bogus or not. I came to the
> conclusion that they were causing problems by inserting lines here and
> there to isolate where the crash occurred.
>
> I put the pkg_tarup script in question at
> http://www.cs.csubak.edu/~dgriffi/pkg_tarup.gz
Ok, I understand what happens. As a workaround, you can set your root
shell to a bourne one (sh, ksh).
--
Quentin Garnier - cube@NetBSD.org
The NetBSD Project - http://www.NetBSD.org/
From: Quentin Garnier <cube@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: pr/26551 CVS commit: pkgsrc/pkgtools/pkg_tarup
Date: Mon, 9 Aug 2004 21:13:37 +0000 (UTC)
Module Name: pkgsrc
Committed By: cube
Date: Mon Aug 9 21:13:37 UTC 2004
Modified Files:
pkgsrc/pkgtools/pkg_tarup: Makefile
pkgsrc/pkgtools/pkg_tarup/files: pkg_tarup
Log Message:
Gross hack to prevent quoting errors when root's shell is the unfamous csh.
Should hopefully fix PR 26551, but if anyone has a better solution, or is
willing to do the necessary work to allow pkg_tarup to be run by any user,
ideas are welcomed.
Say hi to version 1.6.2.
To generate a diff of this commit:
cvs rdiff -r1.21 -r1.22 pkgsrc/pkgtools/pkg_tarup/Makefile
cvs rdiff -r1.14 -r1.15 pkgsrc/pkgtools/pkg_tarup/files/pkg_tarup
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: cube
State-Changed-When: Mon Aug 9 21:15:07 UTC 2004
State-Changed-Why:
A fix was committed.
>Unformatted:
(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.