From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43737 invoked by alias); 29 Oct 2017 21:18:26 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 43727 invoked by uid 89); 29 Oct 2017 21:18:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1645, HContent-Transfer-Encoding:8bit X-HELO: limerock01.mail.cornell.edu Received: from limerock01.mail.cornell.edu (HELO limerock01.mail.cornell.edu) (128.84.13.241) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 29 Oct 2017 21:18:25 +0000 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock01.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id v9TLIMDo004498 for ; Sun, 29 Oct 2017 17:18:23 -0400 Received: from [10.13.22.3] (65-112-130-194.dia.static.qwest.net [65.112.130.194]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id v9TLIIba010865 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Sun, 29 Oct 2017 17:18:22 -0400 Subject: Re: [[PATCH setup topic/libsolv] 1/2] packagedb::removeEmptyCategories: Don't remove "Base" To: cygwin-apps@cygwin.com References: <20171028122932.3024-1-kbrown@cornell.edu> From: Ken Brown Message-ID: <7df16382-7175-9b1a-d360-0edb1ed955c2@cornell.edu> Date: Sun, 29 Oct 2017 21:18:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-PMX-Cornell-Gauge: Gauge=X X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none; X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00164.txt.bz2 On 10/29/2017 1:24 PM, Jon Turney wrote: > On 28/10/2017 13:29, Ken Brown wrote: >> This can be empty if no setup.ini files are found.  Removing it causes >> setup to hang. >> --- >>   package_db.cc | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/package_db.cc b/package_db.cc >> index ac9387c..b104073 100644 >> --- a/package_db.cc >> +++ b/package_db.cc >> @@ -596,7 +596,7 @@ packagedb::removeEmptyCategories() >>   { >>     for (packagedb::categoriesType::iterator n = >> packagedb::categories.begin(); >>          n != packagedb::categories.end(); ++n) >> -    if (!n->second.size()) >> +    if (!n->second.size() && n->first != "Base") >>         { >>           Log (LOG_BABBLE) << "Removing empty category " << n->first >> << endLog; >>           packagedb::categories.erase (n++); >> > > Hmm... now I remember my other concerns about this piece of code: as > written, it's just wrong. > > 1. Applying erase to packagedb:categories invalidates the iterator > 2. We're incrementing the iterator after doing an erase, so even if the > iterator was still valid, we skip checking if the following category is > empty > > So maybe the right way to fix this is as attached: Yes. I wrongly jumped to the conclusion that removing Base was the issue. > I need to stare as this a bit more to understand where the 'base' > category is coming from when we have no setup.ini... I guess it's created implicitly in the 'for' statement in packagedb::makeBase(). That's probably a mistake. Ken