|
From: | Le Manh Cuong |
Subject: | RE: "type" may return incorrect information after posix mode is enabled |
Date: | Tue, 21 Jul 2015 23:48:01 +0700 |
Bash will report error if you define function, which named the same as special builtin commands, in POSIX mode:
The problem here is bash doesn't forget those type of functions if they were defined before POSIX mode enabled. -- Mr. LE Manh Cuong Mobile: +84 1216 181090 Skype: manhcuongle > Subject: Re: "type" may return incorrect information after posix mode is enabled > To: stephane.chazelas@gmail.com; bug-bash@gnu.org > From: eblake@redhat.com > Date: Tue, 21 Jul 2015 08:07:15 -0600 > > On 07/21/2015 05:07 AM, Stephane Chazelas wrote: > > With the current git head (and 4.3): > > > > $ ./bash -c 'eval() { echo function; }; set -o posix; type eval; eval echo not function' > > 'eval' is a special built-in, and as such, cannot be usefully defined as > a function, because the shell rules for determining which command to > execute favor special built-ins over functions. > > If anything, it would be nice if bash errored out on the attempt to > define a function named 'eval', rather than allowing it to succeed. > > > (actually, having "eval is a special shell builtin" like in > > dash/mksh/ksh93/yash would be nice) > > Yes, distinguishing between special and other built-ins would indeed be > nice. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > |
[Prev in Thread] | Current Thread | [Next in Thread] |