New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 809389 link

Starred by 4 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Avoid #include-ing platform2 headers directly

Project Member Reported by nya@chromium.org, Feb 6 2018

Issue description

On building platform2 packages written in C++, platform2 directory is added to include search path so that its own header files can be found. However this also allows loading header files from other packages too, which should be avoided. Instead, header files installed to the target chroot should be used.

 

Comment 1 by nya@chromium.org, Feb 6 2018

I initially thought this problem should be addressed individually in each package, but it turned out this is a problem common to mostly all platform2 packages. I'm merging bugs I filed for individual packages.

Comment 2 by nya@chromium.org, Feb 6 2018

Cc: derat@chromium.org akes...@chromium.org lhchavez@chromium.org chirantan@chromium.org dgreid@chromium.org pmalani@chromium.org
 Issue 793761  has been merged into this issue.

Comment 3 by nya@chromium.org, Feb 6 2018

 Issue 793760  has been merged into this issue.

Comment 4 by nya@chromium.org, Feb 6 2018

 Issue 793758  has been merged into this issue.

Comment 5 by nya@chromium.org, Feb 6 2018

Cc: teravest@chromium.org
 Issue 793756  has been merged into this issue.

Comment 6 by nya@chromium.org, Feb 6 2018

Cc: bmgordon@chromium.org sjg@chromium.org
 Issue 793755  has been merged into this issue.
Project Member

Comment 7 by bugdroid1@chromium.org, Feb 10 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3

commit e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3
Author: Shuhei Takahashi <nya@chromium.org>
Date: Sat Feb 10 00:07:13 2018

platform2: Use CROS_WORKON_SUBTREE.

This patch updates most of platform2 ebuilds to use
CROS_WORKON_SUBTREE.

List of updated packages, groups by boards used to test:

amd64-generic:
- chromeos-base/vm_tools

coral:
- chromeos-base/modemfwd

daisy:
- chromeos-base/cromo
- chromeos-base/gobi-cromo-plugin
- chromeos-base/wimax_manager

eve:
- chromeos-base/arc-obb-mounter
- chromeos-base/arc-setup
- chromeos-base/attestation
- chromeos-base/authpolicy
- chromeos-base/avtest_label_detect
- chromeos-base/bootstat
- chromeos-base/chaps
- chromeos-base/chromeos-config-tools
- chromeos-base/chromeos-imageburner
- chromeos-base/chromeos-init
- chromeos-base/chromeos-installer
- chromeos-base/chromeos-login
- chromeos-base/chromeos-test-init
- chromeos-base/chromeos-trim
- chromeos-base/container_utils
- chromeos-base/crash-reporter
- chromeos-base/cros-disks
- chromeos-base/crosh
- chromeos-base/cryptohome
- chromeos-base/cryptohome-client
- chromeos-base/debugd
- chromeos-base/debugd-client
- chromeos-base/disk_updater
- chromeos-base/easy-unlock
- chromeos-base/imageloader
- chromeos-base/imageloader-client
- chromeos-base/libbrillo
- chromeos-base/libchromeos-ui
- chromeos-base/libcontainer
- chromeos-base/libpasswordprovider
- chromeos-base/lorgnette
- chromeos-base/metrics
- chromeos-base/midis
- chromeos-base/mist
- chromeos-base/modem-utilities
- chromeos-base/mount-passthrough
- chromeos-base/mtpd
- chromeos-base/p2p
- chromeos-base/permission_broker
- chromeos-base/permission_broker-client
- chromeos-base/power_manager
- chromeos-base/power_manager-client
- chromeos-base/quipper
- chromeos-base/run_oci
- chromeos-base/secure-erase-file
- chromeos-base/session_manager-client
- chromeos-base/shill
- chromeos-base/shill-client
- chromeos-base/smbprovider
- chromeos-base/st_flash
- chromeos-base/system_api
- chromeos-base/timberslide
- chromeos-base/tpm_manager
- chromeos-base/trunks
- chromeos-base/u2fd
- chromeos-base/update_engine
- chromeos-base/update_engine-client
- chromeos-base/userfeedback
- chromeos-base/virtual-file-provider
- chromeos-base/vpn-manager
- dev-util/bsdiff
- dev-util/puffin
- sys-apps/mosys
- chromeos-base/apmanager [*]
- chromeos-base/arc-apk-cache [*]
- chromeos-base/biod [*]
- chromeos-base/goldfishd [*]
- chromeos-base/ippusb_manager [*]
- chromeos-base/peerd [*]
- chromeos-base/smogcheck [*]
- chromeos-base/touch_keyboard [*]
- chromeos-base/userspace_touchpad [*]
- sys-apps/fitpicker [*]

