From patchwork Sun May 22 04:23:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 806272 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4M4NaYQ008132 for ; Sun, 22 May 2011 04:23:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750742Ab1EVEXe (ORCPT ); Sun, 22 May 2011 00:23:34 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:52346 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750740Ab1EVEXd convert rfc822-to-8bit (ORCPT ); Sun, 22 May 2011 00:23:33 -0400 Received: by iyb14 with SMTP id 14so3825825iyb.19 for ; Sat, 21 May 2011 21:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=cWks40zpux2NaYRx4tJNK0eTnp0lsaRmF4Mu0UEAmeI=; b=GruKA08r0QYPH4ETyPfiRd1MwSR6KIrSTsGPv5V/yiWA4puiwbfh1fgtUHUfad5xAB fac/TuyLYaaULNHkxPArYtuiWoZPKk+23qG5aZLDePIwD9dAySMpYa0n6Dv/lOJ7SXSs +F/Z0IKMNRN5p09zxQfmmQB99pI5kq/o+vlkc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=geHBDbTPrHiQWr1CN0D6X4tsXvvwyAkJqEw+dcrAjk2+jVLgRkx8kF9x/zaWaSh9Na dYYfY3eBqCanD1/dlNgJik2Y5/0apwNPQTRlBHMBigbZoTd8wvbnTv49OYlqshsG8GPy HQ2a0yDNbfJLIef48QSqBMPy67evdRfFCyjk8= MIME-Version: 1.0 Received: by 10.43.47.72 with SMTP id ur8mr7216029icb.9.1306038212856; Sat, 21 May 2011 21:23:32 -0700 (PDT) Received: by 10.42.177.10 with HTTP; Sat, 21 May 2011 21:23:32 -0700 (PDT) In-Reply-To: <201105211855.03702.yann.morin.1998@anciens.enib.fr> References: <201105211855.03702.yann.morin.1998@anciens.enib.fr> Date: Sun, 22 May 2011 00:23:32 -0400 Message-ID: Subject: Re: Inconsistency in dependency calculations From: Arnaud Lacombe To: "Yann E. MORIN" Cc: linux-kbuild@vger.kernel.org Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 22 May 2011 04:23:36 +0000 (UTC) Hi, On Sat, May 21, 2011 at 12:55 PM, Yann E. MORIN wrote: > Hello All! > > Here I am again, with an inconstistency in the way forward dependencies are > computed. ;-) > > Take this simple test-case for example: > >    ---8<--- Config.in ---8<-- >    config F >        bool "F" > >    choice AB >        bool "AB" >    config A >        bool "A" >    config B >        bool "B" >    config C >        bool "C" >    endchoice > >    if A >    config D >        bool >        default y if F >        select E >    config E >        bool "E" >    endif # A > >    if B >    config D >        bool >        default y if F >        select E >    config E >        bool "E" >    endif # B >    ---8<--- END ---8<--- > > Then run: >  rm -f .config .config.old >  mconf Config.in > >    [ ] F (NEW) >        AB (A)  ---> >    [ ] E (NEW) > > Then select F: > >    [*] F      D) selects E which has unmet direct dependencies (B) >        AB (A)  ---> >    -*- E > > Notice the text following F. It is *not* a copy-paste error, I do really see > this text. > expected. > Now exit and save. Run mconf again, and exit staright away. Notice this > error mesage on the console: >    warning: (D) selects E which has unmet direct dependencies (B) > > Now, run mconf again, select B in the choice (keep F selected). You get the > same warning on the console (expected, as it is printed before bringing up > the dialog menu, and we get to see it only when exiting, not when loading). > > Now re-run mconf yet again and exit straight away. There is no warning this > time. > > What I would expect for consistency: the warning is printed both when A or > B is selected, warning about direct dep B when A is selected, and conversely > when A is selected: > A selected: >    warning: (D) selects E which has unmet direct dependencies (B) > B selected: >    warning: (D) selects E which has unmet direct dependencies (A) > > What I would expect in an ideal world: no warning is printed at all. > as a rule, I would expect the backend never to output anything unless it has been instructed to do so by the frontend, it has obviously not been enforced in the past, and is likely not to trivial to fix... I guess that mconf() can be told to redraw the complete screen, but that's hackish... > Behaves the same with kconfig in 2.6.39 and linux-next 20110520. > > Of course, this example is only here to pin-point the mis-behavior. Fact is, > the real life example happens with a generated Config.in, so it is not possible > to turn the conditional into "if A || B". > yeah.. the real problem is that you are using kconfig in a way which has not been thought about. The problem you got is because the symbol direct dependency is inherited by its last parent, in that case, B. But you should not have the warning at the first place, in the B branch, all E's dependency are met. This should fix your problem: if (sym && sym_is_choice(sym) && [same warning, gmail and long line do not play well together...] - Arnaud > Regards, > Yann E. MORIN. > > -- > .-----------------.--------------------.------------------.--------------------. > |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | > | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               | > | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  | > | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  | > '------------------------------^-------^------------------^--------------------' > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at  http://vger.kernel.org/majordomo-info.html > --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 5fdf10d..77f913c 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -350,7 +350,7 @@ void menu_finalize(struct menu *parent) last_menu->next = NULL; } - sym->dir_dep.expr = parent->dep; + sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep);; } for (menu = parent->list; menu; menu = menu->next) {