[comp.unix.wizards] Info on BRL shell

daveh@marob.MASA.COM (Dave Hammond) (09/08/88)

I have seen an increasing number of references to the BRL shell (brl-sh)
when lists of standard shells are bandied about.  Since Doug Gwyn has
mentioned it more than once, I assume that the BRL standards for
Ballistic Research Lab and that brl-sh is their /bin/sh with extensions.
My questions are 1) is brl-sh local to BRL, commercially available, or
public domain and 2) is it a complete shell program or just extensions
which require the site have source to /bin/sh (ala tcsh).

Dave Hammond
  UUCP: uunet!masa.com!{marob|dsix2}!daveh
DOMAIN: daveh@marob.masa.com
------------------------------------------------------------------------------

gwyn@smoke.ARPA (Doug Gwyn ) (09/09/88)

		BRL SVR2 Bourne shell description


BRL will supply, as part of its UNIX System V emulation for 4.nBSD
(or otherwise upon special arrangement), only to sites that supply
a copy of the identification pages of their AT&T UNIX System V
Release 2.0 or later source license in addition to a 1/2" magtape
with reusable mailer, a substantially overhauled SVR2 Bourne shell
that differs from the original version distributed with UNIX System
V Release 2.0 in the following ways:

If the super-user's $PS1 does not end in "# ", it is appended as a
safety reminder.

$IFS is no longer inherited from the environment.  There are a
couple of other attempts to improve shell script security also.

The hash -i option suppresses the error message that is normally
generated when hashing commands not found in the search path.

Many bugs have been fixed (but not all -- for example, function
arguments still overwrite the shell's argument list, and quoting
is not handled quite right).

I/O redirection via <> (read+write) now works.

A null field at the end of $PATH now works properly.

Memory management is no longer done via SIGSEGV trapping (unless
you choose to configure the shell that way -- but why would you?),
so signal 11 can now be trapped.

The shell (unless you otherwise configure it!) no longer attempts
to execute directories and other silly file types.

A variety of options can be configured by editing the Makefile.
The BRL SVR2 Bourne shell sources can serve for building shells
for vanilla System V, for 4.nBSD /bin/sh, for dual-universe
environments, in short to replace virtually any Bourne shell.

The name of the system profile (normally /etc/profile) is now
specified in the Makefile.

The "newgrp" or "login" command is built in depending on the
environment the shell is configured to operate in.

The SVR3 "getopts" command is provided; it was re-implemented
independently, not taken from SVR3-licensed sources.

The following System V features are now optional:
	$SHACCT shell accounting log file
	obsolete ^ synonym for | pipe symbol
	set -r, restricted shell "rsh"
	background processes automatically "niced"

The following options can be configured into any version:
	7th Edition UNIX echo -n option (standard for 4BSD) to
		suppress the trailing new-line
	8th Edition UNIX echo -e option (no-op for System V) to
		enable \ escape interpretation
	8th Edition UNIX "builtin" and "whatis" commands
	set -E to protect against accidental EOT logout
	set -H to enable command history, EMACS-like editing, and
		TENEX-like name completion; includes $HISTFILE
		command history log file
	set -S for "cd" spelling correction
	$ENV per-interactive-shell startup command file
	$PPID parent PID, non-modifiable
	$TIMEOUT to time out shell on lack of interactive input
	~user name substitution

On systems having proper support, the following are configurable:
	Pyramid's "att", "ucb", and "universe" commands and
		$UNIVERSE variable
	ulimit -cdmt options for additional 4BSD resource limits
	set -I to print resource usage at process termination
	set -J to enable job control; set -N for immediate
		job termination notification rather than at PS1;
		includes "jobs", "fg", and "bg" commands, etc.
	"pwd" compensation for symbolic links to directories

By exploiting many of the above features in combination, one can
set up a really slick working environment.  Several users of the
"Tenex Cshell" have switched to this one and claim to prefer it.

The manual entry has been overhauled and made more compatible with
the SVR3 description.  Descriptions of the new features were added,
of course.  Although the manual entry now describes proper quoting
behavior, the SVR2 shell problems with this have not been fixed.
If someone can supply fixes for them, or for the 7-bit character
orientation, I'll be glad to include them in a future release.

The sources have been made much more portable; many machine-
dependent assumptions have been removed.  The BRL SVR2 Bourne shell
is known to have worked successfully on the following systems:
	DEC VAX running 4.2BSD
	DEC VAX running 4.3BSD
	Gould PowerNode series running UTX-32 2.0
	Alliant FX/8 (presumably also FX/1) running Concentrix 2.0
	Alliant FX/8 (presumably also FX/1) running Concentrix 3.0
	BRL UNIX System V emulation for VAX, Gould, and Alliant
	Silicon Graphics Iris series 3000 running GL2-W3.5
	Silicon Graphics Iris series 4D running UNIX 3.2
	Cray X-MP/48 running UNICOS 2.1
	Cray X-MP/48 running UNICOS 3.0
	Cray-2 running UNICOS 3.0
