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

Issue 6718012: Add error checking for poorly-formed crossystem args (Closed)

Created:
9 years, 9 months ago by Randall Spangler
Modified:
9 years, 7 months ago
Reviewers:
petkov
CC:
chromium-os-reviews_chromium.org, gauravsh, Luigi Semenzato, Bill Richardson
Visibility:
Public.

Description

Add error checking for poorly-formed crossystem args R=petkov@chromium.org BUG=chromium-os:13322 TEST=manual The following command lines should cause crossystem to fail with a warning about a poorly formed parameter: crossystem '' crossystem '=cros_debug' crossystem '?cros_debug' The following command line should warn that you can't use both = and ?: crossystem cros_debug?=0 (that is, it warns, not just compares with '=0') The following should print 'UNEQUAL' crossystem cros_debug? || echo UNEQUAL (because it's comparing cros_debug with an empty string) Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=f27583f

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -5 lines) Patch
M utility/crossystem_main.c View 2 chunks +19 lines, -5 lines 1 comment Download

Messages

Total messages: 5 (0 generated)
Randall Spangler
9 years, 9 months ago (2011-03-21 22:34:14 UTC) #1
petkov
LGTM although I don't see where the foo?=0 warning is coming from? http://codereview.chromium.org/6718012/diff/1/utility/crossystem_main.c File utility/crossystem_main.c ...
9 years, 9 months ago (2011-03-21 22:42:30 UTC) #2
Randall Spangler
On 2011/03/21 22:42:30, petkov wrote: > LGTM although I don't see where the foo?=0 warning ...
9 years, 9 months ago (2011-03-21 22:47:51 UTC) #3
Randall Spangler
On 2011/03/21 22:47:51, Randall Spangler wrote: > On 2011/03/21 22:42:30, petkov wrote: > > LGTM ...
9 years, 9 months ago (2011-03-21 22:49:12 UTC) #4
petkov
9 years, 9 months ago (2011-03-21 23:00:53 UTC) #5
On 2011/03/21 22:47:51, Randall Spangler wrote:
> On 2011/03/21 22:42:30, petkov wrote:
> > LGTM although I don't see where the foo?=0 warning is coming from?
> 
> if (has_set && has_expect)
> 
> > is
> > 
> > if (!name || strlen(name) == 0)
> > 
> > a bit more readable?
> > 
> > then you wouldn't some of the other changes.
> 
> strtok() ignores leading delimiter chars, so strtok("=foo", "=?") returns
"foo"

ah -- ugly..

> 
> (though in python, argv[i].split('=foo') does return ['', 'foo'])

Powered by Google App Engine
This is Rietveld 408576698