[MacRuby-devel] [MacRuby] #772: Assertion fails with 4 bytes UTF-8.

2010-07-06 Thread MacRuby
#772: Assertion fails with 4 bytes UTF-8.
--+-
 Reporter:  watson1...@…  |   Owner:  lsansone...@…
 Type:  defect|  Status:  new  
 Priority:  blocker   |   Milestone:   
Component:  MacRuby   |Keywords:   
--+-
 Assertion fails when I use UTF-8 charactor from U+01 to U+10 (4
 bytes UTF-8).

 {{{
 $ macirb
 irb(main):001:0> p "\u{01}".chop
 Assertion failed: (beg.start_offset_in_bytes != -1), function str_splice,
 file string.c, line 754.
 zsh: abort  macirb
 }}}

 {{{
 $ macirb
 irb(main):001:0> p "\u{10}".chop
 Assertion failed: (beg.start_offset_in_bytes != -1), function str_splice,
 file string.c, line 754.
 zsh: abort  macirb
 }}}

 {{{
 $ macirb
 irb(main):001:0> p "\u{01}".reverse
 Assertion failed: (U_SUCCESS(err)), function str_ucnv_make_data_binary,
 file ucnv.c, line 96.
 zsh: abort  macirb
 }}}

 {{{
 $ macirb
 irb(main):001:0> p "\u{10}".reverse
 Assertion failed: (U_SUCCESS(err)), function str_ucnv_make_data_binary,
 file ucnv.c, line 96.
 zsh: abort  macirb
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #766: Problems building "any" revision of trunk

2010-07-06 Thread MacRuby
#766: Problems building "any" revision of trunk
---+
 Reporter:  kennylov...@…  |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  blocker|   Milestone:   
Component:  MacRuby|Keywords:   
---+

Comment(by eloy.de.en...@…):

 In order to prevent this, you can pass the --format-executable to macgem
 when you install gems. The rake bin would then be named ‘macrake’. Though
 there is an issue with rubygems that it doesn't remove the bin when
 uninstalling a gem, but that's a minor issue imo.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #773: Segfault occurs when specified $SAFE=4 and exception is generated.

2010-07-06 Thread MacRuby
#773: Segfault occurs when specified $SAFE=4 and exception is generated.
--+-
 Reporter:  watson1...@…  |   Owner:  lsansone...@…
 Type:  defect|  Status:  new  
 Priority:  blocker   |   Milestone:   
Component:  MacRuby   |Keywords:   
--+-
 Test Script:
 {{{
 $ cat test_bus_error.rb
 level = ARGV[0].to_i

 $SAFE = level

 # generate an exception each level.
 case level
 when 1
   eval(ARGV[0])
 when 2
   Dir.chdir("..")
 when 3
   str = "hello"
   str.untaint
 when 4
   puts "test"
 end
 }}}

 Result of MacRuby 0.6:
 {{{
 $ macruby test_bus_error.rb 1
 /Users/watson/test/ruby/macruby/segfault/test_bus_error.rb:2:in `':
 Insecure operation: -r (SecurityError)
 $ macruby test_bus_error.rb 2
 /Users/watson/test/ruby/macruby/segfault/test_bus_error.rb:2:in `':
 Insecure operation at level 2 (SecurityError)
 $ macruby test_bus_error.rb 3
 /Users/watson/test/ruby/macruby/segfault/test_bus_error.rb:2:in `':
 Insecure operation at level 3 (SecurityError)
 $ macruby test_bus_error.rb 4
 zsh: illegal hardware instruction  macruby test_bus_error.rb 4
 }}}

 Result of MacRuby Trunk:
 {{{
 $ macruby test_bus_error.rb 1
 /Users/watson/test/ruby/macruby/segfault/test_bus_error.rb:2:in `':
 Insecure operation: -r (SecurityError)
 $ macruby test_bus_error.rb 2
 /Users/watson/test/ruby/macruby/segfault/test_bus_error.rb:2:in `':
 Insecure operation at level 2 (SecurityError)
 $ macruby test_bus_error.rb 3
 /Users/watson/test/ruby/macruby/segfault/test_bus_error.rb:2:in `':
 Insecure operation at level 3 (SecurityError)
 $ macruby test_bus_error.rb 4
 zsh: segmentation fault  macruby test_bus_error.rb 4
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] memory leaks

2010-07-06 Thread Laurent Sansonetti
Hi Jakub,

Sorry for the late reply. I have been switching homes and was without internet 
access.

On Jun 30, 2010, at 2:22 PM, Jakub Suder wrote:

> Hi,
> 
> The users of my app are reporting to me that it takes way more memory
> than such app is supposed to. I've just released a new version that
> was supposed to improve this at least a bit, and someone commented
> that "I haven't even entered login and password and it already leaked
> almost a megabyte" (posting this screenshot from Instruments:
> http://static0.blip.pl/user_generated/update_pictures/1129697.jpg). I
> did a test - I've removed almost everything from the app except the
> login screen; and indeed, when started, the Leaks tool in Instruments
> shows about 800 KB of leaked memory (I suppose it goes up over time).
> All of that is shown as coming from libmacruby (though this really
> just means that the app is running MacRuby, as I understand).
> 
> Now, I'm wondering:
> - is this memory leaking because I'm doing something wrong (though
> there's not much things I could have done wrong in a login dialog...)
> - or is it leaking because MacRuby is doing something wrong
> - or is it not leaking at all really, and it's just that Instruments
> can't understand the memory managed by MacRuby and assumes it's leaked
> even if it's not?

Investigating memory leaks in a MacRuby app can be problematic because of the 
GC. (The same problem is also valid for pure Objective-C apps running in GC 
mode.) What you may see as leaks could potentially be false positives. Numbers 
reported by top(1) can also sometimes be wrong.

In general, memory leaks can easily be induced by the user, although it is 
unlikely here. There has been some work on eliminating memory leaks in the 0.6 
release but there might still be some around.

What I would do:

1) build MacRuby trunk (just run rake macruby)
2) in the same directory, run your app like this (here, Foo): $ 
DYLD_LIBRARY_PATH=. MallocStackLogging=1 MallocStackLoggingNoCompact=1 
/path/to/Foo.app/Contents/MacOS/Foo 
3) use your app a little bit, then when you're reading to measure leaks: $ 
leaks Foo > /tmp/Foo.leaks

Then, attach /tmp/Foo.leaks here.

> Here's a minimal version of the app:
> http://dl.dropbox.com/u/41808/macblip_mem_test.zip

How should I use it? It looks like it's asking me some kind of 
username/password.

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Using the SystemConfiguration framework

2010-07-06 Thread Laurent Sansonetti
I'm afraid there is no other way currently than wrapping this API in ObjC as 
John suggested.

We are working on a better BridgeSupport system but it won't be available soon.

Laurent

On Jul 2, 2010, at 10:34 PM, John Labovitz wrote:

> Depending on what you need to do, you should check out 
> IXSCNotificationManager, an ObjC wrapper around parts of SC.  I've used it a 
> few times and it's quite helpful, and obviously an better impedance match to 
> MacRuby code.  It's mentioned & linked here:
> 
>   http://www.cocoadev.com/index.pl?NotificationOnNewNetwork
> 
> --John
> 
> 
> 
> On 2 Jul 2010, at 8:03 PM, Michael Jackson wrote:
> 
>> Not sure yet. The whole framework is a bit of a mess from my point of
>> view. I need to be able to tinker a bit in order to figure out how to
>> use it. ;)
>> 
>> I'd probably start with the SCNetworkConfiguration and SCDynamicStore API's.
>> 
>> --
>> Michael Jackson
>> http://mjijackson.com
>> @mjijackson
>> 
>> 
>> 
>> On Fri, Jul 2, 2010 at 5:09 PM, Thibault Martin-Lagardette
>>  wrote:
>>> Which specific inline function are you trying to use?
>>> 
>>> --
>>> Thibault Martin-Lagardette
>>> 
>>> 
>>> 
>>> On Jul 2, 2010, at 15:44, Michael Jackson wrote:
>>> 
 It's complaining that there aren't any inline functions in the
 SystemConfiguration framework. This is the command I ran and the
 output I received:
 
 $ gen_bridge_metadata -f
 /System/Library/Frameworks/SystemConfiguration.framework -F dylib -o
 SystemConfiguration.dylib
 No inline functions in the given framework/library, no need to generate a 
 dylib.
 
 However, this doesn't make any sense to me. The documentation clearly
 lists lots of inline functions. C isn't my best language, so maybe I'm
 misunderstanding something...
 
 --
 Michael Jackson
 http://mjijackson.com
 @mjijackson
 
 
 
 On Fri, Jul 2, 2010 at 4:23 PM, Thibault Martin-Lagardette
  wrote:
> To use inline C function you need to generate a dylib using 
> gen_bridge_metatada.
> If you do `man gen_bridge_metadata`, you'll see:
> 
>> If the custom framework has inline functions and you want to be able to 
>> call them, here is how you can generate a ``dylib'' file:
>>gen_bridge_metadata -f /Path/To/YourFramework.framework -F dylib -o 
>> /Path/To/YourFramework.framework/Resources/BridgeSupport/YourFramework.dylib
> 
> Then you just need to require the generated dylib :-)
> 
> It looks like this corresponds to what you want to do? :-)
> 
> --
> Thibault Martin-Lagardette
> 
> 
> 
> On Jul 2, 2010, at 14:49, Michael Jackson wrote:
> 
>> How exactly does one go about using the SystemConfiguration framework
>> in MacRuby?
>> 
>> http://developer.apple.com/mac/library/documentation/Networking/Reference/SysConfig/index.html
>> 
>> When I try "framework 'SystemConfiguration'" it returns true, but none
>> of the inline C functions are available. From the reading I've done,
>> it seems that static C libraries like SystemConfiguration should be
>> loaded via a BridgeSupport file, but I have no idea how to generate
>> one in this case.
>> 
>> --
>> Michael Jackson
>> http://mjijackson.com
>> @mjijackson
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
 ___
 MacRuby-devel mailing list
 [email protected]
 http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>>> ___
