add a test for reading long directories
strip only the very last newline

It's part of the behavior of tail that the very last newline in a fail is
ignored. However, we were ignoring the trailing newline at the end of every
search block, which could cause us to print extra lines.