On 6/7/13 10:19 AM, Greg Wooledge wrote: > On Fri, Jun 07, 2013 at 10:15:46PM +0800, jida...@jidanni.org wrote: >> Well it is going to happen anyway, so maybe bash should check by >> default, and not check if -o risky is set or something. It can't be that >> expensive. > > Yes it can. You're talking about adding a ridiculous amount of extra > checking and performance penalty to try to avoid users shooting themselves > in the foot *on Unix*. > > As far as I'm concerned, the correct solution is to educate the users > instead. I don't speak for Chet, of course.
The current bash behavior is described in http://lists.gnu.org/archive/html/help-bash/2013-05/msg00049.html There are certain obscure cases where this can cause problems on Unix due to parent/child sharing of file offset pointers. I think the correct solution is to retain this behavior where it is required (e.g., when reading a script from the standard input) and to discard it when reading a script from a file. This doesn't directly address the jidanni's concern, but I think the actual occurrence of this problem is infrequent enough to not do anything more elaborate. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/