[iPhone] DateTime (lib/dateOrig.rb:1388) Application crash


Hi all,

Whenever I want to compare DateTime to nil, application crashes.

I am using Rho 4.1. on Mac. Testing device: iPhone 4.5 (iOS7.1)

Here are two lines:

    Rho::Log.error("Is Null:" + DateTime.parse('2013-01-01').inspect, "TXT");

    Rho::Log.error("Is Null:" + (DateTime.parse('2013-01-01') != nil).inspect, "TXT");

In RhoSimulator is everything OK app in XCode just crashes.

RhoSimulator Log:

I 04/10/2014 16:56:21:289 0dcec000              RhoRuby| require_compiled: date

I 04/10/2014 16:56:21:289 0dcec000              RhoRuby| require_compiled: dateOrig

I 04/10/2014 16:56:21:294 0dcec000              RhoRuby| require_compiled: date/format

E 04/10/2014 16:56:21:301 0dcec000               RubyVM| /Users/bartosz.bodzon/.rvm/gems/ruby-1.9.3-p545/gems/rhodes-4.1.1/lib/framework/date.rb:14: warning: already initialized constant MONTHNAMES

E 04/10/2014 16:56:21:301 0dcec000               RubyVM| /Users/bartosz.bodzon/.rvm/gems/ruby-1.9.3-p545/gems/rhodes-4.1.1/lib/framework/date.rb:15: warning: already initialized constant ABBR_MONTHNAMES

E 04/10/2014 16:56:21:301 0dcec000               RubyVM| /Users/bartosz.bodzon/.rvm/gems/ruby-1.9.3-p545/gems/rhodes-4.1.1/lib/framework/date.rb:16: warning: already initialized constant DAYNAMES

E 04/10/2014 16:56:21:301 0dcec000               RubyVM| /Users/bartosz.bodzon/.rvm/gems/ruby-1.9.3-p545/gems/rhodes-4.1.1/lib/framework/date.rb:17: warning: already initialized constant ABBR_DAYNAMES

E 04/10/2014 16:56:21:304 0dcec000                  TXT| Is Null:#<DateTime: 2013-01-01T00:00:00+00:00 (4912587/2,0/1,2299161)>

E 04/10/2014 16:56:21:304 0dcec000                  TXT| Is Null:true

iOS Log:

I 04/10/2014 16:58:39:956 039a8000              RhoRuby| require_compiled: date

I 04/10/2014 16:58:39:961 039a8000              RhoRuby| require_compiled: dateOrig

I 04/10/2014 16:58:40:067 039a8000              RhoRuby| require_compiled: date/format

E 04/10/2014 16:58:40:202 039a8000               RubyVM| lib/date.rb:14: warning: already initialized constant MONTHNAMES

E 04/10/2014 16:58:40:203 039a8000               RubyVM| lib/date.rb:15: warning: already initialized constant ABBR_MONTHNAMES

E 04/10/2014 16:58:40:203 039a8000               RubyVM| lib/date.rb:16: warning: already initialized constant DAYNAMES

E 04/10/2014 16:58:40:203 039a8000               RubyVM| lib/date.rb:17: warning: already initialized constant ABBR_DAYNAMES

E 04/10/2014 16:58:40:217 039a8000                  TXT| Is Null:#<DateTime: 2013-01-01T00:00:00+00:00 (4912587/2,0/1,2299161)>

E 04/10/2014 16:58:40:220 039a8000               RubyVM| lib/dateOrig.rb:1388:  [BUG]

E 04/10/2014 16:58:40:220 039a8000               RubyVM| Stack consistency error (sp: 52, bp: 51)

E 04/10/2014 16:58:40:220 039a8000               RubyVM| Description: ruby 1.9.2p290 (2011-07-09) [x86_64-darwin10.7.0]

E 04/10/2014 16:58:40:220 039a8000               RubyVM| -- control frame ----------

E 04/10/2014 16:58:40:221 039a8000               RubyVM| c:0010

E 04/10/2014 16:58:40:221 039a8000               RubyVM| p:0127

E 04/10/2014 16:58:40:221 039a8000               RubyVM| s:0052 b:0051

E 04/10/2014 16:58:40:221 039a8000               RubyVM| l:000050

