Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Issue 340044: Linux: Add support for loading environment variables at plugin start-up from ... (Closed)

Created:
11 years, 1 month ago by Tristan Schmelcher 2
Modified:
9 years, 6 months ago
Reviewers:
nmaxwell, piman
CC:
o3d-review_googlegroups.com
Visibility:
Public.

Description

Linux: Add support for loading environment variables at plugin start-up from a file on disk. This lets us set any needed environment variables in a cross-browser way (i.e., without trying to modify the browsers' program launcher scripts to set variables for us). This is needed on some 64-bit systems where an environment variable has to be set in order for MESA to know where to find its GPU drivers. BUG=none TEST=built, created envvars file, and put something in it; verified that it was set successfully Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=30799

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 14

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 4

Patch Set 5 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+148 lines, -0 lines) Patch
A plugin/linux/envvars.h View 3 4 1 chunk +43 lines, -0 lines 0 comments Download
A plugin/linux/envvars.cc View 3 4 1 chunk +83 lines, -0 lines 0 comments Download
M plugin/linux/main_linux.cc View 1 2 3 chunks +14 lines, -0 lines 0 comments Download
M plugin/plugin.gyp View 2 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Tristan Schmelcher 2
11 years, 1 month ago (2009-10-30 11:55:12 UTC) #1
piman
http://codereview.chromium.org/340044/diff/4001/4002 File plugin/linux/main_linux.cc (right): http://codereview.chromium.org/340044/diff/4001/4002#newcode62 Line 62: static const char *kEnvVarsFilePath = "/opt/google/o3d/envvars"; I think ...
11 years, 1 month ago (2009-10-30 20:20:54 UTC) #2
Tristan Schmelcher 2
http://codereview.chromium.org/340044/diff/4001/4002 File plugin/linux/main_linux.cc (right): http://codereview.chromium.org/340044/diff/4001/4002#newcode62 Line 62: static const char *kEnvVarsFilePath = "/opt/google/o3d/envvars"; On 2009/10/30 ...
11 years, 1 month ago (2009-11-02 13:59:30 UTC) #3
piman
LGTM, but could you add the standard copyright header on top of each new file ...
11 years, 1 month ago (2009-11-02 19:06:01 UTC) #4
piman
On 2009/11/02 13:59:30, tschmelcher wrote: > http://codereview.chromium.org/340044/diff/4001/4002 > File plugin/linux/main_linux.cc (right): > > http://codereview.chromium.org/340044/diff/4001/4002#newcode62 > ...
11 years, 1 month ago (2009-11-02 19:06:56 UTC) #5
Tristan Schmelcher 2
http://codereview.chromium.org/340044/diff/9001/5003 File plugin/linux/envvars.cc (right): http://codereview.chromium.org/340044/diff/9001/5003#newcode1 Line 1: #include <stdio.h> On 2009/11/02 19:06:01, piman wrote: > ...
11 years, 1 month ago (2009-11-03 06:03:23 UTC) #6
Tristan Schmelcher 2
11 years, 1 month ago (2009-11-03 06:04:12 UTC) #7
On 2009/11/02 19:06:56, piman wrote:
> On 2009/11/02 13:59:30, tschmelcher wrote:
> > http://codereview.chromium.org/340044/diff/4001/4002
> > File plugin/linux/main_linux.cc (right):
> > 
> > http://codereview.chromium.org/340044/diff/4001/4002#newcode62
> > Line 62: static const char *kEnvVarsFilePath = "/opt/google/o3d/envvars";
> > On 2009/10/30 20:20:54, piman wrote:
> > > I think that will cause pains for the distribution packages (Ubuntu etc.)
> > > Do you know if there's any way to find this file relative to the .so ?
> > > Otherwise it'd be good do externalize this path into the a scons/gyp
> variable
> > so
> > > that it's more easily changeable.
> > 
> > I think finding it relative to the .so might be an even bigger headache for
> some
> > distributions if they want the .so file and data in different paths, for
> > example. I've made it a build define, though I don't see any way in GYP to
> make
> > it overriddable via the command-line. :(
> 
> The way to do this is through a gyp variable. Let's worry about that later
> maybe.

I tried that already actually, but I couldn't find a way to override the value
on the command-line, and I didn't see any documentation about that anywhere.

Submitting.

> 
> > 
> > http://codereview.chromium.org/340044/diff/4001/4002#newcode629
> > Line 629: 
> > On 2009/10/30 20:20:54, piman wrote:
> > > Could you break all of this into a separate function ? If possible a
> separate
> > > file with a unit test, string parsing always makes me nervous.
> > 
> > Done. No unit tests yet though b/c the unit test binary on Linux with GYP
> > doesn't run yet (missing rpath settings). I'll work on fixing that later.
> > 
> > http://codereview.chromium.org/340044/diff/4001/4002#newcode637
> > Line 637: // dependencies.
> > On 2009/10/30 20:20:54, piman wrote:
> > > Note that InitializePlugin can be called several times in the same process
> > (e.g.
> > > if Firefox reloads plugins). I don't think it causes problems here, but
just
> > in
> > > case you do.
> > 
> > I know. That won't cause problems, it'll just overwrite the previous
> definitions
> > with the same value.
> > 
> > http://codereview.chromium.org/340044/diff/4001/4002#newcode642
> > Line 642: char buf[kMaxEnvVarLength];
> > On 2009/10/30 20:20:54, piman wrote:
> > > buf -> buffer
> > 
> > Done.
> > 
> > http://codereview.chromium.org/340044/diff/4001/4002#newcode647
> > Line 647: LOG(ERROR) << "Malformed env var line";
> > On 2009/10/30 20:20:54, piman wrote:
> > > s/env var/environment variable/ here and other places
> > 
> > Done.
> > 
> > http://codereview.chromium.org/340044/diff/4001/4002#newcode648
> > Line 648: continue;
> > On 2009/10/30 20:20:54, piman wrote:
> > > I'd abort the parsing at this point. If it turns out you have a long line
in
> > the
> > > file, you will end up parsing the second part as if it was a full line and
> may
> > > have an unintended side effect.
> > 
> > That wouldn't really protect against long lines, because if the end of the
> value
> > is truncated but the equals is still there then the same problem happens.
I'd
> > rather keep it as-is so that it's robust against malformed lines (i.e., the
> > following lines are still parsed correctly in the event of a missing
equals).
> > 
> > http://codereview.chromium.org/340044/diff/4001/4002#newcode652
> > Line 652: int len = strlen(value);
> > On 2009/10/30 20:20:54, piman wrote:
> > > s/len/length/
> > 
> > Done.

Powered by Google App Engine
This is Rietveld 408576698