Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] fileio.exp FAILs if run as root
Date: Sun, 09 Dec 2007 01:19:00 -0000	[thread overview]
Message-ID: <20071208191320.GA11395@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <200712081858.lB8Iw5pn014666@brahms.sibelius.xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

On Sat, 08 Dec 2007 19:58:05 +0100, Mark Kettenis wrote:
> > Date: Sat, 8 Dec 2007 19:14:22 +0100
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > 
> > 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

[-- Attachment #2: gdb-run-root.patch --]
[-- Type: text/plain, Size: 500 bytes --]

2007-12-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* 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

  reply	other threads:[~2007-12-08 19:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-08 18:58 Jan Kratochvil
2007-12-08 19:13 ` Mark Kettenis
2007-12-09  1:19   ` Jan Kratochvil [this message]
2007-12-11 17:46     ` Michael Snyder
2007-12-11 17:54       ` Jan Kratochvil
2007-12-11 18:38         ` Daniel Jacobowitz
2007-12-12 16:26           ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071208191320.GA11395@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox