On 7/26/12 5:37 PM, Michael Haubenwallner wrote: > > On 07/26/12 20:29, Chet Ramey wrote: >> OK, we have some data, we have a hypothesis, and we have a way to test it. >> Let's test it. >> >> Michael, please apply the attached patch, disable RECYCLES_PIDS, and run >> your tests again. This makes the check for previously-saved exit statuses >> unconditional. >> >> Let's see if this is the one change of significance. > > Nope, doesn't fix the problem, even if it might be necessary though > to not mix up stored exitstates. > > Somehow this is related to last_made_pid being preserved across childs > created for { $() } or { `` }.
As I said in a previous message, it's supposed to be. last_made_pid is really used as last-pid-that-should-be-waited-for. You really don't want to wait for processes begun to run command substitutions for any reason other to reap them, and you don't want to save their return statuses any longer than you have to. So last_made_pid is used as a sentinel to indicate that there are synchronous children we need to wait for and reap. I'd have to do an audit to make sure the shell does the right thing with exit statuses of commands that consist solely of assignment statements. I suspect that with your change, and with RECYCLES_PIDS in general, the exit status of an assignment statement is the exit status of the last command waited for. I'll have to verify and figure out what to do about this. 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/