diff mbox

[v2] builtin: Mark more regular built-ins

Message ID 20180516053649.riq5teyteuylmaai@gondor.apana.org.au (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show

Commit Message

Herbert Xu May 16, 2018, 5:36 a.m. UTC
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 <herbert@gondor.apana.org.au>
diff mbox

Patch

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