[Mac] base::AmIBundled trickyness

6 views
Skip to first unread message

Paweł Hajdan, Jr.

unread,
Aug 19, 2010, 7:35:32 PM8/19/10
to chromium-dev
base::AmIBundled from base/mac_util behaves trickily for binaries like browser_tests, which at the beginning are "normal", not-bundled libraries, but then load the Chrome bundle.

We use base::AmIBundled in base/base_paths_mac. With the current caching in PathService all works fine, but this is by accident. When we turn off or modify caching, we start getting wrong values for DIR_SOURCE_ROOT, because the code thinks it is bundled (AmIBundled returns true), but the right path is for the unbundled binary.

Any suggestions how to fix this trickyness? The rationale is that things should return same results when the caching is off.

Here's a more detailed description:

1. Start browser_tests. AmIBundled returns false. DIR_SOURCE_ROOT is based on the un-bundled path, and is correct.
2. Load the Chrome bundle. AmIBundled will start returning true, but all is fine because DIR_SOURCE_ROOT is cached by PathService.

Now when we turn off the cache (what actually happens is that my patch - now reverted - drops the PathService cache when PathService::Override is called), in step 2. we're going to start getting a broken path for DIR_SOURCE_ROOT.

Paweł Hajdan, Jr.

unread,
Aug 23, 2010, 12:38:36 PM8/23/10
to chromium-dev
ping

Should we just make sure AmIBundled runs very early in base/test_suite.h and make it cache its value? What do you think?

Mark Mentovai

unread,
Aug 23, 2010, 12:43:25 PM8/23/10
to phajd...@chromium.org, chromium-dev
Paweł Hajdan, Jr. wrote:
> Should we just make sure AmIBundled runs very early in base/test_suite.h and
> make it cache its value? What do you think?

Perhaps we could make sure that AmIBundled only returns true if the
running main executable matches the bundle’s main executable.

Mark

Thomas Van Lenten

unread,
Aug 23, 2010, 12:46:14 PM8/23/10
to ma...@chromium.org, phajd...@chromium.org, chromium-dev
rohit is playing with some logging in there locally to see if we can figure out when it fails and how.

One other idea is to check the name of the running process and if it ends in _unittest, it's not a bundle...

TVL



--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
   http://groups.google.com/a/chromium.org/group/chromium-dev

Thomas Van Lenten

unread,
Aug 23, 2010, 5:08:10 PM8/23/10
to ma...@chromium.org, phajd...@chromium.org, chromium-dev
Rohit checked in more logging code. If anyone sees a failure on the bots that they thing is related to this, please call it to our attention so we can check the logs for what happened.

TVL
Reply all
Reply to author
Forward
0 new messages