Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Apr 2023 15:56:47 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 270706] Mk/Uses/nodejs.mk: fix '.if empty()' usage
Message-ID:  <bug-270706-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D270706

            Bug ID: 270706
           Summary: Mk/Uses/nodejs.mk: fix '.if empty()' usage
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: pizzamig@freebsd.org
          Reporter: jcfyecrayz@liamekaens.com
          Assignee: pizzamig@freebsd.org
             Flags: maintainer-feedback?(pizzamig@freebsd.org)

Mk/Uses/nodejs.mk currently has the following:

.  if !empty(${nodejs_ARGS:Nbuild:Nrun:Nlts:Ncurrent:N14:N16:N18:N19})
IGNORE=3D     USES=3Dnodejs has invalid arguments ${nodejs_ARGS}.
.  endif


'empty' should take an expression that is a variable or variable with modif=
iers
- such as empty(FOO) or empty(FOO:Nsomething).  It should not normally take=
 the
expansion of the expression - such as empty(${FOO}) or empty(${FOO:Nsomethi=
ng})
- unless the expansion is a desired variable expression to be tested for
emptiness itself.

For nodejs.mk it wants to check if the nodejs_ARGS variable (with modifiers=
) is
empty, so it should be:

.  if !empty(nodejs_ARGS:Nbuild:Nrun:Nlts:Ncurrent:N14:N16:N18:N19)
IGNORE=3D     USES=3Dnodejs has invalid arguments ${nodejs_ARGS}.
.  endif


But there's another error, namely the :N modifiers should include a test for
'env'.  It appears omission of that was just an oversight.  So:

.  if !empty(nodejs_ARGS:Nbuild:Nenv:Nrun:Nlts:Ncurrent:N14:N16:N18:N19)
IGNORE=3D     USES=3Dnodejs has invalid arguments ${nodejs_ARGS}.
.  endif


Locally this mistake was noticed after www/yarn added USES=3Dnodejs:env, an=
d it
just so happened that the environment had 'env' defined in the environment.=
  So
that triggered the following incorrect error:

% env env=3Dx make -C www/yarn extract
=3D=3D=3D>  yarn-1.22.18_1 USES=3Dnodejs has invalid arguments env..
*** Error code 1


After fixing the 'empty()' expression as described above, that same command
does not failure.

If you only fix the missing :Nenv without removing the incorrect expansion =
of
nodejs_ARGS and modifiers, then the invalid arguments test does not catch t=
he
invalid argument as it should:

% make -C www/yarn extract USES=3Dmetaport\ nodejs:inval
=3D=3D=3D> Fetching all distfiles required by yarn-1.22.18_1 for building
=3D=3D=3D>  Extracting for yarn-1.22.18_1

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-270706-7788>