Forum: IronRuby [patch] Issue in DLR.CommandLine with new lines

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jb Evain (Guest)
on 2009-03-03 15:03
(Received via mailing list)
Attachment: cmd_line.patch (0 Bytes)
Hey,

I spent some time investigating why on Mono ir.exe (last git revision)
doesn't print the result of evaluations.

The issue lies in the processing of new lines in
Microsoft.Scripting.Core.Hosting.Shell.CommandLine.

The code is appending \n as terminating new lines, but checks for the
presence of Environment.NewLine inside the evaluated string. Obviously
it works only if Environment.NewLine is \r\n, and not \n.

Attached is a suggested patch, addressing the issue.
Ivan P. (Guest)
on 2009-03-03 16:25
(Received via mailing list)
Great i'll add those to the mono branch :)
Thibaut B. (Guest)
on 2009-03-03 16:43
(Received via mailing list)
> Great i'll add those to the mono branch :)

Sorry for the obvious question: where is the mono branch ?

I think I reached a point where I need to build it myself (and I want
to stay on Mac for the moment :-).

-- Thibaut
Ivan P. (Guest)
on 2009-03-03 17:01
(Received via mailing list)
http://github.com/mletterle/ironruby

cd src

git clone
git://github.com/mletterle/ironruby.git<http://github.com/casualjim/ironruby.git>
cd ironruby
git checkout -b linux
git pull origin linux

./build (you may have to chmod +x that build file first) or sh build

if you put ~/bin in your PATH variable it will build, package and deploy
an
ironruby version. I'm still updating the build though at the moment. If
you
join the IRC channel you can see my check in coming through. I'll also
send
a mail to this mailinglist when I'm done :).




On Tue, Mar 3, 2009 at 3:34 PM, Thibaut Barrère
Jb Evain (Guest)
on 2009-03-03 18:11
(Received via mailing list)
Hey Ivan,

On 3/3/09, Ivan Porto C. <removed_email_address@domain.invalid> wrote:
> Great i'll add those to the mono branch :)

Do you keep a log of what goes into this branch? Does the branch
contain any workaround for a Mono issue that has not been solved, or
reported?
Shri B. (Guest)
on 2009-03-03 19:49
(Received via mailing list)
I have updated the instructions at
http://wiki.github.com/ironruby/ironruby#wiki_building-mono. Except for
the build step. The wiki says to use “rake compile mono=1”. Feel free to
update the wiki if there is a better way to do the build.

From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Ivan Porto
Carrero
Sent: Tuesday, March 03, 2009 6:47 AM
To: removed_email_address@domain.invalid
Subject: Re: [Ironruby-core] [patch] Issue in DLR.CommandLine with new
lines

http://github.com/mletterle/ironruby

cd src

git clone
git://github.com/mletterle/ironruby.git<http://github.com/casualjim/ironruby.git>
cd ironruby
git checkout -b linux
git pull origin linux

./build (you may have to chmod +x that build file first) or sh build

if you put ~/bin in your PATH variable it will build, package and deploy
an ironruby version. I'm still updating the build though at the moment.
If you join the IRC channel you can see my check in coming through. I'll
also send a mail to this mailinglist when I'm done :).



On Tue, Mar 3, 2009 at 3:34 PM, Thibaut Barrère
<removed_email_address@domain.invalid<mailto:removed_email_address@domain.invalid>> 
wrote:
> Great i'll add those to the mono branch :)
Sorry for the obvious question: where is the mono branch ?

I think I reached a point where I need to build it myself (and I want
to stay on Mac for the moment :-).

-- Thibaut
_______________________________________________
Ironruby-core mailing list
removed_email_address@domain.invalid<mailto:removed_email_address@domain.invalid>
http://rubyforge.org/mailman/listinfo/ironruby-core
Ivan P. (Guest)
on 2009-03-03 19:58
(Received via mailing list)
Cool :)  I went ahead and added the bit about the build script, also
removed
the instruction with the patch file as that is not necessary anymore.
Ivan P. (Guest)
on 2009-03-03 20:01
(Received via mailing list)
Perhaps..
Most of the fixes in that branch have to do with type inference and
missing
parameterless constructors.

public class MyType{
}

Compiles on MS.NET but not on Mono.

public class MyType{
   public MyType(){
   }
}

There is an issue though around delegates but this has to do with
generic
type parameter inference again.

And the reason I still didn't check in today is because gmcs is
complaining
about a file being defined twice but I can't find it anywhere :(.
Interpreter is the name of the file, when I look at the class
descriptions
most of them have been defined as partial classes _and_ it does build on
windows :)
I had a merge conflict on Microsoft.Scripting.Build.csproj but i thought
that had to do with line endings as I couldn't spot the conflict
anywhere in
the file and when I threw the 2 files in a file comparer line endings
were
the only differences.

I'll try to chase up that one problem with delegates
Ivan P. (Guest)
on 2009-03-03 20:32
(Received via mailing list)
http://github.com/casualjim/ironruby/commit/1d06f3...

Mono didn't want to cast the Expression<T> to a LambdaExpression :)
On that page you can find most of the code fixes I made to make IR
compile
on mono.
I've just repeated those in Michaels branch and just have to delete my
fork
at some stage :)
Jb Evain (Guest)
on 2009-03-03 20:47
(Received via mailing list)
Hey,

On 3/3/09, Ivan Porto C. <removed_email_address@domain.invalid> wrote:
>  On that page you can find most of the code fixes I made to make IR compile
> on mono.

Very nice, thanks!
Jb Evain (Guest)
on 2009-03-03 20:49
(Received via mailing list)
Hey,

