
Michael,
I tried to reproduce the bug you mentioned (multiple appearance of directories in ls output) using the script you provided, to no avail: ls correctly showed the top-level directory, both with and without CFG_JFFS2_SORT_FRAGMENTS option.
I am inclined to suspect the same cause as you mentioned below:
Our u-boot is not placed in flash were it is located to on compilation time. static const char * points into flash space at some not properly initialized flash space.
This would affect all global and static variables, with unpredictable results. Could you try to reproduce this bug with u-boot placed at the address it was linked to?
As a side note, your fix for compilation with CFG_JFFS2_SORT_FRAGMENTS option turned on would be better as follows: replace
if (pL->readbuf == NULL) put_fl_mem(jNode);
with
put_fl_mem(jNode, pL->readbuf);
(put_fl_mem already performs this check)
Regards, Alexey.