From 334ed65e2765062a449897d70925255929eae8a8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 2 Dec 2016 12:08:26 +0000 Subject: 40068: Abort execution when setuid/setgid fail. The incumbent code would print an error message and continue execution with the previous uid/gid values, not even setting lastval: % UID=42 id -u; echo $? zsh: failed to change user ID: operation not permitted 1000 0 % --- Test/B02typeset.ztst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Test') diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst index 6d85a63fe..9c56c7e5e 100644 --- a/Test/B02typeset.ztst +++ b/Test/B02typeset.ztst @@ -711,3 +711,13 @@ typeset isreadonly=still 1:typeset returns status 1 if setting readonly variable ?(eval):2: read-only variable: isreadonly + + if (( UID )); then + UID=$((UID+1)) date; echo "Status is printed, $?" + else + ZTST_skip="cannot test setuid error when tests run as superuser" + fi +0:when cannot change UID, the command isn't run +# 'date' did not run. +>Status is printed, 1 +?(eval):2: failed to change user ID: operation not permitted -- cgit 1.4.1