Thread overview
[Issue 5600] New: rdmd: Broken behavior with command-line input
Feb 16, 2011
Andrej Mitrovic
May 22, 2011
Nick Sabalausky
May 22, 2011
Vladimir Panteleev
May 22, 2011
Andrej Mitrovic
May 22, 2011
Vladimir Panteleev
May 23, 2011
Andrej Mitrovic
February 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600

           Summary: rdmd: Broken behavior with command-line input
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-02-16 13:40:34 PST ---
This is as odd as it gets. In Windows command-line:

> type math.d
module math;
import std.stdio;
import core.stdc.stdio;
import std.conv;
import std.string;

string prompt = "Enter a number: ";
int input;

void main()
{
    write(prompt);
    auto result = to!int(readln().strip);

    writeln(result);
}

I run the test module via rdmd, and enter 45:
> rdmd math.d
D:\dev\code\d_code\bugs>Enter a number: 45
'45' is not recognized as an internal or external command,
operable program or batch file.

Now I thought I'm back to command line, but it appears I'm somehow still "in"
rdmd mode:
D:\dev\code\d_code\bugs>test
std.conv.ConvException: std.conv(727): Can't convert value `test' of type
const(char)[] to type int
std.conv.ConvException: std.conv(1129): Can't convert value `test' of type
const(char)[] to type int

Finally I'm back to command line
>test
'test' is not recognized as an internal or external command,
operable program or batch file.
D:\dev\code\d_code\bugs>

Using DMD, this test module works fine:
> dmd math.d
> math.exe
Enter a number: 34
34

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600


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: -------
May 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600


Nick Sabalausky <cbkbbejeap@mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cbkbbejeap@mailinator.com


--- Comment #1 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-05-21 17:13:40 PDT ---
This might be related to issue 4688

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600



--- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-05-22 06:20:37 PDT ---
I need the help of someone who has Windows to fix this bug. Please let me know, thanks!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600


Vladimir Panteleev <thecybershadow@gmail.com> changed:

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


--- Comment #3 from Vladimir Panteleev <thecybershadow@gmail.com> 2011-05-22 09:51:02 PDT ---
It looks like this was already fixed by Nick in git.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-22 11:01:00 PDT ---
Unfortunately I can't get the latest rdmd.d from git to compile via 2.053 so I can't test if it's fixed or not. https://github.com/D-Programming-Language/tools/blob/master/rdmd.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600



--- Comment #5 from Vladimir Panteleev <thecybershadow@gmail.com> 2011-05-22 12:31:09 PDT ---
Created an attachment (id=989)
Patch to get from current git to compile

(In reply to comment #4)
> Unfortunately I can't get the latest rdmd.d from git to compile via 2.053 so I can't test if it's fixed or not. https://github.com/D-Programming-Language/tools/blob/master/rdmd.d

Andrei should push a patch for that shortly. Here's my version.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 23, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5600


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-22 22:53:54 PDT ---
Damn, it looks like Patch from the GnuWin32 project is incompatible with Patch distributed with git.

It does work with the one distributed with git: D:\dev\projects\rdmd>"C:\Program Files\Git\Bin\patch.exe" -p1 < patchfile.patch patching file `rdmd.d'

But I've tried with the GnuWin32 Patch before that and got this:
D:\dev\projects\rdmd>patch -p1 < patchfile.patch
patching file rdmd.d
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 339
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

2.5.9 seems to be the latest version too. Oh well..

On the flip side, I can't reproduce my bug anymore so it looks like Nick's patch fixed it. Also thanks for the compilation patch, Vlad!

*** This issue has been marked as a duplicate of issue 4688 ***

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