From 498fbe203b4ea6e5a4f736a606482881ff30e2aa Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Jan 26 2010 18:34:23 +0000 Subject: Emit explicit error message if user tries to build RPM as root --- diff --git a/mysql.spec b/mysql.spec index b0606cd..a390a5f 100644 --- a/mysql.spec +++ b/mysql.spec @@ -1,6 +1,6 @@ Name: mysql Version: 5.1.42 -Release: 5%{?dist} +Release: 6%{?dist} Summary: MySQL client programs and shared libraries Group: Applications/Databases URL: http://www.mysql.com @@ -189,6 +189,17 @@ autoconf autoheader %build + +# fail quickly and obviously if user tries to build as root +%if %runselftest + if [ x"`id -u`" = x0 ]; then + echo "mysql's regression tests fail if run as root." + echo "If you really need to build the RPM as root, use" + echo "--define='runselftest 0' to skip the regression tests." + exit 1 + fi +%endif + CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" # MySQL 4.1.10 definitely doesn't work under strict aliasing; also, # gcc 4.1 breaks MySQL 5.0.16 without -fwrapv @@ -655,6 +666,10 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Tue Jan 26 2010 Tom Lane 5.1.42-6 +- Emit explicit error message if user tries to build RPM as root +Related: #558915 + * Wed Jan 20 2010 Tom Lane 5.1.42-5 - Correct Source0: tag and comment to reflect how to get the tarball