From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12837 invoked by alias); 5 Jul 2010 18:13:00 -0000 Received: (qmail 12825 invoked by uid 22791); 5 Jul 2010 18:12:59 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Jul 2010 18:12:53 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o65ICUPe031795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Jul 2010 14:12:30 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o65ICSgA029890 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Jul 2010 14:12:30 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o65ICS4m026916; Mon, 5 Jul 2010 20:12:28 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o65ICRwS026915; Mon, 5 Jul 2010 20:12:27 +0200 Date: Mon, 05 Jul 2010 18:13:00 -0000 From: Jan Kratochvil To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: ping: [patch 5/6] testsuite: Fix prelink-support.exp without prelink installed Message-ID: <20100705181227.GE26551@host0.dyn.jankratochvil.net> References: <20100329161831.GD2940@host0.dyn.jankratochvil.net> <20100609150954.GE7183@host0.dyn.jankratochvil.net> <20100629220904.GV2595@adacore.com> <20100704101842.GE6875@host0.dyn.jankratochvil.net> <20100705174015.GC2595@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100705174015.GC2595@adacore.com> User-Agent: Mutt/1.5.20 (2009-12-10) 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: 2010-07/txt/msg00089.txt.bz2 On Mon, 05 Jul 2010 19:40:15 +0200, Joel Brobecker wrote: > > Do you suggest /usr/sbin/prelink existence check, $PATH search (with > > explicitly appended `/usr/sbin') or the current error message check? > > I think it's fine to wait until we actually find a system where the > current approach is not working. So: OK... > OK to commit. Checked-in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2010-07/msg00028.html --- src/gdb/testsuite/ChangeLog 2010/07/05 18:01:53 1.2374 +++ src/gdb/testsuite/ChangeLog 2010/07/05 18:02:56 1.2375 @@ -1,6 +1,14 @@ 2010-07-05 Jan Kratochvil Joel Brobecker + Cope with missing /usr/sbin/prelink. + * lib/prelink-support.exp (prelink_no): + : New. + (prelink_yes): Likewise. Return on failed prelink_no. + +2010-07-05 Jan Kratochvil + Joel Brobecker + * gdb.base/attach-pie-misread.exp: Load prelink-support.exp. Replace build_executable by build_executable_own_libs. Replace "prelink -R" execution by a call of prelink_yes. Comment why "prelink -r" needs no --- src/gdb/testsuite/lib/prelink-support.exp 2010/07/05 18:01:53 1.1 +++ src/gdb/testsuite/lib/prelink-support.exp 2010/07/05 18:02:56 1.2 @@ -187,6 +187,30 @@ set result [catch $command output] verbose -log "result is $result" verbose -log "output is $output" + if {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} { + # Without prelink, at least verify that all the binaries do not + # contain the ".gnu.prelink_undo" section (which would mean that they + # have already been prelinked). + set test "$test (missing /usr/sbin/prelink)" + foreach bin [split $arg] { + if [string match "-*" $bin] { + # Skip prelink options. + continue + } + set readelf_program [transform readelf] + set command "exec $readelf_program -WS $bin" + verbose -log "command is $command" + set result [catch $command output] + verbose -log "result is $result" + verbose -log "output is $output" + if {$result != 0 || [string match {* .gnu.prelink_undo *} $output]} { + fail "$test ($bin is already prelinked)" + return 0 + } + } + pass $test + return 1 + } if {$result == 0 && $output == ""} { verbose -log "$name has been now unprelinked" set command "exec /usr/sbin/prelink -uN $arg" @@ -217,7 +241,9 @@ # Try to unprelink it first so that, if it has been already prelinked # before, we get a different address now, making the new result unaffected # by any previous prelinking. - prelink_no $arg "$name pre-unprelink" + if ![prelink_no $arg "$name pre-unprelink"] { + return 0 + } set test "prelink $name" @@ -239,6 +265,19 @@ set result [catch $command output] verbose -log "result is $result" verbose -log "output is $output" + if {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} { + set test "$test (missing /usr/sbin/prelink)" + + # We could not find prelink. We could check whether $args is already + # prelinked but we don't, because: + # - It is unlikely that someone uninstalls prelink after having + # prelinked the system ld.so; + # - We still cannot change its prelinked address. + # Therefore, we just skip the test. + + xfail $test + return 0 + } if {$result == 0 && $output == ""} { pass $test return 1