From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64992 invoked by alias); 24 Jul 2015 19:54:34 -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 64838 invoked by uid 89); 24 Jul 2015 19:54:33 -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 19:54:32 +0000 Received: from EUSAAHC007.ericsson.se (Unknown_Domain [147.117.188.93]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 90.29.07675.DCF22B55; Fri, 24 Jul 2015 14:30:05 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.95) with Microsoft SMTP Server id 14.3.210.2; Fri, 24 Jul 2015 15:54:29 -0400 Message-ID: <55B297F5.3070300@ericsson.com> Date: Fri, 24 Jul 2015 19:54: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 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> <55B2850D.6030306@ericsson.com> <87k2tp5q3g.fsf@redhat.com> In-Reply-To: <87k2tp5q3g.fsf@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00723.txt.bz2 On 15-07-24 03:10 PM, Sergio Durigan Junior wrote: > On Friday, July 24 2015, Simon Marchi wrote: > >> 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 > > /sbin/nologin is probably a symlink to this file, isn't it? But yeah, > the check could include /usr/sbin/nologin as well. No it isn't: $ ls -l /sbin/nologin ls: cannot access /sbin/nologin: No such file or directory