From patchwork Mon Jul 4 18:20:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 103152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id EE969B6F6E for ; Tue, 5 Jul 2011 04:21:08 +1000 (EST) Received: (qmail 27215 invoked by alias); 4 Jul 2011 18:21:06 -0000 Received: (qmail 27207 invoked by uid 22791); 4 Jul 2011 18:21:06 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jul 2011 18:20:44 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id AABFC3EC; Mon, 4 Jul 2011 20:20:42 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kZOOeD317spT; Mon, 4 Jul 2011 20:20:41 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 0D78B3EB; Mon, 4 Jul 2011 20:20:40 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p64IKd8C001341; Mon, 4 Jul 2011 20:20:39 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Paolo Bonzini , Arnaud Charlet Subject: [testsuite, ada] Fix run_acats for shells without type -p Date: Mon, 04 Jul 2011 20:20:39 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org My last run_acats patch broke platforms where CONFIG_SHELL doesn't support type -p (like Solaris < 11 /bin/ksh): when using awk to extract the last output field, the exit code is from the last command in the pipe (always 0), not type, so the which function returns an empty string. This patch fixes this by decoupling type/type -p from extracting the last field. Bootstrapped on i386-pc-solaris2.10 and i386-pc-solaris2.11. Ok for mainline, 4.6 and 4.5 branches (where the offending patch has been installed)? Thanks. Rainer 2011-07-01 Rainer Orth * ada/acats/run_acats (which): Extract last field from type -p, type output only if command succeeded. diff --git a/gcc/testsuite/ada/acats/run_acats b/gcc/testsuite/ada/acats/run_acats --- a/gcc/testsuite/ada/acats/run_acats +++ b/gcc/testsuite/ada/acats/run_acats @@ -14,8 +14,8 @@ fi # Fall back to whence which ksh88 and ksh93 provide, but bash does not. which () { - path=`type -p $* 2>/dev/null | awk '{print $NF}'` && { echo $path; return 0; } - path=`type $* 2>/dev/null | awk '{print $NF}'` && { echo $path; return 0; } + path=`type -p $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; } + path=`type $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; } path=`whence $* 2>/dev/null` && { echo $path; return 0; } return 1 }