[M3devel] rmrec problems -- delete while enumerating

Jay K jay.krell at cornell.edu
Sun Aug 1 00:13:58 CEST 2010


Aha.
http://www.cz.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/readdir.c
 
 
Strongly hints at problems related to deleting and enumerating at the same time.
>From that then, I'll make another speculation -- enumeration ends up missing entries.
 
 
IF IF IF the directory is viewed like an array, and if readdir maintains a position,
moving forwad in chunks, and if delete underneath it shifts everything down,
then, I think one can see the problem. I'm not sure which of these statements is true though.
 
 
Certainly deleting while enumerating is not in general obvious how to deal with.
Depending on a few factors. In STL documentation, they always mention
what iterators are invalidated by deletion. It varies from collection to collection
and perhaps other aspects.
 
 
As to why my "rewrite" isn't working, I don't know, I can't look at until Monday.
It looks simple and correct, I tested it some, and should deal with delete-during-enumerate.
 
 
 - Jay 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100731/884df90d/attachment-0001.html>


More information about the M3devel mailing list