On 3/3/09, Ivan Porto C. <removed_email_address@domain.invalid> wrote:
> public class MyType{
> }
>
> Compiles on MS.NET but not on Mono.

Huh? It does compile on Mono. It must be a different issue.

> There is an issue though around delegates but this has to do with generic
> type parameter inference again.

Have you filed a bug or extracted a test case?

Anyway, I'll make sure IronRuby compiles fine with gmcs.
Thibaut B. (Guest)
on 2009-03-03 22:32
(Received via mailing list)
> I have updated the instructions at
> http://wiki.github.com/ironruby/ironruby#wiki_building-mono. Except for the
> build step. The wiki says to use “rake compile mono=1”. Feel free to update
> the wiki if there is a better way to do the build.

Ivan, Shri, thanks for the build info and updating the wiki. Building
it on mono right now.

cheers

-- Thibaut
Ivan P. (Guest)
on 2009-03-03 22:32
(Received via mailing list)
Ok I just checked in the latest git push from Jim into the linux branch.
I
also applied your patches JB.
As it turns out it was a merge conflict in
Microsoft.Scripting.Build.csproj,
but git found it unnecessary to mark it as a conflict and just kept the
older version of the file.

It looks like Runtime/LegacyScriptCode.cs (ironic as IR hasn't even hit
1.0
yet :)) got added and 2 files in the Interpreter couldn't be found
because
they didn't exist anymore.
Thibaut B. (Guest)
on 2009-03-03 22:44
(Received via mailing list)
> Ok I just checked in the latest git push from Jim into the linux branch. I
> also applied your patches JB.
> As it turns out it was a merge conflict in Microsoft.Scripting.Build.csproj,
> but git found it unnecessary to mark it as a conflict and just kept the
> older version of the file.
>
> It looks like Runtime/LegacyScriptCode.cs (ironic as IR hasn't even hit 1.0
> yet :)) got added and 2 files in the Interpreter couldn't be found because
> they didn't exist anymore.

Seems I have a compile issue (pulled the linux branch) - I'm using the
chmod'ed +x build:

Exception caught by the compiler while compiling:
   Block that caused the problem begin at:
Runtime/LegacyScriptCode.cs(58,35):
                     Block being compiled:
[Runtime/LegacyScriptCode.cs(59,34):,Runtime/LegacyScriptCode.cs(67,13):]
System.NullReferenceException: Object reference not set to an instance
of an object
Internal compiler error at Runtime/LegacyScriptCode.cs(58,35)::
exception caught while emitting MethodBuilder
[LegacyScriptCode::EnsureTarget]

Do you meet this as well ? I'm using Mono 2.4.

-- Thibaut
Ivan P. (Guest)
on 2009-03-03 23:18
(Received via mailing list)
For me it builds but I'm on mono trunk

On the build server it builds as well:
http://ironruby.colliertech.org/integrity/ironruby...

I can publish a packaged version automatically when I build if you want.
That would typically be 1-2 days behind on Jim's pushes.

I'll set up a git repo with mono builds and publish the url here and on
the
wiki



On Tue, Mar 3, 2009 at 9:38 PM, Thibaut Barrère
Thibaut B. (Guest)
on 2009-03-03 23:26
(Received via mailing list)
Hi Ivan,

> I can publish a packaged version automatically when I build if you want.
> That would typically be 1-2 days behind on Jim's pushes.
>
> I'll set up a git repo with mono builds and publish the url here and on the
> wiki
>

that will be useful, thanks!

-- Thibaut
Ivan P. (Guest)
on 2009-03-03 23:52
(Received via mailing list)
You can find the binaries @
http://github.com/casualjim/ironruby-mono-builds



On Tue, Mar 3, 2009 at 10:25 PM, Thibaut Barrère
Thibaut B. (Guest)
on 2009-03-03 23:57
(Received via mailing list)
>
> You can find the binaries @
> http://github.com/casualjim/ironruby-mono-builds
>

Lovely - cloning it right now.

thanks!

-- Thibaut
Thibaut B. (Guest)
on 2009-03-04 00:23
(Received via mailing list)
In case that's useful to someone else, I had to:
ln -s ~/git/ironruby-mono-builds/lib/ ~/lib
ln -s ~/git/ironruby-mono-builds/bin/ ~/bin

thanks again Ivan!

-- Thibaut

On Tue, Mar 3, 2009 at 10:53 PM, Thibaut Barrère
Rafael R. (Guest)
on 2009-03-04 01:09
Hi,

It worked, after some wrestling with the paths. Thanks.

Cheers,
Rafael
www.rafaelrosafu.com
Ivan P. (Guest)
on 2009-03-05 00:14
(Received via mailing list)
Hi

Can you let me know which paths were giving you issues?

Thanks
Rafael R. (Guest)
on 2009-03-05 06:54
Hi,

Nothing serious, the problem is that the "ir" script has a hardcoded
path to "~/bin/ir" and already used that directory, so I had to ajust
that, no big deal, but it might be nice to put a small notice on the
README warning about that. Sorry for not specifing the problem before.

Cheers
Jb Evain (Guest)
on 2009-03-05 16:10
(Received via mailing list)
On 3/3/09, Jb Evain <removed_email_address@domain.invalid> wrote:
>  Attached is a suggested patch, addressing the issue.
Microsoft folks,

I know you can't take direct patches for the DLR, but do you plan to
take this bug into consideration?
Curt H. (Guest)
on 2009-03-05 16:17
(Received via mailing list)
I recommend that you file this as a bug report against the DLR at
http://www.codeplex.com/dlr
Shri B. (Guest)
on 2009-03-05 20:07
(Received via mailing list)
It sounds like an easy fix, so we will try to get it fixed in the next
few days.
This topic is locked and can not be replied to.