NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/57179 (occasional pkg_add core dumps)



The following reply was made to PR bin/57179; it has been noted by GNATS.

From: Christof Meerwald <cmeerw%cmeerw.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/57179 (occasional pkg_add core dumps)
Date: Thu, 1 Feb 2024 19:59:08 +0100

 Finally managed to test on NetBSD HEAD and I am still seeing core
 dumps.
 
 I believe the loop in fetch_cache_put should look somewhat like this:
 
 	for (iter = connection_cache; iter; ) {
 		++global_count;
 		if (strcmp(conn->cache_url->host, iter->cache_url->host) == 0)
 			++host_count;
 		if (global_count < cache_global_limit &&
 		    host_count < cache_per_host_limit) {
 			oiter = NULL;
 			last = iter;
 		} else {
 			--global_count;
 			if (host_count >= cache_per_host_limit)
 				--host_count;
 			if (last != NULL)
 				last->next_cached = iter->next_cached;
 			else
 				connection_cache = iter->next_cached;
 			oiter = iter;
 		}
 		iter = iter->next_cached;
 		if (oiter)
 			(*oiter->cache_close)(oiter);
 	}
 
 I have moved "last = iter;" into the "then" branch (so "last" won't
 end up pointing to an entry that has been closed), and I have added a
 conditional "--host_count" into the "else" branch, so we don't end up
 closing all remaining cache entries (with mismatched host names).
 
 This is completely untested as I don't have the system set up to
 re-compile the library.
 
 
 Christof
 
 -- 
 
 https://cmeerw.org                             sip:cmeerw at cmeerw.org
 mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org
 


Home | Main Index | Thread Index | Old Index