I think I got this figured out. The issue is that the test actually tries to write some "roses are red" text to ls's stdin. Very infrequently, the ls will actually complete before the data can be flushed, so the task gets a "Broken pipe" exception - see MAPREDUCE-1481. I'm actually unsure whether MAPREDUCE-1481 is a bug, but the easy fix for this test is to make the input "" so no data gets written into ls's stdin.
I'm running the test in a loop with this fix now. If it keeps going for a couple hours without failure I'll post a patch. (before, this loop would fail after about 10 minutes usually)