From patchwork Wed May 16 05:36:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 10402581 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 13CB560155 for ; Wed, 16 May 2018 05:36:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01505286A3 for ; Wed, 16 May 2018 05:36:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E81E728762; Wed, 16 May 2018 05:36:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECB29286A3 for ; Wed, 16 May 2018 05:36:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751182AbeEPFgw (ORCPT ); Wed, 16 May 2018 01:36:52 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:45904 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbeEPFgw (ORCPT ); Wed, 16 May 2018 01:36:52 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1fIp7K-00027h-Sf; Wed, 16 May 2018 13:36:50 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fIp7J-0000qz-MN; Wed, 16 May 2018 13:36:49 +0800 Date: Wed, 16 May 2018 13:36:49 +0800 From: Herbert Xu To: Jilles Tjoelker Cc: DASH Mailing List Subject: [v2 PATCH] builtin: Mark more regular built-ins Message-ID: <20180516053649.riq5teyteuylmaai@gondor.apana.org.au> References: <20180515112729.w7kwpa7lczwginx3@gondor.apana.org.au> <20180515214001.GA94415@stack.nl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180515214001.GA94415@stack.nl> User-Agent: NeoMutt/20170113 (1.7.2) Sender: dash-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, May 15, 2018 at 11:40:02PM +0200, Jilles Tjoelker wrote: > On Tue, May 15, 2018 at 07:27:29PM +0800, Herbert Xu wrote: > > This patch marks the following built-ins as regular, meaning that > > they cannot be overriden using PATH search: > > > hash > > pwd > > type > > ulimit > > This seems correct, but lacks rationale. The rationale is that pwd > should have been here since long ago (because it is in the list in XCU > 2.9.1.1 Command Search and Execution), while the other three are new in > SUSv4tc2. Thanks for reviewing. I will repost this patch here to include your comment. BTW, I noticed that you removed %builtin support from FreeBSD. I was going to do that too but I noticed that in the POSIX rationale it actually says that you should provide a mechanism for overriding built-ins other than the special/regular ones (e.g., echo/printf). This is why I have decided to keep it but with changes to minimise problems like the reported breakage with literal % characters in the PATH. ---8<--- This patch marks the following built-ins as regular, meaning that they cannot be overriden using PATH search: hash pwd type ulimit On Tue, May 15, 2018 at 11:40:02PM +0200, Jilles Tjoelker wrote: > > This seems correct, but lacks rationale. The rationale is that pwd > should have been here since long ago (because it is in the list in XCU > 2.9.1.1 Command Search and Execution), while the other three are new in > SUSv4tc2. Signed-off-by: Herbert Xu diff --git a/src/builtins.def.in b/src/builtins.def.in index 4441fe4..95e420c 100644 --- a/src/builtins.def.in +++ b/src/builtins.def.in @@ -69,11 +69,11 @@ exitcmd -s exit exportcmd -as export -as readonly falsecmd -u false getoptscmd -u getopts -hashcmd hash +hashcmd -u hash jobscmd -u jobs localcmd -as local printfcmd printf -pwdcmd pwd +pwdcmd -u pwd readcmd -u read returncmd -s return setcmd -s set @@ -81,14 +81,14 @@ shiftcmd -s shift timescmd -s times trapcmd -s trap truecmd -s : -u true -typecmd type +typecmd -u type umaskcmd -u umask unaliascmd -u unalias unsetcmd -s unset waitcmd -u wait aliascmd -au alias #ifdef HAVE_GETRLIMIT -ulimitcmd ulimit +ulimitcmd -u ulimit #endif testcmd test [ killcmd -u kill