gale:
- chromeos-base/buffet
- chromeos-base/feedback
- chromeos-base/libweave
- chromeos-base/webserver

guado:
- chromeos-base/atrusctl
- sys-apps/cfm-device-monitor

host:
- chromeos-base/chromeos-config-host
- chromeos-base/chromeos-dbus-bindings
- chromeos-base/regions

kevin:
- chromeos-base/touch_firmware_calibration

poppy:
- chromeos-base/hammerd
- chromeos-base/hammerd-test-utils

UNTESTED (build fails even without CROS_WORKON_SUBTREE):
- chromeos-base/cros_component
- chromeos-base/salsa
- chromeos-base/thd
- chromeos-base/tpm2-simulator

NOTE: Packages marked with [*] are not depended by any board as
I could tell, but I could build them with emerge-$BOARD --nodeps.

CQ-DEPEND=CL:807599
CQ-DEPEND=CL:910611
BUG=chromium:791888
BUG=chromium:809389
TEST=cros_mark_as_stable --board=$BOARD --all commit
TEST=emerge-$BOARD --nodeps PACKAGES

Change-Id: Ibb9e1fbb44004880efff44cc27364234eab04336
Reviewed-on: https://chromium-review.googlesource.com/845470
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Shuhei Takahashi <nya@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/dev-util/bsdiff/bsdiff-4.3.1-r10.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/tpm_manager/tpm_manager-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/permission_broker/permission_broker-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/update_engine/update_engine-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/system_api/system_api-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/atrusctl/atrusctl-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-trim/chromeos-trim-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/attestation/attestation-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-imageburner/chromeos-imageburner-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/midis/midis-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/vm_tools/vm_tools-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/shill-client/shill-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/debugd/debugd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/smbprovider/smbprovider-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/u2fd/u2fd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/touch_firmware_calibration/touch_firmware_calibration-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/authpolicy/authpolicy-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/gobi-cromo-plugin/gobi-cromo-plugin-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/libbrillo/libbrillo-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/thd/thd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/modemfwd/modemfwd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/bootstat/bootstat-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/disk_updater/disk_updater-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/buffet/buffet-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-init/chromeos-init-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/timberslide/timberslide-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/cromo/cromo-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-installer/chromeos-installer-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/salsa/salsa-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/avtest_label_detect/avtest_label_detect-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/mist/mist-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/arc-apk-cache/arc-apk-cache-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/run_oci/run_oci-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/touch_keyboard/touch_keyboard-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/metrics/metrics-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-config-host/chromeos-config-host-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/cros-disks/cros-disks-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/cros_component/cros_component-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/imageloader-client/imageloader-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/p2p/p2p-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/sys-apps/cfm-device-monitor/cfm-device-monitor-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/permission_broker-client/permission_broker-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/userfeedback/userfeedback-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/cryptohome-client/cryptohome-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/vpn-manager/vpn-manager-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/secure-erase-file/secure-erase-file-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/peerd/peerd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/hammerd-test-utils/hammerd-test-utils-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/biod/biod-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/webserver/webserver-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/virtual-file-provider/virtual-file-provider-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/arc-obb-mounter/arc-obb-mounter-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/regions/regions-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/sys-apps/fitpicker/fitpicker-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/libweave/libweave-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chaps/chaps-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/cryptohome/cryptohome-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/arc-setup/arc-setup-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/apmanager/apmanager-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/shill/shill-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/lorgnette/lorgnette-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/libpasswordprovider/libpasswordprovider-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/mount-passthrough/mount-passthrough-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/update_engine-client/update_engine-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-dbus-bindings/chromeos-dbus-bindings-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/libchromeos-ui/libchromeos-ui-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-test-init/chromeos-test-init-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/libcontainer/libcontainer-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/debugd-client/debugd-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/feedback/feedback-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/modem-utilities/modem-utilities-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/quipper/quipper-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/imageloader/imageloader-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/easy-unlock/easy-unlock-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/container_utils/container_utils-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/crash-reporter/crash-reporter-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/session_manager-client/session_manager-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/goldfishd/goldfishd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/hammerd/hammerd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/tpm2-simulator/tpm2-simulator-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/sys-apps/mosys/mosys-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/power_manager/power_manager-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/power_manager-client/power_manager-client-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/dev-util/puffin/puffin-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/userspace_touchpad/userspace_touchpad-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/trunks/trunks-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/crosh/crosh-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/st_flash/st_flash-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/ippusb_manager/ippusb_manager-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/smogcheck/smogcheck-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-login/chromeos-login-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/dev-util/bsdiff/bsdiff-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/chromeos-config-tools/chromeos-config-tools-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/mtpd/mtpd-9999.ebuild
[modify] https://crrev.com/e5b03cf4c41c0c193ed966c0ad2559f3dd3e6dc3/chromeos-base/wimax_manager/wimax_manager-9999.ebuild

