macaroni-os / mark-issues

Macaroni Automated Repositories Kit Issues
4 stars 1 forks source link

Portage variables are not being set properly in `mark-testing` #187

Closed cuantar closed 2 weeks ago

cuantar commented 2 weeks ago

The portage variable EROOT is not being set correctly in mark-testing. Originally, I found the problem with metro; but I've confirmed that I'm seeing it on live systems as well. The easiest way to verify is with baselayout, either using ebuild: $ ebuild /var/git/meta-repo/kits/core-kit/sys-apps/baselayout/baselayout-3.0.ebuild merge

or something like this: $ emerge baselayout & sleep 2; tail -f /var/tmp/portage/sys-apps/baselayout-3.0/temp/build.log

The error manifests visibly in the following messages:

/var/tmp/portage/sys-apps/baselayout-3.0/temp/environment: line 502: proc/mounts: No such file or directory
 * You should reboot now to get /run mounted with tmpfs!
/var/tmp/portage/sys-apps/baselayout-3.0/temp/environment: line 539: etc/mark-release: No such file or directory

In the ebuild, there are places where paths are created like ${EROOT}etc/passwd: image

The errors above related to /proc/mounts and /etc/mark-release have a similar origin: image

This problem will cause major issues with both running systems and stage builds, if it is not corrected. Files don't get installed, or lines don't get written to them; and unless the ebuild author thought to use die liberally, the errors will be silent during the emerge process as with baselayout where they're only observed by watching the build log.

cuantar commented 2 weeks ago

It is not clear why variables like EROOT are not set. The Gentoo ebuild documentation says that it should always be defined: image https://devmanual.gentoo.org/ebuild-writing/variables/index.html

cuantar commented 2 weeks ago

Looking through our tree, many ebuilds use $EROOT instead of writing /. These will all suffer from this bug.

cuantar commented 2 weeks ago

I'm not seeing the problem in next so I'll stay over there until we figure it out.

cuantar commented 2 weeks ago

Just to illustrate that this is a problem outside of metro:

$ /var/git/meta-repo/kits # grep -r EROOT | wc -l
2267
cuantar commented 2 weeks ago

Found by @geaaru: https://projects.gentoo.org/pms/8/pms.html#x1-113001r7

EAPI7 wipes out the trailing slash from $EROOT.

Confirmed that the problem does not actually happen with bash due to the presence of the slash: image

Seems like this bug maybe only affects baselayout after all.