Hi Detlev On Mon, 12 Apr 2010, Detlev Zundel wrote: > Hi Guennadi, > > > On Fri, 9 Apr 2010, Anatolij Gustschin wrote: > > > >> Sometimes not all objects from the image directory are > >> imported. Removing this dentry->d_name zero-termination > >> seems to fix the problem. dentry->d_name is zero-terminated, > >> no need to terminate it. > > > > Sorry, do not understand. The only possibility for this is if the name > > doesn't fit, and then it overwrites following fields in dentry... So, I'm > > hesitant to accept this fix. Can you verify exactly which cases fail? on > > which files? > > Check include/linux/dirent.h and you will see > > char d_name[0]; > > The man-page for readdir(3) says: > > The only fields in the dirent structure that are mandated by POSIX.1 > are: d_name[], of unspecified size, with at most NAME_MAX characters > preceding the terminating null byte; and (as an XSI extension) d_ino. > > So the assignment indeed is a bad idea. It looks like > sizeof(dentry->d_name) in the testprogram always evaluates to 256, > although d_name is dynamically allocated. If you modify the testprogram > to write a counter value instead of \0, you will notice that the > substitutions scramble _subsequent_ entries in the list. > > All in all Anatolijs patch is a real bugfix. Cool, unfortunately, that's not what I have in my copy of /usr/include/linux/dirent.h (at some point I will have to update my etch...) nor in readdir(3). But yes, now I kind-of can understand the problem. (Kind-of, because I still don't understand, why sizeof() returns a positive number, which means, it too sees a definition other than d_name[0].) Funny it didn't appear in my tests, maybe also old ARM distro / toolchain. Sure, will take this (will need some more time to review the rest), I'd like to have a better comment though, Anatolij, you can either propose one yourself, or I'll try to come up with something without the words "seems to fix" in it;) Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html