Fixed the file listing bug.  Either in the RepRap code, or somewhere in the SD file code, the #define for _USE_LFN is defined as fals for RepRap, true in the library file ff.c.  The result is that ff.c tried to write long
file names into a structure created in RepRap that was too short for them.  Result - buffer overflow misery.  For the moment I've commented out the bit of code in ff.c that handles long names (look for the string ******), but this needs to be tracked down and dealt with properly.