Gittrac #4171:  Fixed the basic problem, but lots of cleanup needed
(including other places that use the "read a whole file into a string"
functionality).