E 04/10/2014 16:58:40:221 039a8000               RubyVM| d:000050

E 04/10/2014 16:58:40:221 039a8000               RubyVM| METHOD

E 04/10/2014 16:58:40:221 039a8000               RubyVM|  lib/dateOrig.rb:1388

E 04/10/2014 16:58:40:221 039a8000               RubyVM|

E 04/10/2014 16:58:40:222 039a8000               RubyVM| c:0009

E 04/10/2014 16:58:40:222 039a8000               RubyVM| p:----

E 04/10/2014 16:58:40:222 039a8000               RubyVM| s:0045 b:0045

E 04/10/2014 16:58:40:222 039a8000               RubyVM| l:000044

E 04/10/2014 16:58:40:222 039a8000               RubyVM| d:000044

E 04/10/2014 16:58:40:222 039a8000               RubyVM| FINISH

E 04/10/2014 16:58:40:222 039a8000               RubyVM|

E 04/10/2014 16:58:40:223 039a8000               RubyVM| ---------------------------

E 04/10/2014 16:58:40:223 039a8000               RubyVM| -- Ruby level backtrace information ----------------------------------------

E 04/10/2014 16:58:40:223 039a8000               RubyVM| lib/rho/rho.rb:843:in `serve'

E 04/10/2014 16:58:40:223 039a8000               RubyVM| lib/rho/rhoapplication.rb:217:in `serve'

E 04/10/2014 16:58:40:223 039a8000               RubyVM| lib/rho/rhocontroller.rb:101:in `serve'

E 04/10/2014 16:58:40:223 039a8000               RubyVM| apps/app/Settings/settings_controller.rb:22:in `login'

E 04/10/2014 16:58:40:223 039a8000               RubyVM| apps/app/Settings/settings_controller.rb:22:in `!='

E 04/10/2014 16:58:40:224 039a8000               RubyVM| apps/app/Settings/settings_controller.rb:22:in `=='

E 04/10/2014 16:58:40:224 039a8000               RubyVM| lib/dateOrig.rb:1388:in `<=>'

E 04/10/2014 16:58:40:423 039a8000               RubyVM| -- C level backtrace information -------------------------------------------

E 04/10/2014 16:58:40:424 039a8000               RubyVM| 0   rhorunner                           0x0046a577 rb_vm_bugreport + 142

E 04/10/2014 16:58:40:424 039a8000               RubyVM| 1   rhorunner                           0x003931af report_bug + 266

E 04/10/2014 16:58:40:426 039a8000               RubyVM| 2   rhorunner                           0x0039309b rb_bug + 50

E 04/10/2014 16:58:40:426 039a8000               RubyVM| 3   rhorunner                           0x0045a19d vm_exec_core + 9592

E 04/10/2014 16:58:40:427 039a8000               RubyVM| 4   rhorunner                           0x004610b1 vm_exec + 80

E 04/10/2014 16:58:40:427 039a8000               RubyVM| 5   rhorunner                           0x0045fc13 vm_call0 + 314

E 04/10/2014 16:58:40:427 039a8000               RubyVM| 6   rhorunner                           0x004669cf rb_call0 + 130

E 04/10/2014 16:58:40:428 039a8000               RubyVM| 7   rhorunner                           0x0046043b rb_call + 54

E 04/10/2014 16:58:40:428 039a8000               RubyVM| 8   rhorunner                           0x0045f119 rb_funcall + 200

E 04/10/2014 16:58:40:428 039a8000               RubyVM| 9   rhorunner                           0x0036f70b cmp_eq + 38

E 04/10/2014 16:58:40:429 039a8000               RubyVM| 10  rhorunner                           0x00398da1 rb_rescue2 + 116

E 04/10/2014 16:58:40:429 039a8000               RubyVM| 11  rhorunner                           0x00398efd rb_rescue + 60

E 04/10/2014 16:58:40:430 039a8000               RubyVM| 12  rhorunner                           0x0036f533 cmp_equal + 98

E 04/10/2014 16:58:40:430 039a8000               RubyVM| 13  rhorunner                           0x0046753b call_cfunc + 230

E 04/10/2014 16:58:40:430 039a8000               RubyVM| 14  rhorunner                           0x0045fcc7 vm_call0 + 494

E 04/10/2014 16:58:40:430 039a8000               RubyVM| 15  rhorunner                           0x004669cf rb_call0 + 130

E 04/10/2014 16:58:40:431 039a8000               RubyVM| 16  rhorunner                           0x0046043b rb_call + 54

E 04/10/2014 16:58:40:431 039a8000               RubyVM| 17  rhorunner                           0x0045f119 rb_funcall + 200

E 04/10/2014 16:58:40:431 039a8000               RubyVM| 18  rhorunner                           0x003cf3e1 rb_obj_not_equal + 36

E 04/10/2014 16:58:40:431 039a8000               RubyVM| 19  rhorunner                           0x0046753b call_cfunc + 230

E 04/10/2014 16:58:40:431 039a8000               RubyVM| 20  rhorunner                           0x00469d09 vm_call_cfunc + 252

E 04/10/2014 16:58:40:431 039a8000               RubyVM| 21  rhorunner                           0x00468a81 vm_call_method + 244

E 04/10/2014 16:58:40:432 039a8000               RubyVM| 22  rhorunner                           0x0045bc25 vm_exec_core + 16384

E 04/10/2014 16:58:40:432 039a8000               RubyVM| 23  rhorunner                           0x004610b1 vm_exec + 80

E 04/10/2014 16:58:40:432 039a8000               RubyVM| 24  rhorunner                           0x0045fc13 vm_call0 + 314

E 04/10/2014 16:58:40:433 039a8000               RubyVM| 25  rhorunner                           0x004669cf rb_call0 + 130

E 04/10/2014 16:58:40:433 039a8000               RubyVM| 26  rhorunner                           0x0046043b rb_call + 54

E 04/10/2014 16:58:40:434 039a8000               RubyVM| 27  rhorunner                           0x0045f119 rb_funcall + 200

E 04/10/2014 16:58:40:434 039a8000               RubyVM| 28  rhorunner                           0x00488ed1 callFramework + 44

E 04/10/2014 16:58:40:435 039a8000               RubyVM| 29  rhorunner                           0x0027a83d _ZN3rho3net11CHttpServer6decideERKSsS3_S3_RKNS_6VectorINS0_10HttpHeaderEEES3_ + 680

E 04/10/2014 16:58:40:435 039a8000               RubyVM| 30  rhorunner                           0x00278ab3 _ZN3rho3net11CHttpServer7processEi + 838

E 04/10/2014 16:58:40:435 039a8000               RubyVM| 31  rhorunner                           0x00278487 _ZN3rho3net11CHttpServer3runEv + 1106

E 04/10/2014 16:58:40:436 039a8000               RubyVM| 32  rhorunner                           0x00333137 _ZN3rho6common10CRhodesApp3runEv + 666

E 04/10/2014 16:58:40:436 039a8000               RubyVM| 33  rhorunner                           0x00264f05 _ZN3rho6common10CRhoThread9runObjectEv + 40

E 04/10/2014 16:58:40:437 039a8000               RubyVM| 34  rhorunner                           0x0027695b _ZN3rho6common7runProcEPv + 26

E 04/10/2014 16:58:40:437 039a8000               RubyVM| 35  libsystem_pthread.dylib             0x39617919 <redacted> + 140

E 04/10/2014 16:58:40:437 039a8000               RubyVM| 36  libsystem_pthread.dylib             0x3961788b _pthread_start + 102

E 04/10/2014 16:58:40:438 039a8000               RubyVM| 37  libsystem_pthread.dylib             0x39615aa4 thread_start + 8

E 04/10/2014 16:58:40:438 039a8000               RubyVM|




Robin West
I have made a hack to get

I have made a hack to get around it, in case this will not get fixed:

dateObj = DateTime.parse('2010-01-01')

dateObjNil = dateObjNil.inspect == "nil"

and then instead of comparing dateObj to nil I check whether dateObjNil is true.

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Alex Marginson
Yep, exact same error here,

Yep, exact same error here, whether I'm comparing using == nil or != nil.

I use .nil?() == instead and it doesn't crash.

Sorry, forgot to say this is on android 4.3, deploying from a Windows 7 machine, using RhoStudio 5.0.3

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments