From owner-freebsd-current@freebsd.org Wed Sep 4 16:31:31 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BF72F662F for ; Wed, 4 Sep 2019 16:31:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 46Nq8M1P49z4WlB for ; Wed, 4 Sep 2019 16:31:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id 2CB9BF662B; Wed, 4 Sep 2019 16:31:31 +0000 (UTC) Delivered-To: current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C7D0F662A for ; Wed, 4 Sep 2019 16:31:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Nq8K4x1Gz4Wl6; Wed, 4 Sep 2019 16:31:29 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x534.google.com with SMTP id l21so11523989pgm.3; Wed, 04 Sep 2019 09:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=PwNZHvP1DCdDH3RXVqmQSCJQI8/Zpl3H0TPXBhwqt1Q=; b=jNohgwYWypbXT8dABSBuYdu7Xzt1K4O1ohLHqWjxJZg7ey8Ze/p5BWVvX3H38+pGnt 7xAH3FRwPe3rJ/1jBagRyvZ5LITwjWr8dxc+uph49W9Z+5osA2QcTSTSUpKS06ps1Hf3 XuRfttRsNL03zDhrvlSdAfZN/zF3boL8bOFJB2xF8mZqIgjHH2pdoxZO5cVIceCiwiw3 3fZjzoWa9MUOXcsByVTFuxEEfhP692zF5rKB8hwbYevvtMLqREF/hTkLjRovhvnrnJmg OnP2N6wKjuCGVohUA20gGm/bfQjxW7g1ceI6/ha9RryUMYozpO2ZUjmOwarBZliO2Ciq AqzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=PwNZHvP1DCdDH3RXVqmQSCJQI8/Zpl3H0TPXBhwqt1Q=; b=PGx+zNzYV5qCEGdpNTyXVJFWHDoslOlO7HscJPsIcokkrbpwi78YNVE6x6XbMsCKGv gj2YQi9IqHRuI16leJe8PVTJ7eV4U2ACbBUzb2XHN9P49GEguN3stNtK6dNjCdnrEJFp dqS/3MRl//y9dPvxQCyvE3UF+jLhsbQhvWf/BLIfS3ykyKlHwdVb8IUVqlaC++LuNAZh FLxI/I22J1bf6eKukaQrf/t85nV1X0RkmT5Dyy/i9s0C3Jhwj/3BvC2REQr8NuKNqEjW SZfKesnJmbHL7XThok7MFmRFj3WJoZ9Fpo7OchDFeMq68Z3xjzNP+OY90Xwd6u++qiaN AcjQ== X-Gm-Message-State: APjAAAWdljXRmVJBUUhAx+iRe2RwjQKlswMVBOCXOi8yJ6x4HdD7hsD8 LM3b3m6zAC0iiL+sHmScfN2Q3BmQAd0= X-Google-Smtp-Source: APXvYqyGFMJWITNelQfl2wLTlXM/cL5jH0ewJWcE5kke7T0fUxbhI3biKSkKJylV3je3BksjV1hXjA== X-Received: by 2002:aa7:869a:: with SMTP id d26mr1875465pfo.2.1567614687862; Wed, 04 Sep 2019 09:31:27 -0700 (PDT) Received: from ?IPv6:2607:fb90:b21e:2263:4cd7:25c7:1dea:406e? ([2607:fb90:b21e:2263:4cd7:25c7:1dea:406e]) by smtp.gmail.com with ESMTPSA id a13sm21880191pfn.104.2019.09.04.09.31.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Sep 2019 09:31:26 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: Weird goings on with make::empty() From: Enji Cooper X-Mailer: iPhone Mail (16G102) In-Reply-To: <5ab957620b5e28f1d9de14df12f9fdf60d00fc35.camel@freebsd.org> Date: Wed, 4 Sep 2019 09:31:25 -0700 Cc: Kyle Evans , Poul-Henning Kamp , current Content-Transfer-Encoding: quoted-printable Message-Id: <26F4833D-81C6-42B6-B6CD-DF62714FAAD8@gmail.com> References: <3843.1567598344@critter.freebsd.dk> <969A062A-A52A-49E3-B4E3-CC9377B08C80@gmail.com> <5ab957620b5e28f1d9de14df12f9fdf60d00fc35.camel@freebsd.org> To: Ian Lepore X-Rspamd-Queue-Id: 46Nq8K4x1Gz4Wl6 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=jNohgwYW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::534 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-3.49 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-9.32), ipnet: 2607:f8b0::/32(-2.76), asn: 15169(-2.28), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[4.3.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Sep 2019 16:31:31 -0000 > On Sep 4, 2019, at 07:58, Ian Lepore wrote: >=20 >> On Wed, 2019-09-04 at 09:33 -0500, Kyle Evans wrote: >> On Wed, Sep 4, 2019 at 9:27 AM Enji Cooper >> wrote: >>>=20 >>>=20 >>>> On Sep 4, 2019, at 04:59, Poul-Henning Kamp >>>> wrote: >>>>=20 >>>> On: >>>>=20 >>>> Repository Root: svn+ssh://repo.freebsd.org/base >>>> Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f >>>> Revision: 351809 >>>>=20 >>>> I built a kernel, but drm-current-kmod did not get compiled >>>> from the new world order in /usr/local/sys/modules >>>>=20 >>>> Debugging I ended up doing this to src/sys/conf/kern.post.mk: >>>>=20 >>>> Index: sys/conf/kern.post.mk >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>>> =3D=3D=3D=3D=3D >>>> --- sys/conf/kern.post.mk (revision 351809) >>>> +++ sys/conf/kern.post.mk (working copy) >>>> @@ -77,12 +77,14 @@ >>>> ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} >>>> .endif >>>> .for module in ${LOCAL_MODULES} >>>> -.if !empty(module) >>>> + true "XXX A $(module) 2 ${LOCALBASE} 3 ${LOCAL_MODULES} 4 >>>> ${MODULES_WITH_WORLD}" >>>> +#.if !empty(module) >>>> + true "XXX B $(module) 2 ${LOCALBASE} 3 ${LOCAL_MODULES} 4 >>>> ${MODULES_WITH_WORLD}" >>>> @${ECHODIR} "=3D=3D=3D> ${module} >>>> (${target:S/^reinstall$/install/:S/^clobber$/cleandir/})" >>>> @cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} >>>> ${MAKE} \ >>>> DIRPRFX=3D"${module}/" \ >>>> ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} >>>> -.endif >>>> +#.endif >>>> .endfor >>>> .endif >>>> .endfor >>>>=20 >>>> This gives me the expected output from buildkernel: >>>>=20 >>>> true "XXX A drm-current-kmod 2 /usr/local 3 drm-current-kmod 4 >>>> " >>>> true "XXX B drm-current-kmod 2 /usr/local 3 drm-current-kmod 4 >>>> " >>>>=20 >>>> If I leave in the ".if !empty(module)" line in, I only get: >>>>=20 >>>> true "XXX A drm-current-kmod 2 /usr/local 3 drm-current-kmod 4 >>>> " >>>>=20 >>>> suggestions welcome... >>>=20 >>> (CCing Kyle) >>>=20 >>> This behavior change is probably caused by r351799. >>>=20 >>> I personally think the code before Kyle=E2=80=99s change and after it wa= s >>> buggy. It=E2=80=99s not word splitting LOCAL_MODULES before iterating ov= er >>> it. >>>=20 >>=20 >> I've backed out r351799 since it breaks usage of LOCAL_MODULES >> (though >> I really don't understand how empty works, apparently, and that makes >> me sad)... please advise on a correct path forward, because it's not >> clear to me. >>=20 >> Thanks, >>=20 >> Kyle Evans >>=20 >=20 > I'm not positive, but I suspect this has to do with when variables are > expanded. In particular, the loop variable for a .for is expanded on > each loop iteration, but doesn't yet exist during parsing. I suspect > that the .if is evaluated earlier, during parsing. For example, this > makefile: >=20 > all: > .for x in a "" b > .if empty(x) > @echo empty > .endif > @echo ${x} > .endfor > @echo done >=20 > gives this output: >=20 > revolution > make -f /tmp/Makefile=20 > empty > a > empty >=20 > empty > b > done >=20 > The way I interpret that is that empty(x) is true during parsing, so > the for loop is generated to contain "@echo empty" and "@echo ${x}", > then the for loop actually runs and prints both "empty" and the value > of ${x} on each iteration. Correct. Word splitting is the key. I=E2=80=99ll take a stab at this later o= n today. Thanks, -Enji=