* check.t: add two mkshrc-tests (turn on, turn off)

* check.pl, check.t: add mkshrc-test whether "real" $HOME/.mkshrc interfers
* mksh.1: sync with reality: $ENV unset isn't needed, $ENV='' is enough
  to turn on ~/.mkshrc processing
This commit is contained in:
tg 2006-05-08 11:59:41 +00:00
parent c4ef5b801a
commit b0eb8f5b5e
3 changed files with 40 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl
# $MirOS: src/bin/mksh/check.pl,v 1.7 2005/07/07 23:27:52 tg Exp $
# $MirOS: src/bin/mksh/check.pl,v 1.8 2006/05/08 11:59:41 tg Exp $
# $OpenBSD: th,v 1.12 2005/05/28 04:53:47 millert Exp $
#-
# Example test:
@ -56,6 +56,7 @@
# USER, LOGNAME, HOME, PATH, SHELL
# (values taken from the environment of
# the test harness).
# ENV is set to /nonexistant.
# file-setup mps Used to create files, directories
# and symlinks. First word is either
# file, dir or symlink; second word is
@ -232,6 +233,7 @@ $all_tests = @ARGV == 0;
foreach $env (('USER', 'LOGNAME', 'HOME', 'PATH', 'SHELL')) {
$new_env{$env} = $ENV{$env} if defined $ENV{$env};
}
$new_env{'ENV'} = '/nonexistant';
if (defined $opt_e) {
# XXX need a way to allow many -e arguments...
if ($opt_e =~ /^([a-zA-Z_]\w*)(|=(.*))$/) {

35
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.38 2006/05/08 11:42:36 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.39 2006/05/08 11:59:41 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -3729,6 +3729,39 @@ expected-stdout:
ja
expected-stderr-pattern: !/unexpected op/
---
name: mkshrc-1
description:
Check that ~/.mkshrc works correctly.
Part 1: verify user environment is not read (internal)
stdin:
echo x $FNORD
expected-stdout:
x
---
name: mkshrc-2
description:
Check that ~/.mkshrc works correctly.
Part 2: verify mkshrc can be read
file-setup: file 644 ".mkshrc"
FNORD=42
env-setup: !HOME=.!ENV=!
stdin:
echo x $FNORD
expected-stdout:
x 42
---
name: mkshrc-3
description:
Check that ~/.mkshrc works correctly.
Part 3: verify mkshrc can be turned off
file-setup: file 644 ".mkshrc"
FNORD=42
env-setup: !HOME=.!ENV=nonexistant!
stdin:
echo x $FNORD
expected-stdout:
x
---
name: version-1
description:
Check version of shell.

6
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.31 2006/05/08 11:42:36 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.32 2006/05/08 11:59:41 tg Exp $
.\" $OpenBSD: ksh.1,v 1.109 2005/12/06 20:40:02 jmc Exp $
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
.\"
@ -187,7 +187,7 @@ substitution and the resulting file
(if any) is read and executed.
If the
.Ev ENV
variable is unset, the file
variable is unset or empty, the file
.Pa $HOME/.mkshrc
is read and processed like above instead, leaving
.Ev ENV
@ -5137,7 +5137,7 @@ deleted and a new prompt to be printed.
User's startup script.
Used only if
.Ev ENV
is unset.
is unset or empty.
.It Pa ~/.profile
User's login profile.
.It Pa /etc/profile