Bug 294020 - security/ossec-hids-agent-config: Invalid character " " in variable name "/usr/bin/id -un"
Summary: security/ossec-hids-agent-config: Invalid character " " in variable name "/us...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dag-Erling Smørgrav
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-24 09:25 UTC by Einar Bjarni Halldórsson
Modified: 2026-04-08 11:38 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (dominik.lisiak)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Einar Bjarni Halldórsson 2026-03-24 09:25:46 UTC
Poudriere outputs these warnings on every build now:

[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-server-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-server-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-server-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-server-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-server-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-server-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:33] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"

--- SNIP ---
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2026-04-07 20:21:55 UTC
I dont see anything weird building security/ossec-hids-agent-config on my end?

cat /usr/local/etc/poudriere.d/144amd64-dev-make.conf
CPUTYPE?=znver4

Nothing else "non standard/default" on my end in terms of settings (no, ccache/sccache)

...and using my overlay tree
https://github.com/diizzyy/ports-overlay
Comment 2 Einar Bjarni Halldórsson 2026-04-07 21:23:13 UTC
(In reply to Daniel Engberg from comment #1)

I upgraded the poudriere build server to 14.4-RELEASE on March 10th and the earliest I can find the errors is on the 14th. I looked at the commit history for ports and nothing on the 14th that jumps out as causing this.
Comment 3 Einar Bjarni Halldórsson 2026-04-07 21:27:14 UTC
Just tried running poudriere bulk from the command line and it doesn't trigger the warnings. I assume it's something to do with the environment when running from cron then
Comment 4 Einar Bjarni Halldórsson 2026-04-07 21:35:12 UTC
It's not coming from poudriere-bulk, it's coming from when I run poudriere distclean in my buildscript.

$ sudo poudriere distclean -p 144amd64_default -a -y
[00:00:01] Ports supports: FLAVORS SUBPACKAGES SELECTED_OPTIONS
[00:00:01] Loading MOVED for /usr/local/poudriere/ports/144amd64_default
[00:00:01] Gathering all expected distfiles for ports tree '144amd64_default'
[00:00:28] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:28] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:28] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:28] Warning: (security/ossec-hids-agent-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:493: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:28] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:489: warning: Invalid character " " in variable name "/usr/bin/id -un"
[00:00:28] Warning: (security/ossec-hids-local-config): make: /usr/local/poudriere/ports/144amd64_default/Mk/bsd.options.mk:491: warning: Invalid character " " in variable name "/usr/bin/id -un"

-- SNIP --
Comment 5 Juhani Krekelä 2026-04-07 21:49:14 UTC
The problem appears to stem from this piece of code on lines 96 to 98 of security/ossec-hids-local-config/Makefile:

.if empty(USER)
USER=$$(${ID} -un)
.endif

If you were running the build from a normal login session, USER would be set, but I presume Poudriere doesn't do so. The USER variable is then used a bit further down in the definition of the SUB_PLIST variable on line 110:

SUB_LIST+=	PORTNAME=${PORTNAME} \
		OSSEC_TYPE=${OSSEC_TYPE} \
		OSSEC_HOME=${OSSEC_HOME} \
		VERSION=${PORTVERSION} \
		USER=${USER} \
		OSSEC_USER=${OSSEC_USER} \
		OSSEC_GROUP=${OSSEC_GROUP} \
		OSSEC_RC=${OSSEC_RC} \
		FW_DROP=${FW_DROP}

The lines it issues a warning on in bsd.options.mk are part of a loop that gets run once for each option for the port (starts on line 477). The relevant bit here is that the loop adds SUB_LIST entries for all options (lines 489 to 495):

.      if ! ${SUB_LIST:M${opt}=*}
.        if ${PORT_OPTIONS:M${opt}}
SUB_LIST:=  ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
.        else
SUB_LIST:=  ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
.        endif
.      endif

The usage of := here interacts badly with the way USER was defined. It runs variable expansion on the contents of SUB_LIST, which (because make variable expansion is lazy by default) then recursively runs the expansion on USER, (if I understand this correctly) replacing the "USER=${USER}" bit of the definition of SUB_LIST with "USER=$(/usr/bin/id -un)". This is then assigned back to the SUB_LIST variable.

The next time the value of SUB_LIST is used, in a way that causes expansion, e.g. the next time we go around this loop, it then tries to expand "USER=$(/usr/bin/id -un)". Since $() is also a possible make variable expansion syntax, it ends up trying to expand a variable named "/usr/bin/id -un".

A similar problem seems to have been fixed with other variables by changing $$(…) to `…` in security/ossec-hids* last summer: https://cgit.freebsd.org/ports/commit/?id=6764a97f12fadadd0d4803aa205c47161ae50ae4

My guess is that the problem with USER was missed back then because it's usually set from the environment.
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-04-08 11:37:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=082e36892d5c1f00fb726a360d7484090e57b343

commit 082e36892d5c1f00fb726a360d7484090e57b343
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-08 11:36:53 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-08 11:36:53 +0000

    security/ossec-hids-local-config: Unbreak

    PR:             294020
    MFH:            2026Q2
    Differential Revision:  https://reviews.freebsd.org/D56303

 security/ossec-hids-local-config/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-04-08 11:37:30 UTC
A commit in branch 2026Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a0718fd0e19f71454f365d682e42aa05944be72a

commit a0718fd0e19f71454f365d682e42aa05944be72a
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-04-08 11:36:53 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-08 11:37:17 +0000

    security/ossec-hids-local-config: Unbreak

    PR:             294020
    MFH:            2026Q2
    Differential Revision:  https://reviews.freebsd.org/D56303

    (cherry picked from commit 082e36892d5c1f00fb726a360d7484090e57b343)

 security/ossec-hids-local-config/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)