Bug 256736 - Mk/bsd.port.mk: _FLAVOR_RECURSIVE_SH passes flavor to child make
Summary: Mk/bsd.port.mk: _FLAVOR_RECURSIVE_SH passes flavor to child make
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Port Management Team
URL:
Keywords: needs-qa, regression
Depends on:
Blocks:
 
Reported: 2021-06-20 18:25 UTC by R Williams
Modified: 2022-07-08 11:55 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (portmgr)


Attachments
Patch (431 bytes, patch)
2021-06-20 18:25 UTC, R Williams
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description R Williams 2021-06-20 18:25:48 UTC
Created attachment 225957 [details]
Patch

The change introduced in bug #256301 (review D30579), which prevents child make processes from receiving an empty `FLAVOR` variable when `FLAVOR` should be unset has the side effect of allowing any `FLAVOR` already in the parent make process environment to propagate to the child.

The attached patch unsets `FLAVOR` before starting the child make.

Behavior before:
```
    $ make FLAVOR=zabbix54
    ...
    ===>  zabbix54-agent-5.4.1 FLAVOR is defined (to zabbix54) while this port does not have FLAVORS.
    *** Error code 1
    Stop.
    make[1]: stopped in /usr/ports/net-mgmt/zabbix54-agent
    *** Error code 1
    Stop.
```

Expected behavior after:
```
    $ make FLAVOR=zabbix54
    ...
    ===> Fetching all distfiles required by zabbix54-agent-5.4.1 for building
    $ echo $?
    0
```
Comment 1 R Williams 2021-10-05 15:59:37 UTC
Created differential revision https://reviews.freebsd.org/D32324
Comment 2 alt2600 2022-07-08 00:30:54 UTC
While I know the patch a year ago resolved this annoyance, it seems there has been a regression in the past week or so. I see bsd.port.mk was patched for some package config variables, not sure if somehow this broke things. could be portmaster but the same test cases with make fetch described here in are failing the same way in the ports tree.


-- Installing: /usr/ports/databases/akonadi/work/stage/usr/local/share/locale/da/LC_MESSAGES/akonadi_knut_resource.mo
-- Up-to-date: /usr/ports/databases/akonadi/work/stage/usr/local/share/locale/zh_CN
-- Up-to-date: /usr/ports/databases/akonadi/work/stage/usr/local/share/locale/zh_CN/LC_MESSAGES
-- Installing: /usr/ports/databases/akonadi/work/stage/usr/local/share/locale/zh_CN/LC_MESSAGES/akonadi_knut_resource.mo
-- Installing: /usr/ports/databases/akonadi/work/stage/usr/local/share/locale/zh_CN/LC_MESSAGES/libakonadi5.mo
====> Compressing man pages (compress-man)
===>>> Starting check for runtime dependencies
===>>> Gathering dependency list for databases/akonadi from ports

===>>> The dependency for databases/sqlite3
       seems to be handled by sqlite3-3.39.0,1

===>>> Dependency check complete for databases/akonadi

===>>> akonadi-calendar-22.04.2 1/4 >> databases/akonadi (1/23)

===>  akonadi-22.04.3_1 FLAVOR is defined (to default) while this port does
not have FLAVORS.
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/akonadi

===>>> Installation of akonadi-22.04.3_1 (databases/akonadi) failed
===>>> Aborting update

===>>> Update for databases/akonadi failed
===>>> Aborting update

===>>> Update for akonadi-calendar-22.04.2 failed
===>>> Aborting update
Comment 3 Stefan Eßer freebsd_committer freebsd_triage 2022-07-08 11:55:50 UTC
(In reply to alt2600 from comment #2)

This appears a duplicate of 265084 which I have just fixed in portmaster 3.22.
It was caused by a commented out call to set the flavor used for "make all" again for "make install".

The scan for run dependencies can leak a flavor that applies to the dependency into the environment used to execute "make install", and therefore the FLAVOR needed to be reset to its previous value at that point.

I had commented out the call that sets the flavor before "make install", a long time ago. I hope this was not because of some other flavor related issue, but cannot remember any details causing that prior change.

I'll set the status of this PR to FIXED, since the initial issue has been corrected in bsd.port.mk, one year ago, and the new issue did only affect portmaster and is fixed in portmaster version 3.22.