Posts Tagged ‘candidate code’

BD-shell 1.0.0 RC2 is out! Processes in background are dangerous

Saturday, September 13th, 2008

Release Candidate 2 for my C shell is out. This is a real release candidate, code is frozen and hopefully this one does not have serious bugs like RC1. As you may know, RC1 has been retired because of a bug causing a segmentation fault when launching short commands in background. Let's see why this happened. The following schema summarizes what happens when a program in background is launched:

Schema for BD-shell, anatomy of process handling

Schema for BD-shell, anatomy of process handling


As you see, there is a non-synchronous function that is called when the child exits, the SIGCHLD handler.
What if the background command is very short, like ls? It may happen that SIGCHLD is thrown before the job object creation. Bdsh RC1 did not manage this case, and crashed. RC2 fixes this and does not have relevant bugs according to my definition of 1.0.0 release.

Finally, go and grab the code!

  • Share/Save/Bookmark