NetBSD Problem Report #27162
Received: (qmail 15612 invoked by uid 605); 6 Oct 2004 12:21:29 -0000
Message-Id: <20041006122127.A36272521C6@narn.netbsd.org>
Date: Wed, 6 Oct 2004 12:21:27 +0000 (UTC)
From: gavan@coolfactor.org
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: gavan@coolfactor.org
To: gnats-bugs@gnats.NetBSD.org
Subject: pkgsrc creates an inadequate /etc/shells if it doesn't already exist.
X-Send-Pr-Version: www-1.0
>Number: 27162
>Category: pkg
>Synopsis: pkgsrc creates an inadequate /etc/shells if it doesn't already exist.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 06 12:22:00 +0000 2004
>Closed-Date: Tue Sep 20 04:25:52 +0000 2005
>Last-Modified: Tue Sep 20 04:25:52 +0000 2005
>Originator: Gavan Fantom
>Release: Solaris 10
>Organization:
>Environment:
SunOS yellow-30 5.10 s10_68 sun4u sparc SUNW,Ultra-60
>Description:
Installing a shell from pkgsrc on a system which doesn't already have an /etc/shells file causes one to be created, containing only the shell being installed from pkgsrc. On Solaris, dtlogin looks at /etc/shells and prevents users of shells not in it from logging in.
If no /etc/shells is present, a default list of shells is assumed. On NetBSD this consists of /bin/sh and /bin/csh. On Solaris this includes:
/bin/bash /bin/csh
/bin/jsh /bin/ksh
/bin/pfcsh /bin/pfksh
/bin/pfsh /bin/sh
/bin/tcsh /bin/zsh
/sbin/jsh /sbin/pfsh
/sbin/sh /usr/bin/bash
/usr/bin/csh /usr/bin/jsh
/usr/bin/ksh /usr/bin/pfcsh
/usr/bin/pfksh /usr/bin/pfsh
/usr/bin/sh /usr/bin/tcsh
/usr/bin/zsh /usr/xpg4/bin/sh
As NetBSD ships with an /etc/shells by default, this doesn't really bite NetBSD users. However, should an administrator decide to delete /etc/shells, this would still bite. The impact on Solaris is much greater, as the default list includes many more shells, and Solaris doesn't ship with /etc/shells by default.
>How-To-Repeat:
Install a shell from pkgsrc on a system without /etc/shells. Observe being able to log in beforehand, but not afterwards. Observe /etc/shells file containing only one entry.
>Fix:
An ideal fix would be to read the shell list from somewhere and create an /etc/shells file that matches the default.
>Release-Note:
>Audit-Trail:
From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gavan@coolfactor.org
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/27162: pkgsrc creates an inadequate /etc/shells if it doesn't
already exist.
Date: Thu, 7 Oct 2004 18:04:23 -0700 (PDT)
Can you bring up your situations and any ideas on the tech-pkg list in
regards to your PR#27162 ?
Thank you,
Jeremy C. Reed
technical support & remote administration
http://www.pugetsoundtechnology.com/
From: Gavan Fantom <gavan@coolfactor.org>
To: tech-pkg@netbsd.org
Cc: gnats-bugs@gnats.NetBSD.org
Subject: pkg/27162: pkgsrc creates an inadequate /etc/shells if it doesn't
already exist.
Date: Fri, 8 Oct 2004 12:51:08 +0100 (BST)
Hi folks,
I'm looking for ideas on how best to deal with /etc/shells if it doesn't
already exist. (See PR pkg/27162) What we do currently is to create a new
/etc/shells containing just the shell being installed.
This causes problems on any systems which don't have a default
/etc/shells, and where the administrater has not created one. NetBSD
ships with a default /etc/shells, but other systems, such as Solaris, do
not.
In the absence of /etc/shells, a system will typically behave as if a
default set of shells were listed. This default set of shells is provided
by the getusershell(3) function.
There are some obvious possibilities here:
* Stick with the status quo. This bites on Solaris, where installing any
shell from pkgsrc will cause all users to be denied login by dtlogin.
* Not update /etc/shells if it's not present. This is easy to do, but
leaves users of the shells installed from pkgsrc unable to log in without
intervention from the administrator.
* Write a C program to use getusershell(3) to iterate the default set and
generate a "default" /etc/shells on demand if it is not present. This
would be a pain from a package's install script, and so would probably
require a separate package as a dependency.
* Extract the default list by other means, such as parsing the
getusershell(3) manpage (ugh!)
I think the third option is probably the best so far, but I worry about
what happens in a NIS environment where getusershells(3) could go off and
retrieve a remote database. Do we need to worry about this scenario? Does
it even make sense to try to DTRT here?
Does anybody have any better suggestions, or any pros/cons/votes for any
of the above possibilities?
--
Gillette - the best a man can forget
From: "Johnny C. Lam" <jlam@NetBSD.org>
To: Gavan Fantom <gavan@coolfactor.org>
Cc: tech-pkg@netbsd.org, gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/27162: pkgsrc creates an inadequate /etc/shells if it doesn't already exist.
Date: Fri, 8 Oct 2004 13:43:45 +0000
On Fri, Oct 08, 2004 at 12:51:08PM +0100, Gavan Fantom wrote:
>
> There are some obvious possibilities here:
>
> * Stick with the status quo. This bites on Solaris, where installing any
> shell from pkgsrc will cause all users to be denied login by dtlogin.
>
> * Not update /etc/shells if it's not present. This is easy to do, but
> leaves users of the shells installed from pkgsrc unable to log in without
> intervention from the administrator.
>
> * Write a C program to use getusershell(3) to iterate the default set and
> generate a "default" /etc/shells on demand if it is not present. This
> would be a pain from a package's install script, and so would probably
> require a separate package as a dependency.
>
> * Extract the default list by other means, such as parsing the
> getusershell(3) manpage (ugh!)
>
> I think the third option is probably the best so far, but I worry about
> what happens in a NIS environment where getusershells(3) could go off and
> retrieve a remote database. Do we need to worry about this scenario? Does
> it even make sense to try to DTRT here?
>
> Does anybody have any better suggestions, or any pros/cons/votes for any
> of the above possibilities?
Make it part of the bootstrap process to generate a /etc/shells using
one of the techniques you described above. This hides away the complexity
in a single step and avoids needing all this extra knowledge in pkgsrc.
Cheers,
-- Johnny Lam <jlam@NetBSD.org>
From: Gavan Fantom <gavan@coolfactor.org>
To: "Johnny C. Lam" <jlam@NetBSD.org>
Cc: tech-pkg@netbsd.org, gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/27162: pkgsrc creates an inadequate /etc/shells if it doesn't
already exist.
Date: Fri, 8 Oct 2004 14:44:37 +0100 (BST)
On Fri, 8 Oct 2004, Johnny C. Lam wrote:
> Make it part of the bootstrap process to generate a /etc/shells using
> one of the techniques you described above. This hides away the complexity
> in a single step and avoids needing all this extra knowledge in pkgsrc.
Nice idea. Does that work for users installing pre-built binary bootstrap
kits, and using only binary packages, though?
--
Gillette - the best a man can forget
From: "Johnny C. Lam" <jlam@NetBSD.org>
To: Gavan Fantom <gavan@coolfactor.org>
Cc: tech-pkg@netbsd.org, gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/27162: pkgsrc creates an inadequate /etc/shells if it doesn't already exist.
Date: Fri, 8 Oct 2004 14:11:42 +0000
On Fri, Oct 08, 2004 at 02:44:37PM +0100, Gavan Fantom wrote:
> On Fri, 8 Oct 2004, Johnny C. Lam wrote:
>
> >Make it part of the bootstrap process to generate a /etc/shells using
> >one of the techniques you described above. This hides away the complexity
> >in a single step and avoids needing all this extra knowledge in pkgsrc.
>
> Nice idea. Does that work for users installing pre-built binary bootstrap
> kits, and using only binary packages, though?
Yes, it should because presumably, this script/program to generate
/etc/shells is standalone and can be run either automatically, or there
should be a README file that tells the user to do that. Pre-built
binary bootstrap kits are still just to bootstrap, so if there are
additional steps that need to be taken other than simply extracting a
tarball to prepare your system for pkgsrc, it shouldn't be a big deal
for the user to follow those instructions.
Cheers,
-- Johnny Lam <jlam@NetBSD.org>
From: Alistair Crooks <agc@pkgsrc.org>
To: Gavan Fantom <gavan@coolfactor.org>
Cc: tech-pkg@NetBSD.org, gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/27162: pkgsrc creates an inadequate /etc/shells if it doesn't already exist.
Date: Fri, 8 Oct 2004 16:05:06 +0100
On Fri, Oct 08, 2004 at 12:51:08PM +0100, Gavan Fantom wrote:
> I think the third option is probably the best so far, but I worry about
> what happens in a NIS environment where getusershells(3) could go off and
> retrieve a remote database. Do we need to worry about this scenario? Does
> it even make sense to try to DTRT here?
>
> Does anybody have any better suggestions, or any pros/cons/votes for any
> of the above possibilities?
In a "credit where credit's due" frame of mind, I'd suggest that the
problem lies in Solaris itself - they are the ones who ship with no
/etc/shells file, thereby allowing every shell as a default - so the
problem should be fixed at source.
Until that's done, it's fairly obvious that we need to provide a
workaround, and Johnny's method is best, I think - have this as
part of the platform-dependent stuff in bootstrap.
But on to the point of my mail
1. are there any other platforms where this is a problem, too, though?
2. are there any other files which we need to provide to shore up
leaky operating system default installations?
Thanks,
Alistair
From: "Jeremy C. Reed" <reed@reedmedia.net>
To: Gavan Fantom <gavan@coolfactor.org>
Cc: tech-pkg@netbsd.org, <gnats-bugs@gnats.NetBSD.org>
Subject: Re: pkg/27162: pkgsrc creates an inadequate /etc/shells if it doesn't
already exist.
Date: Fri, 8 Oct 2004 09:28:44 -0700 (PDT)
On Fri, 8 Oct 2004, Gavan Fantom wrote:
> * Not update /etc/shells if it's not present. This is easy to do, but
> leaves users of the shells installed from pkgsrc unable to log in without
> intervention from the administrator.
I think this is the correct method. We should have some option to say if
it is okay to create the shells file or not. (Under Linux, the packages
create my /etc/shells file for me and it is fine.)
Also make sure that that it is noted clearly so the administrator knows.
(Would be good to get +INSTALL output part of the +DISPLAY which can
also be emailed.)
Jeremy C. Reed
BSD News, BSD tutorials, BSD links
http://www.bsdnewsletter.com/
From: "Johnny C. Lam" <jlam@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/27162 CVS commit: pkgsrc
Date: Tue, 20 Sep 2005 04:23:49 +0000 (UTC)
Module Name: pkgsrc
Committed By: jlam
Date: Tue Sep 20 04:23:49 UTC 2005
Modified Files:
pkgsrc/misc/screen: Makefile
pkgsrc/mk/install: shell
pkgsrc/shells/ast-ksh: Makefile
pkgsrc/shells/bash: Makefile
pkgsrc/shells/bash2: Makefile
pkgsrc/shells/es: Makefile
pkgsrc/shells/esh: Makefile
pkgsrc/shells/osh: Makefile
pkgsrc/shells/pdksh: Makefile
pkgsrc/shells/perlsh: Makefile
pkgsrc/shells/posh: Makefile
pkgsrc/shells/rc: Makefile
pkgsrc/shells/rssh: Makefile
pkgsrc/shells/scponly: Makefile
pkgsrc/shells/scsh: Makefile
pkgsrc/shells/static-ast-ksh: Makefile
pkgsrc/shells/tcsh: Makefile
pkgsrc/shells/xsh: Makefile
pkgsrc/shells/zsh: Makefile
pkgsrc/shells/zsh3: Makefile
Log Message:
Teach the +SHELLS helper script to not create an /etc/shells file if
one doesn't exist. From now on, we only add the listed PKG_SHELL to
the /etc/shells file if it already exists. This fixes PR pkg/27162.
To generate a diff of this commit:
cvs rdiff -r1.59 -r1.60 pkgsrc/misc/screen/Makefile
cvs rdiff -r1.3 -r1.4 pkgsrc/mk/install/shell
cvs rdiff -r1.11 -r1.12 pkgsrc/shells/ast-ksh/Makefile
cvs rdiff -r1.11 -r1.12 pkgsrc/shells/bash/Makefile
cvs rdiff -r1.65 -r1.66 pkgsrc/shells/bash2/Makefile
cvs rdiff -r1.15 -r1.16 pkgsrc/shells/es/Makefile
cvs rdiff -r1.20 -r1.21 pkgsrc/shells/esh/Makefile
cvs rdiff -r1.12 -r1.13 pkgsrc/shells/osh/Makefile
cvs rdiff -r1.9 -r1.10 pkgsrc/shells/pdksh/Makefile
cvs rdiff -r1.11 -r1.12 pkgsrc/shells/perlsh/Makefile
cvs rdiff -r1.5 -r1.6 pkgsrc/shells/posh/Makefile
cvs rdiff -r1.18 -r1.19 pkgsrc/shells/rc/Makefile
cvs rdiff -r1.2 -r1.3 pkgsrc/shells/rssh/Makefile
cvs rdiff -r1.5 -r1.6 pkgsrc/shells/scponly/Makefile
cvs rdiff -r1.31 -r1.32 pkgsrc/shells/scsh/Makefile
cvs rdiff -r1.4 -r1.5 pkgsrc/shells/static-ast-ksh/Makefile
cvs rdiff -r1.51 -r1.52 pkgsrc/shells/tcsh/Makefile
cvs rdiff -r1.7 -r1.8 pkgsrc/shells/xsh/Makefile
cvs rdiff -r1.48 -r1.49 pkgsrc/shells/zsh/Makefile
cvs rdiff -r1.14 -r1.15 pkgsrc/shells/zsh3/Makefile
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: jlam@netbsd.org
State-Changed-When: Tue, 20 Sep 2005 04:25:52 +0000
State-Changed-Why:
I've implemented the solution where we don't create /etc/shells if it doesn't
already exist. Others are free to continue to pursue the other outlined
solutions as they are orthogonal to my changes.
>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.