www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2958] New: std.getopt RangeError on missing arg

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2958

           Summary: std.getopt RangeError on missing arg
           Product: D
           Version: 2.030
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: unknown simplemachines.org


Currently, using std.getopt will result in a RangeError if parameters are
improperly omitted on the command line.  Since this is a reasonable user-error,
it does not seem like something to crash on during release.

The problem is here:

            if (!isDelegateWithLessThanTwoParameters && !val && !incremental) {
                // eat the next argument too
                val = args[i];
                args = args[0 .. i] ~ args[i + 1 .. $];
            }

It just needs a check to see if args.length is high enough for this to happen. 
And the documentation should note the exception it throws; currently it says
only a ConvError is thrown.

-[Unknown]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10 2009
next sibling parent Brad Roberts <braddr puremagic.com> writes:
I know I need to suppress the last couple lines of bugzilla posts with the
Configure and why the mail is being received parts.  How that part is generated
changed a lot between the old and new versions of bugzilla so it'll take me a
tad more work to fix that up.  This part:

    --
    Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
    ------- You are receiving this mail because: -------

Later,
Brad
May 10 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2958


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2958


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |dsimcha yahoo.com
         Resolution|                            |FIXED



http://dsource.org/projects/phobos/changeset/1905

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 20 2010