Components: Infra>Client>ChromeOS>Build
Cc: benchan@chromium.org
how about we institute the policy:
- installed platform2 packages use /usr/include/chromeos/ to install header files
- when including headers from other packages, you have to use <chromeos/package-name/foo.h>
- when including headers from our own local package, you use "package-name/foo.h"

that should avoid conflicts where <package/foo.h> and "package/foo.h" resolve to the same path because we add -I.../platform2/ to the compiler flags.  Ben suggested adjusting that -I to -iquotedir, but i think that only works for gcc.  not sure if clang has a corresponding flag.
Cc: hidehiko@chromium.org
Sorry, I've forgotten some of the details here. In practice, does using <package/foo.h> already make us favor installed files rather than ones from platform2? Is the main problem that devs sometimes use double-quotes to include files that belong to other packages?

I think that libbrillo used to install its headers to /usr/include/chromeos back when it was called libchromeos, but presumably nobody cares about renaming it back now.
unfortunately, angle brackets don't make a difference when using -I (which is what we use with platform2/ atm).  that's why Ben suggested using -iquotedir instead ... then we would get the behavior where "package/foo.h" would only look under platform2, and <package/foo.h> would only look in system paths like /usr/include.

libbrillo did historically use /usr/include/chromeos/, but it's now under /usr/include/brillo/.  i don't think we need to migrate that back for this proposal.
Thanks for the explanation. #9 sounds fine to me. Would using "other-package/foo.h" to include something from another package actually fail to be resolved, or would a pre-upload hook also be needed to prevent people from doing that?
hopefully the existing CROS_WORKON_SUBTREE logic should largely catch those bad uses ...
If we use different include paths for sysroot vs. platform2, we'll be in trouble described in https://bugs.chromium.org/p/chromium/issues/detail?id=833675#c10
Do you have a good solution for it?

I personally think the comment #12 in that bug provides the right solution: if your header is public and needs to include another header, that include should always be relative to the current directory.  So we might have something like:

    platform2/some_project/public/foo.h
    platform2/some_project/public/bar.h
    platform2/some_project/public/nested/baz.h

foo.h would include bar.h as

    #include "bar.h"

and baz.h would be

    #include "nested/baz.h"


This works no matter where the public header is installed as long as the directory structure is maintained.
This is also how pretty much every C library handles public header files.
Stepping back, the problem is, if the header file in another platform2's lib is touched unexpectedly, it would;
- cause a sandbox crash and build fails sometimes, or
- use system installed libs, e.g. /usr/include/..., for the board, and the build succeeds.

note: I assume that DEPENDS is correctly written in .ebuild file, so files under /usr/include is up-to-date.

Then, is it possible to avoid sandbox crashing, and instead, can it behave as if no file is there so that the compiler will automatically fallback to system?
If the sandbox does not have such a feature, can we extend it?

It's easier to understand for me if include paths are same.
# TBH, if the paths is relative to chromeos root (i.e., platform2/some_project/foo.h etc.) rather than to platform2 root (i.e. some_project/foo.h etc. like now), it is much easier for me, but it is out of scope for this bug, I think.

So I think I'm running into a problem related to this area. I need to use some functionality from libshill-net in arc-networkd (which currently only uses shill-client). When I add this dependency and include a file e.g.

#include <shill/net/rtnl_handler.h>

The build fails with access violations, e.g.

...
arc-networkd-9999: [0/3] CXX obj/arc/network/arc-networkd.manager.o * ACCESS DENIED:  open_rd:      /mnt/host/source/src/platform2/shill/net/rtnl_listener.h
arc-networkd-9999:  * ACCESS DENIED:  open_rd:      /mnt/host/source/src/platform2/shill/net/shill_export.h
arc-networkd-9999:  * ACCESS DENIED:  open_rd:      /mnt/host/source/src/platform2/shill/net/rtnl_listener.h
arc-networkd-9999:  * ACCESS DENIED:  open_rd:      /mnt/host/source/src/platform2/shill/net/shill_export.h
arc-networkd-9999: 
arc-networkd-9999: [1/3] CXX obj/arc/network/arc-networkd.manager.o
arc-networkd-9999: FAILED: obj/arc/network/arc-networkd.manager.o 

I can get around this by adding shill/net to CROS_WORKON_SUBTREE but other projects (e.g. platform2/portier) don't need to do this. What is the correct way to handle this?
Cc: garrick@chromium.org
portier is currently broken (waiting on a fix for this bug), so that's not a good example to follow.
Cc: -lhchavez@chromium.org

Sign in to add a comment