From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46116 invoked by alias); 24 Jul 2015 19:08:04 -0000 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 Received: (qmail 46106 invoked by uid 89); 24 Jul 2015 19:08:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 24 Jul 2015 19:08:02 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id C4A3791DCD; Fri, 24 Jul 2015 19:08:01 +0000 (UTC) Received: from localhost (unused-10-15-17-51.yyz.redhat.com [10.15.17.51]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6OJ81Kk020229 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 24 Jul 2015 15:08:01 -0400 From: Sergio Durigan Junior To: Luis Machado Cc: GDB Patches Subject: Re: [PATCH] Make sure GDB uses a valid shell when starting the inferior and to perform the "shell" command References: <1437761993-18758-1-git-send-email-sergiodj@redhat.com> <55B28758.8050305@codesourcery.com> X-URL: http://blog.sergiodj.net Date: Fri, 24 Jul 2015 19:08:00 -0000 In-Reply-To: <55B28758.8050305@codesourcery.com> (Luis Machado's message of "Fri, 24 Jul 2015 15:43:36 -0300") Message-ID: <87oaj15q7j.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00716.txt.bz2 On Friday, July 24 2015, Luis Machado wrote: > On 07/24/2015 03:19 PM, Sergio Durigan Junior wrote: >> diff --git a/gdb/testsuite/gdb.base/invalid-shell.exp b/gdb/testsuite/gdb.base/invalid-shell.exp >> new file mode 100644 >> index 0000000..252ef13 >> --- /dev/null >> +++ b/gdb/testsuite/gdb.base/invalid-shell.exp >> @@ -0,0 +1,38 @@ >> +# Copyright 2015 Free Software Foundation, Inc. >> + >> +# This program is free software; you can redistribute it and/or modify >> +# it under the terms of the GNU General Public License as published by >> +# the Free Software Foundation; either version 3 of the License, or >> +# (at your option) any later version. >> +# >> +# This program is distributed in the hope that it will be useful, >> +# but WITHOUT ANY WARRANTY; without even the implied warranty of >> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> +# GNU General Public License for more details. >> +# >> +# You should have received a copy of the GNU General Public License >> +# along with this program. If not, see. >> + >> +standard_testfile normal.c >> + >> +if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { >> + untested "could not compile test program" >> + return -1 >> +} >> + >> +gdb_exit >> + >> +# Set the $SHELL to an invalid file. This will cause GDB to use >> +# /bin/sh instead. >> +set oldshell $env(SHELL) >> +set env(SHELL) "/invalid/path/to/file" >> + >> +clean_restart $binfile >> + >> +# Running the inferior must work. >> +gdb_test "run" "Starting program: .*\r\nwarning: Invalid shell >> \\\'/invalid/path/to/file\\\'; using \\\'/bin/sh\\\' >> instead.\r\n\\\[Inferior $decimal \\\(process $decimal\\\) exited >> normally\\\]" "starting with /bin/sh instead of invalid shell" >> + >> +# Invoking a shell command must also work. >> +gdb_test "shell echo hi" "hi" "invoking shell command from prompt" >> + >> +set env(SHELL) $oldshell > > I think this test, as is, will not be meaningful for non-linux targets > or, in general, for remote targets. > > Also, the assumption of a path like "/invalid/path/to/file" may not > work for mingw32. > > "run" will also not work for remote targets unless they are running in > extended-remote mode. > > We should either make tests more general or restrict them > appropriately so they don't cause spurious failures for targets for > which these should not be executed. You're right, I was going to disable this test for remote targets and I forgot, thanks for letting me know. I'll disable the test for unsupported targets. -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/