www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9583] New: std.getopt.getopt does not consume options terminator "--" from args list, as docs claim

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

           Summary: std.getopt.getopt does not consume options terminator
                    "--" from args list, as docs claim
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: hsteoh quickfur.ath.cx



Code:

import std.getopt;
import std.stdio;

void main(string[] args) {
        int opt;

        writeln(args);
        getopt(args, "opt", &opt);
        writeln(args);
}


Results:

$ ./test --opt=123 -- --a --b --c
["./test", "--opt=123", "--", "--a", "--b", "--c"]
["./test", "--", "--a", "--b", "--c"]
$

Contrary to what the docs claim, the options terminator "--" is not consumed by
getopt.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583




https://github.com/D-Programming-Language/phobos/pull/1159

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |andrej.mitrovich gmail.com



13:35:00 PST ---
H. S. Teoh's pull: https://github.com/D-Programming-Language/phobos/pull/1159

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583




13:35:25 PST ---

 H. S. Teoh's pull: https://github.com/D-Programming-Language/phobos/pull/1159
Woops I didn't see you already pasted the link. The 'pull' keyword was missing though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/20cda1eae065d2c1d259596028bfd38747bdd8b8
getopt should consume options terminator "--".

As stated by the docs. (Cf. issue 9583)

https://github.com/D-Programming-Language/phobos/commit/d6af6284383f84ff88b5420f9f66115315e4d20a


Fix issue 9583

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



07:20:26 EET ---
The fix introduced a regression in rdmd (issue 9622). It might have been better
to change the documentation instead.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583




I don't understand, isn't that a bug with rdmd, not with this fix? Besides, one
of my programs depends on this fix, because sometimes it needs getopt to not
processing subsequent arguments that may begin with '-'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9583




22:32:47 EET ---
Yeah, you're right. The old behavior made no sense.

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