Quoth Jonathan Nieder <jrnie...@gmail.com>, on 2010-11-26 01:10:47 -0600: > > Inserting, say, a > > debugging echo before the actual command is virtually guaranteed to > > not exec the final command directly. > > How do you like the ksh93 behavior?
I wasn't previously aware of the ksh93 behavior. So they _do_ do that in cases where the entire script is not a single simple command. (My previous experience was always otherwise, including with Bash, pdksh, I think zsh though that appears to exhibit ksh93-esque behavior now so I may have misremembered, and one or two other shells.) ksh93 appears to also handle various other tail positions, including subshells and && and ||. That's more the sort of thing I could get behind if I were made Dictator of Shells. :-) Obviously my information above was out of date. I amend it to say "in many cases will not exec the final command directly". (This means that a program that wishes to be portable to multiple underlying shells can rely even less on the process tree shape, so my previous points mostly stand anyway.) > Actually, let me take that back. If you actually want a guarantee > that future versions of dash will have or lack this feature, Let me be a little clearer, at the risk of restating myself. I don't personally need a guarantee either way, especially since it's something I'll have to deal with regardless of what dash does in the future. I mostly wanted to ensure that people reading the bug trail were aware of some of the subtler ramifications of a decision to do tail execution optimization in shells, and in particular, I wanted to: - Add a dissenting voice to some ideas from upthread that making the last command a child of the shell is "wrong" and that relying on a highly compact process tree shape that was not actually requested is a sane thing to do in a POSIX or GNU/Linux environment, which IMHO it is not. - Point out that full tail execution optimization is not as localized as the "anything without shell meta-stuff" that some people think it is, and that partial tail execution optimization can lead to subtle problems if not done carefully. Cf. a vaguely similar case where I was attempting to use an XSI shell builtin (which I was willing to rely on on the target system) as a single command in a series of commands in a makefile, and GNU Make decided that it didn't look enough like a shell thing and could be "optimized" into an exec, which naturally hosed the command. Of course, the case of doing exec transformation _in_ the shell is not as bad as that. Thanks for the attention. ---> Drake Wilson -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org