Item12615: CLI script parameter processing is inconsistent.

Priority: Urgent
Current State: Closed
Released In: 1.1.9
Target Release: patch
Applies To: Engine
Component: FoswikiEngineCLI
Branches: Release01x01 trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
CLI script parameter processing is inconsistent.

Parameters can be entered in three different formats

  1. parameter=value
  2. -parameter=value
  3. -parameter value

The regex that extracts these from the command line is:

       if ( $arg =~ /^-?([a-z0-9_]+)=(.*)$/i ) {
            ( $name, $arg ) = ( TAINT($1), TAINT($2) );
        elsif ( $arg =~ /^-([a-z0-9_]+)/ ) {
            ( $name, $arg ) = ( TAINT($1), shift(@args) );

The first regex is case insensitive, It will successfully match the first 2 formats, and tolerates upper/lower case.
  • MyParam=blah
  • -MyParam=blah

The second regex, matches format 3, but is not case insensitive, it only finds and extracts lower case parameters
  • -myparam blah matches
  • -MyParam blah is incorreclty ignored.

The 2nd regex should be: $arg =~ /^-([a-z0-9_]+)/i

I think that this is low risk enough to go into 1.1.9

-- GeorgeClark - 25 Oct 2013

I looked back at the history of this and it's a typo. When I added the non-equals version I missed that the equals version was /i.

So yes, low risk, do it for 1.1.9.

-- CrawfordCurrie - 26 Oct 2013


ItemTemplate edit

Summary CLI script parameter processing is inconsistent.
ReportedBy GeorgeClark
Codebase 1.1.8, trunk
SVN Range
AppliesTo Engine
Component FoswikiEngineCLI
Priority Urgent
CurrentState Closed
Checkins distro:0de023c9cbbe distro:5c8c208bc88e
TargetRelease patch
ReleasedIn 1.1.9
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:5c8c208bc88e
Release01x01Checkins distro:0de023c9cbbe
Topic revision: r6 - 19 Nov 2013, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy