Thread overview
[Issue 9583] New: std.getopt.getopt does not consume options terminator "--" from args list, as docs claim
Feb 24, 2013
Andrej Mitrovic
Feb 24, 2013
Andrej Mitrovic
Mar 02, 2013
Vladimir Panteleev
Mar 02, 2013
Vladimir Panteleev
February 24, 2013
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


--- Comment #0 from hsteoh@quickfur.ath.cx 2013-02-24 10:43:56 PST ---
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: -------
February 24, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9583



--- Comment #1 from hsteoh@quickfur.ath.cx 2013-02-24 12:16:42 PST ---
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: -------
February 24, 2013
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


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-24 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: -------
February 24, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9583



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-24 13:35:25 PST ---
(In reply to comment #2)
> 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: -------
February 26, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9583



--- Comment #4 from github-bugzilla@puremagic.com 2013-02-26 06:54:59 PST ---
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 Merge pull request #1159 from quickfur/getopt_optend

Fix issue 9583

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 27, 2013
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: -------
March 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9583


Vladimir Panteleev <thecybershadow@gmail.com> changed:

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


--- Comment #5 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-03-02 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: -------
March 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9583



--- Comment #6 from hsteoh@quickfur.ath.cx 2013-03-02 12:30:11 PST ---
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: -------
March 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9583



--- Comment #7 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-03-02 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: -------