tl;dr: I want to add --abort-on-bad-flag to chrome. Any objections?
Long version:
Chrome currently ignores bad command line switches. For example,
$ google-chrome --foo
is equivalent to
$ google-chrome
for unknown switch foo. Picky users may want to know when their
switches are being ignored, but I understand that in most cases we
don't want to choke on bad switches. I propose adding another switch
--abort-on-bad-flag which causes chrome to abort if an unrecognized
switch is passed (and possibly output an error message).
Besides being useful to alert careful users when their switch is no
longer supported (for example, when something like --enable-extensions
goes away), it would also help for using switches with unknown chrome
versions. I know this won't work retroactively (unless we merge it to
stable/beta branches, which is unlikely), but consider the
hypothetical utility of this flag *if it had been included in earlier
versions of chrome*, and the future utility as more use cases like the
following example crop up:
I recently added a --version switch to posix chrome. Older versions
don't have it, so for them,
$ google-chrome --version
will launch a new chrome instance instead of just printing the version
and exiting. That seems bad. It would be better to be able to do
$ google-chrome --version --abort-on-bad-flag
which would at least not launch a new chrome instance.
-- Evan Stade
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
Hi chromiumites,
tl;dr: I want to add --abort-on-bad-flag to chrome. Any objections?
On Mon, Jun 14, 2010 at 7:58 PM, Evan Stade <est...@chromium.org> wrote:Hi chromiumites,
tl;dr: I want to add --abort-on-bad-flag to chrome. Any objections?
I support the idea, but really doing this right may be tricky.
The big thing will be the wchar_t/wstring issue. Command-line
processing is one area of Chrome that hasn’t really seen a resolution.
If you look in base/command_line.{h|cc}, you’ll find a mess of
std::string and std::wstring. Before you wind up too deeply involved
in a Chrome-gflags project, you should have a careful plan, and that
plan may wind up involving extending gflags.
Mark
http://www.google.com/codesearch?hl=en&sa=N&filter=0&q=package:chromium+CommandLine.*Switch.*%22
:(
On Mon, Jun 14, 2010 at 7:58 PM, Evan Stade <est...@chromium.org> wrote:
Yes.
> How costly is it?
It doesn’t appear to be very expensive.
Mark
I'll see if I can't get rid of the string literal flags. Seems like a
necessary step even if we do use gflags.
-- Evan Stade
That’s http://crbug.com/26820, and I also think it’d be worthwhile.
Mark
--
I threw together a script that generates a report of all the switches and where they're used.
Beside code bloat, it will fail on some command line parsing that
happens *before* main().
M-A
Perhaps a less hostile solution than "failing" on unexpected flags (and yet able to handle funky embedded command-line queries) would be to have an about:flags page that listed all flags that were:a) Tested for during the process startup, and found on the command line. (We might even show the values).b) Never tested for during the process startup, but found on the command line (this is the stuff that folks wanted to fail on).
That presumably misses some switches in base/base_switches.cc. (This is easy to fix, of course.)
Robert Sesek wrote:
It uses chrome_switches.cc to create the list and gather the docs, and then it searches the code for the associated constants.
rsesek / @chromium.org <http://chromium.org>
On Tue, Jun 15, 2010 at 7:39 PM, Peter Kasting <pkas...@google.com <mailto:pkas...@google.com>> wrote:
On Tue, Jun 15, 2010 at 4:15 PM, Robert Sesek <rse...@chromium.org
<mailto:rse...@chromium.org>> wrote:
I threw together a script that generates a report of all the
switches and where they're used.
Which switches does this enumerate? Everything in
chrome_switches.h? Everything in the "switches" namespace? Every
argument to any of the CommandLine functions?
(I'm trying to determine what this does for the "hard" cases, which
range from "defined in a separate header" to "raw string comparisons
in unit tests".)
PK
Thanks. I've updated the report to include switches from the following files:SWITCHES = ['./src/app/app_switches.cc','./src/base/base_switches.cc','./src/chrome/common/chrome_switches.cc','./src/ipc/ipc_switches.cc','./src/media/base/media_switches.cc','./src/webkit/glue/plugins/plugin_switches.cc',]