Porting to another system should be simply a matter of editing the
Makefile appropriately, following instructions contained there.

The shell sources include a public-domain implementation of the
POSIX directory access routines for systems that don't already
have them.

The current state of the BRL SVR2 Bourne shell is the result of
considerable effort by many people around the world.  The
following are people I know of who have contributed:
	David Barto, Wes Chalfant, Jan Edler, Ed Frankenberry,
	Doug Gwyn, Guy Harris, Brian Horn, Doug Kingston, Richard
	Mathews, Bob Miles, der Mouse, Ron Natalie, Scott Rautmann,
	Arnold Robbins, Lou Salkind, Donn Seeley, Amos Shapir,
	David Sherman.
Various anonymous bug fixes and improvements from several vendors
have also been incorporated, and some of the features were
inspired by other shells.  Thanks are also due to BRL guinea pigs
who put up with trial versions that "almost" worked right.

People who have already requested either the shell or the whole
UNIX System V emulation package from me should receive their
copy in the mail soon.  Thanks for waiting patiently until the
shell was revamped!  Others can send their requests to:
	Douglas A. Gwyn
	U.S. Army Ballistic Research Laboratory
	SLCBR-VL-V
	Aberdeen Proving Ground, MD 21005-5066
	(301)278-6647
	Gwyn@BRL.MIL
Don't forget to include the license and remailable magtape.
(Send no money!  I cannot accept it, even to pay postage.)
Unfortunately, requests from outside the United States must be
routed via the appropriate U.S. Embassy.  (Alternatively, have
somebody in the U.S., who is willing to take responsibility for
complying with the relevant U.S. laws, act as your agent.)

Please do not ask for a manual entry or sources to be sent over
the net.  I also do not have time to respond to detailed
questions; the above description will have to suffice until you
get your copy of the shell.

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (09/21/88)

In article <8473@smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:

| If the super-user's $PS1 does not end in "# ", it is appended as a
| safety reminder.

God save me from people who assume that I'm so stupid that I don't know
how to set up a shell prompt, and who mess with my environment
variables. Is this what UNIX is coming to?

Please tell me that I'm not the only one who feels competent to decide
how I set my prompt, for root or anyone else.
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me

gwyn@smoke.ARPA (Doug Gwyn ) (09/21/88)

In article <12192@steinmetz.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes:
>In article <8473@smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>| If the super-user's $PS1 does not end in "# ", it is appended as a
>| safety reminder.
>God save me from people who assume that I'm so stupid that I don't know
>how to set up a shell prompt, and who mess with my environment variables.

That feature was in the BRL Bourne shell before I got here and they
insisted on leaving it in when I upgraded to a more recent base shell.
The default timeout for the super-user is also much less than for
normal users.  If one didn't have to become super-user very often,
this stuff wouldn't be necessary.  But it does come in handy for
improved system security; in our multi-window networked environment it
is easy to forget that one has a privileged window on some system,
unless there is some visible reminder.

The added-"# " feature is #ifdef BRL so you can avoid it if you don't
like it.  In fact non-BRL sites are advised to omit -DBRL from the
Makefile to disable all local "administrative policy" decisions built
into the shell.  The notes I posted should have said that the feature
is optional; I'll take your complaint as an action item for the notes.

roy@phri.UUCP (Roy Smith) (09/22/88)

davidsen@crdos1.UUCP (bill davidsen) writes:
> Please tell me that I'm not the only one who feels competent to decide
> how I set my prompt, for root or anyone else.

	Sorry Bill, but I agree that putting a '#' at the end of the
superuser prompt is A Good Thing.  I've often got a half dozen shells
running in different windows; it's nice to be reminded which of them has
been superuserized.  Besides, this is just a cosmetic thing; it's not
something that actually gets in the way of you doing work, like
gratutitiously sticking a carriage return at the end of a file or something
like that.
-- 
Roy Smith, System Administrator
Public Health Research Institute
{allegra,philabs,cmcl2,rutgers}!phri!roy -or- phri!roy@uunet.uu.net
"The connector is the network"

ado@elsie.UUCP (Arthur David Olson) (09/22/88)

> Please tell me that I'm not the only one who feels competent to decide
> how I set my prompt, for root or anyone else.