>>> MacRuby-devel mailing list
>>> [email protected]
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #772: Assertion fails with 4 bytes UTF-8.

2010-07-06 Thread MacRuby
#772: Assertion fails with 4 bytes UTF-8.
--+-
 Reporter:  watson1...@…  |   Owner:  vincent.isamb...@…
 Type:  defect|  Status:  new   
 Priority:  blocker   |   Milestone:
Component:  MacRuby   |Keywords:
--+-
Changes (by lsansone...@…):

  * owner:  lsansone...@… => vincent.isamb...@…


Comment:

 Looks like we properly encode the sequence, so I guess it's a bug
 somewhere else.

 {{{
 $ macruby -e 'p "\u{01}".bytes.to_a'
 [240, 144, 128, 128]
 $ ruby1.9 -e 'p "\u{01}".bytes.to_a'
 [240, 144, 128, 128]
 }}}

 Vincent do you have an idea?

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #773: Segfault occurs when specified $SAFE=4 and exception is generated.

2010-07-06 Thread MacRuby
#773: Segfault occurs when specified $SAFE=4 and exception is generated.
--+-
 Reporter:  watson1...@…  |Owner:  lsansone...@…
 Type:  defect|   Status:  closed   
 Priority:  blocker   |Milestone:  MacRuby 0.7  
