MIME-Version: 1.0
Content-Type: application/aegis-patch
Subject: aegis.4.23 - debian bug#393624: make test pass even when `make sure' is invoked by root.
Content-Name: aegis.4.23.C522.patch
Content-Disposition: attachment; filename=aegis.4.23.C522.patch
X-Aegis-Project-Name: aegis.4.23
X-Aegis-Change-Number: 522

#	
#	It is now possible to invoke `make sure' by root.  The etc/test.sh
#	execute the tests as nobody if invoked by root.
#	
#	My thanks to Lucas Nussbaum for reporting the problem.
#	
#	Signed-off-by: Walter Franzini <walter.franzini@gmail.org>
#	
# Aegis-Change-Set-Begin
# QlpoOTFBWSZTWdr/SAYAAIffgAAQWIf//0EnDI7/79/6QAG9KsqhFPImmmjQhk9I0AaDCADT
# QAaImVP0yYjVPaRpqaaNDQAA0GnihzAATAAEwAAAAAGmoBGmKE9Jpkek2oNAABtQ9Icw0EP4
# QP0gDnNjkHl293sPBRGC1KG75wy3ueyKs9Ya33QFnx5vs7A+lsDe3oVNIMAFYTgnCGKeiTve
# bAFOh+2Mno1AemWZjUzPJgeaRVaVb9ArlqhpFFInFFxT1a0CTZzHNGhUBkKzXB9Ir2VT3EcR
# I4Gla9QRNW1TD3kkG8AjYDCNJOjhJxIMTAWnHOLTj9hzRaMwMWz1dI585sRWxZZF0hfUAupK
# Y5Z4wi+Q6lyBRROt2QUGmVV2OgFCzXMUec2lvRoycFXTc7JpsKCKwuJPCEEV86EC0jq2dvXx
# HqXpvR00zvijDepugSxMdDBtU4OfPGE7sHjMMJBOaEhkzIxCSYqOYLTIq/+FTWbVwWlaFpwA
# XZldWQHwEAtFigfO6m7YTAFlbPCQsKa6q6K0CADgmg+Dqbi102sluDYrI1WjOYzWemTKgq11
# oaI0Y6MERhaLExg5CLQQHCqqI6m8BVqNIGmyI46AH4rE3iFiw5ObUixZyJC8nqIbaizPCkNH
# +LuSKcKEhtf6QDA=
# Aegis-Change-Set-End
#
Index: etc/test.sh
--- etc/test.sh
+++ etc/test.sh
@@ -1,8 +1,8 @@
 #!/bin/sh
 #
 #	aegis - project change supervisor
-#	Copyright (C) 1995, 1997 Peter Miller;
-#	All rights reserved.
+#	Copyright (C) 1995, 1997, 2006 Peter Miller
+#	Copyright (C) 2006 Walter Franzini
 #
 #	This program is free software; you can redistribute it and/or modify
 #	it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
 progname=$0
 shell=/bin/sh
 
+whoami=`id -u`
 
 usage() {
 	echo "usage: $progname -run test-file results-file" 1>&2
@@ -33,8 +34,14 @@
 
 
 run() {
-	$shell $1
-	echo $? > $2
+	if test "$whoami" = '0'
+	then
+		su nobody -c "$shell $1"
+		echo $? > $2
+	else
+		$shell $1
+		echo $? > $2
+        fi
 }
 
 