One problem is that the decision can't be made in a vacuum.  The manual
page for su(1) on our SunOS 4.0 system notes that
	To remind the super-user of his responsibilities,
	the shell substitutes `#' for '$' or '%' in its usual prompt.
If shells are set up to behave differently, the su(1) documentation becomes
incorrect.
-- 
	  The Canadian space program is into artificial catatonia.
	ado@ncifcrf.gov			ADO is a trademark of Ampex.

morrell@hpsal2.HP.COM (Michael Morrell) (09/23/88)

/ hpsal2:comp.unix.wizards / roy@phri.UUCP (Roy Smith) / 11:48 am  Sep 21, 1988 /
davidsen@crdos1.UUCP (bill davidsen) writes:
> Please tell me that I'm not the only one who feels competent to decide
> how I set my prompt, for root or anyone else.

	Sorry Bill, but I agree that putting a '#' at the end of the
superuser prompt is A Good Thing.  I've often got a half dozen shells
running in different windows; it's nice to be reminded which of them has
been superuserized.
----------

I agree totally with Bill.  All the superusers at my machine follow the "#"
convention, but it is VERY much against the UN*X philosophy for a shell to
enforce such a thing.  Besides, how does it actually do it?  Does it check PS1
before each prompt?  Sounds like a lot of overhead.

  Michael

carroll@s.cs.uiuc.edu (09/23/88)

RE: adding '#' to the end of the superuser's prompt

	I disagree. The shell shouldn't be changing your prompt. If the
root user isn't competent enough to set that up himself, he shouldn't
have a root login. For instance, my normal prompt contains the word
'Sir' in it - when I'm root, it is 'SIR' in bold/inverse letters.
I'm sure that others have equivalent tricks. However, I'd say that it's
really a non-problem if it can be turned off by a compile time flag.

Alan M. Carroll		                      carroll@s.cs.uiuc.edu
Grad Student / U of Ill - Urbana ...{pur-ee,convex}!uiucdcs!s!carroll
"Too many fools who don't think twice, too many ways to pay the price" - AP&EW

jfh@rpp386.Dallas.TX.US (The Beach Bum) (09/24/88)

hpsal2:comp.unix.wizards / roy@phri.UUCP (Roy Smith) / 11:48 am  Sep 21, 1988 /
>davidsen@crdos1.UUCP (bill davidsen) writes:
>> Please tell me that I'm not the only one who feels competent to decide
>> how I set my prompt, for root or anyone else.
>
>	Sorry Bill, but I agree that putting a '#' at the end of the
>superuser prompt is A Good Thing.  I've often got a half dozen shells
>running in different windows; it's nice to be reminded which of them has
>been superuserized.

there are many ways to have your prompt indicate you are root.  here is
my C shell .cshrc approximation:

setenv LOGNAME `id | sed -e 's/[^(]*(\([^)]*\).*/\1/'`
setenv NAME 'The Beach Bum'
setenv ORGANIZATION 'HASA, "S" Division'
if ( $LOGNAME != root ) then
	set prompt="\! - `uuname -l`-> "
else
	set prompt="\! - #`uuname -l`-> "
endif

i like the -> on the end because it is very recognizable to me.  and the
'#' is there as well.  i can tell if i am in a login shell by pressing
^D and seeing what i am supposed to do to "exit" or "logout" of the current
C shell [ i run with ignoreeof set ]
-- 
John F. Haugh II (jfh@rpp386.Dallas.TX.US)                   HASA, "S" Division

      "Why waste negative entropy on comments, when you could use the same
                   entropy to create bugs instead?" -- Steve Elias

cmf@cisunx.UUCP (Carl M. Fongheiser) (09/24/88)

In article <8137@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes:
>One problem is that the decision can't be made in a vacuum.  The manual
>page for su(1) on our SunOS 4.0 system notes that
>	To remind the super-user of his responsibilities,
>	the shell substitutes `#' for '$' or '%' in its usual prompt.
>If shells are set up to behave differently, the su(1) documentation becomes
>incorrect.

For that matter, the 7th edition man page for su(1) has a similar statement.
How about the System V man pages?

				Carl Fongheiser
				University of Pittsburgh
				...!pitt!cisunx!cmf
				cmf@unix.cis.pittsburgh.edu
				cmf@pittunix.BITNET

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (09/27/88)

In article <14670005@hpsal2.HP.COM> morrell@hpsal2.HP.COM (Michael Morrell) writes:

| 	Sorry Bill, but I agree that putting a '#' at the end of the
| superuser prompt is A Good Thing.  I've often got a half dozen shells
| running in different windows; it's nice to be reminded which of them has
| been superuserized.

  The people who have superuser access hopefully are smart enough to be
able to handle reminding themselves without having a shell decide how
they should do it. I personally run a prompt which is in color and use a
special ugly color for root. Others do things like placing the current
machine and directory name in italics, etc.

  People who can't remind themselves shouldn't be playing in root. As
noted elsewhere, using su sets the prompt rather than hanging stuff on
it, and does it only once, before going interactive. Thus, if I do
	su -
to execute my profile, it can be reset by the profile to what I want.

  On the topic of protecting yourself, I have a number of logins for
other system maintenence, which run using the minimum set of access. a
'uumaint' for uucp, 'local' for the local commands partition, 'lpmaint',
etc. This allows many things to be done without using root (obviously
not all).
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me