From 569cf64ff198e8e80bd711e457dd0291ab49cb57 Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 21 Jun 2006 19:27:35 +0000 Subject: [PATCH] * process ~/.mksrc only if FTALKING (i.e. interactive shell) From: hondza * document that in the manual page myself * add regression test for that myself --- check.t | 21 +++++++++++++++++---- main.c | 6 +++--- mksh.1 | 10 +++++----- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/check.t b/check.t index 10868c4..061062c 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.42 2006/05/27 11:36:50 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.43 2006/06/21 19:27:35 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 $ @@ -3738,13 +3738,26 @@ stdin: expected-stdout: x --- -name: mkshrc-2 +name: mkshrc-2a description: Check that ~/.mkshrc works correctly. - Part 2: verify mkshrc can be read + Part 2: verify mkshrc is not read (non-interactive shells) file-setup: file 644 ".mkshrc" FNORD=42 env-setup: !HOME=.!ENV=! +stdin: + echo x $FNORD +expected-stdout: + x +--- +name: mkshrc-2b +description: + Check that ~/.mkshrc works correctly. + Part 2: verify mkshrc can be read (interactive shells) +file-setup: file 644 ".mkshrc" + FNORD=42 +arguments: !-i! +env-setup: !HOME=.!ENV=!PS1=! stdin: echo x $FNORD expected-stdout: @@ -3769,5 +3782,5 @@ category: pdksh stdin: echo $KSH_VERSION expected-stdout: - @(#)MIRBSD KSH R27 2006/05/26 + @(#)MIRBSD KSH R27 2006/06/21 --- diff --git a/main.c b/main.c index aed488a..1f92200 100644 --- a/main.c +++ b/main.c @@ -6,9 +6,9 @@ #define EXTERN /* define EXTERNs in sh.h */ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.38 2006/05/26 23:36:19 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.39 2006/06/21 19:27:35 tg Exp $"); -#define MKSH_VERSION "@(#)MIRBSD KSH R27 2006/05/26" +#define MKSH_VERSION "@(#)MIRBSD KSH R27 2006/06/21" extern char **environ; @@ -294,7 +294,7 @@ main(int argc, char *argv[]) } if (Flag(FPRIVILEGED)) include("/etc/suid_profile", 0, NULL, 1); - else { + else if (Flag(FTALKING)) { char *env_file; /* include $ENV */ diff --git a/mksh.1 b/mksh.1 index 76ace13..931ea59 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,4 +1,4 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.35 2006/05/10 19:30:33 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.36 2006/06/21 19:27:35 tg Exp $ .\" $OpenBSD: ksh.1,v 1.112 2006/04/22 14:10:36 jmc Exp $ .\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $ .\" @@ -179,9 +179,9 @@ otherwise, the basename the shell was called with (i.e. argv[0]) is used. .Pp If the .Ev ENV -parameter is set when the shell starts (or, in the case of login shells, -after any profiles are processed), its value is subjected to parameter, -command, arithmetic, and tilde +parameter is set when an interactive shell starts (or, in the case of login +shells, after any profiles are processed), its value is subjected to +parameter, command, arithmetic, and tilde .Pq Sq ~ substitution and the resulting file (if any) is read and executed. @@ -5154,7 +5154,7 @@ deleted and a new prompt to be printed. .Sh FILES .Bl -tag -width "/etc/suid_profileXX" -compact .It Pa ~/.mkshrc -User's startup script. +User's startup script (interactive shells). Used only if .Ev ENV is unset or empty.