From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16499 invoked by alias); 8 Dec 2007 19:13:29 -0000 Received: (qmail 16490 invoked by uid 22791); 8 Dec 2007 19:13:28 -0000 X-Spam-Check-By: sourceware.org Received: from pauline.vellum.cz (HELO pauline.vellum.cz) (89.250.243.234) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 08 Dec 2007 19:13:23 +0000 Received: from host0.dyn.jankratochvil.net (localhost.localdomain [127.0.0.1]) by pauline.vellum.cz (8.12.11.20060308/8.12.11) with ESMTP id lB8JDKZV008856; Sat, 8 Dec 2007 20:13:21 +0100 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.2/8.14.1) with ESMTP id lB8JDKxC011403; Sat, 8 Dec 2007 20:13:20 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.2/8.14.2/Submit) id lB8JDKwl011402; Sat, 8 Dec 2007 20:13:20 +0100 Date: Sun, 09 Dec 2007 01:19:00 -0000 From: Jan Kratochvil To: Mark Kettenis Cc: gdb-patches@sourceware.org Subject: Re: [patch] fileio.exp FAILs if run as root Message-ID: <20071208191320.GA11395@host0.dyn.jankratochvil.net> References: <20071208181422.GA10275@host0.dyn.jankratochvil.net> <200712081858.lB8Iw5pn014666@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="FL5UXtIhxfXey3p5" Content-Disposition: inline In-Reply-To: <200712081858.lB8Iw5pn014666@brahms.sibelius.xs4all.nl> User-Agent: Mutt/1.5.17 (2007-11-01) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00138.txt.bz2 --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 692 On Sat, 08 Dec 2007 19:58:05 +0100, Mark Kettenis wrote: > > Date: Sat, 8 Dec 2007 19:14:22 +0100 > > From: Jan Kratochvil > > > > Hi, > > > > if you run gdb.base/fileio.exp as UID 0 it will print: > > FAIL: gdb.base/fileio.exp: Open for write but no write permission returns EACCES > > FAIL: gdb.base/fileio.exp: Unlinking a file in a directory w/o write access returns EACCES > > People running the testsuite as root deserve what they get. I don't > think we should complicate our code to make that possible, especially > if it involves calling setuid() which is notoriously unportable. OK, this is the other possibility I was considering. Regards, Jan --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="gdb-run-root.patch" Content-length: 500 2007-12-08 Jan Kratochvil * lib/gdb.exp: Refuse to run as root. --- ./gdb/testsuite/lib/gdb.exp 30 Oct 2007 19:23:18 -0000 1.92 +++ ./gdb/testsuite/lib/gdb.exp 8 Dec 2007 19:12:00 -0000 @@ -26,6 +26,14 @@ if {$tool == ""} { exit 2 } +set uidfile [open "|id -u" r]; +gets $uidfile uid +catch {close $uidfile} +if {$uid == 0} { + send_error "Root privileges give false results, run as a regular user!\n" + exit 2 +} + load_lib libgloss.exp global GDB --FL5UXtIhxfXey3p5--