diff options
author | jilles <jilles@FreeBSD.org> | 2010-02-06 22:57:24 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-02-06 22:57:24 +0000 |
commit | 9c81a24436f4b19434a1d75bf5b592a13ad156c2 (patch) | |
tree | 9e9308576f99844cd3f9846a35a80d74607e5c0a /tools/regression | |
parent | 6d3ec806895e807566f3ba15226c51fc15c5e7a5 (diff) | |
download | FreeBSD-src-9c81a24436f4b19434a1d75bf5b592a13ad156c2.zip FreeBSD-src-9c81a24436f4b19434a1d75bf5b592a13ad156c2.tar.gz |
sh: Do not stat() $MAIL/$MAILPATH in non-interactive shells.
These may be NFS mounted, and we should not touch them unless we are going
to do something useful with the information.
Diffstat (limited to 'tools/regression')
-rw-r--r-- | tools/regression/bin/sh/parameters/mail1.0 | 15 | ||||
-rw-r--r-- | tools/regression/bin/sh/parameters/mail2.0 | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/parameters/mail1.0 b/tools/regression/bin/sh/parameters/mail1.0 new file mode 100644 index 0000000..26308ea --- /dev/null +++ b/tools/regression/bin/sh/parameters/mail1.0 @@ -0,0 +1,15 @@ +# $FreeBSD$ +# Test that a non-interactive shell does not access $MAIL. + +goodfile=/var/empty/sh-test-goodfile +mailfile=/var/empty/sh-test-mailfile +T=$(mktemp sh-test.XXXXXX) || exit +MAIL=$mailfile ktrace -i -f "$T" sh -c "[ -s $goodfile ]" 2>/dev/null +if ! grep -q $goodfile "$T"; then + # ktrace problem + rc=0 +elif ! grep -q $mailfile "$T"; then + rc=0 +fi +rm "$T" +exit ${rc:-3} diff --git a/tools/regression/bin/sh/parameters/mail2.0 b/tools/regression/bin/sh/parameters/mail2.0 new file mode 100644 index 0000000..4f14849 --- /dev/null +++ b/tools/regression/bin/sh/parameters/mail2.0 @@ -0,0 +1,15 @@ +# $FreeBSD$ +# Test that an interactive shell accesses $MAIL. + +goodfile=/var/empty/sh-test-goodfile +mailfile=/var/empty/sh-test-mailfile +T=$(mktemp sh-test.XXXXXX) || exit +MAIL=$mailfile ktrace -i -f "$T" sh +m -i </dev/null >/dev/null 2>&1 +if ! grep -q $goodfile "$T"; then + # ktrace problem + rc=0 +elif grep -q $mailfile "$T"; then + rc=0 +fi +rm "$T" +exit ${rc:-3} |