Component:  MacRuby   |   Resolution:  fixed
 Keywords:|  
--+-
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 Should be fixed in r4318.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Fullscreen sample app

2010-07-06 Thread Michael Jackson
Hi all,

I created a fullscreen sample app in MacRuby, and I thought someone
else might be able to get some use out of it.

http://mjijackson.com/2010/07/fullscreen-macruby
http://github.com/mjijackson/Fullscreen

It's basically a port of someone else's Objective-C code, but it uses
NSApp's presentation options to control automatic hiding/showing of
the menu bar and dock instead of doing it manually. If anyone has any
feedback for me, I'd love to hear it.

Enjoy,

Michael

--
Michael Jackson
http://mjijackson.com
@mjijackson
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Fullscreen sample app

2010-07-06 Thread Laurent Sansonetti
Hi Michael,

Thanks for porting it :) Would you mind if we bundle your sample as part of the 
MacRuby sample code? If you agree, would you also be willing to license the 
code under the Ruby license? (which is the default license for everything in 
MacRuby, so no need to mention it).

Laurent

On Jul 6, 2010, at 4:48 PM, Michael Jackson wrote:

> Hi all,
> 
> I created a fullscreen sample app in MacRuby, and I thought someone
> else might be able to get some use out of it.
> 
> http://mjijackson.com/2010/07/fullscreen-macruby
> http://github.com/mjijackson/Fullscreen
> 
> It's basically a port of someone else's Objective-C code, but it uses
> NSApp's presentation options to control automatic hiding/showing of
> the menu bar and dock instead of doing it manually. If anyone has any
> feedback for me, I'd love to hear it.
> 
> Enjoy,
> 
> Michael
> 
> --
> Michael Jackson
> http://mjijackson.com
> @mjijackson
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Fullscreen sample app

2010-07-06 Thread Michael Jackson
Of course, that's fine with me. ;) Would you like a patch or are you
going to merge it in yourself?

--
Michael Jackson
http://mjijackson.com
@mjijackson



On Tue, Jul 6, 2010 at 6:21 PM, Laurent Sansonetti
 wrote:
> Hi Michael,
>
> Thanks for porting it :) Would you mind if we bundle your sample as part of 
> the MacRuby sample code? If you agree, would you also be willing to license 
> the code under the Ruby license? (which is the default license for everything 
> in MacRuby, so no need to mention it).
>
> Laurent
>
> On Jul 6, 2010, at 4:48 PM, Michael Jackson wrote:
>
>> Hi all,
>>
>> I created a fullscreen sample app in MacRuby, and I thought someone
>> else might be able to get some use out of it.
>>
>> http://mjijackson.com/2010/07/fullscreen-macruby
>> http://github.com/mjijackson/Fullscreen
>>
>> It's basically a port of someone else's Objective-C code, but it uses
>> NSApp's presentation options to control automatic hiding/showing of
>> the menu bar and dock instead of doing it manually. If anyone has any
>> feedback for me, I'd love to hear it.
>>
>> Enjoy,
>>
>> Michael
>>
>> --
>> Michael Jackson
>> http://mjijackson.com
>> @mjijackson
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel