From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57744 invoked by alias); 24 Jul 2015 18:34:10 -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 57733 invoked by uid 89); 24 Jul 2015 18:34:09 -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,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 24 Jul 2015 18:34:07 +0000 Received: from EUSAAHC001.ericsson.se (Unknown_Domain [147.117.188.75]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id C5.0D.07675.5FC12B55; Fri, 24 Jul 2015 13:09:41 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.77) with Microsoft SMTP Server id 14.3.210.2; Fri, 24 Jul 2015 14:33:49 -0400 Message-ID: <55B2850D.6030306@ericsson.com> Date: Fri, 24 Jul 2015 18:34:00 -0000 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Sergio Durigan Junior , 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> In-Reply-To: <1437761993-18758-1-git-send-email-sergiodj@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00712.txt.bz2 On 15-07-24 02:19 PM, Sergio Durigan Junior wrote: > It is known that GDB needs a valid shell to start the inferior and to > offer the "shell" command to the user. This has recently been the > cause of a problem on the MIPS buildslave, because $SHELL was set to > /sbin/nologin and several tests were failing. The thread is here: > > > > However, I think we can do better than that. If 'startup-with-shell' > is on, which is the default, we blindly trust that the user will > provide a valid shell for us, and this may not be true all the time. > So I am proposing a patch to increment the tests made by GDB before > running the inferior to decide whether it will use $SHELL or not. > Particularly, I created a new function, called "valid_shell", which > defines the concept of a valid shell for GDB: > > - A file that exists and is executable by the user > > - A file that is not /sbin/nologin Note that on my Ubuntu 14.04: $ which nologin /usr/sbin/nologin I think that /bin/false is also commonly specified as the default shell for system users (at least according to my /etc/passwd). Thanks, Simon