#207 ✓resolved
Martin Kihlgren

[patch] functions and variables in do_* collide

Reported by Martin Kihlgren | April 15th, 2008 @ 09:18 AM

Which means that if you load both do_mysql and do_postgres, the first to load will be the driver used in both cases (cConnection_initialize is defined in both files).

Its probably valid in do_sqlite3 as well, but my patch doesnt cover that.

What I did was just declare all functions static except the init functions, which have to be non-static to work.

This has uncovered another bug for me, though. If the bug is caused by this error or not is hard to tell, since it is impossible to trigger without fixing this issue.

To duplicate the new bug, just run:

ruby -I"/usr/lib/ruby/gems/1.8/gems/rspec-1.1.3/lib" -S rcov --exclude lib\/spec,bin\/spec,config\/boot.rb --exclude spec,environment.rb --text-summary --sort coverage --sort-reverse --only-uncovered -o "coverage" "/usr/lib/ruby/gems/1.8/gems/rspec-1.1.3/bin/spec" -- "/home/zond/gitroot/dm-core/spec/integration/postgres_adapter_spec.rb" "/home/zond/gitroot/dm-core/spec/integration/mysql_adapter_spec.rb" --format specdoc

Note, however, that:

ruby -I"/usr/lib/ruby/gems/1.8/gems/rspec-1.1.3/lib" -S rcov --exclude lib\/spec,bin\/spec,config\/boot.rb --exclude spec,environment.rb --text-summary --sort coverage --sort-reverse --only-uncovered -o "coverage" "/usr/lib/ruby/gems/1.8/gems/rspec-1.1.3/bin/spec" -- "/home/zond/gitroot/dm-core/spec/integration/mysql_adapter_spec.rb" "/home/zond/gitroot/dm-core/spec/integration/postgres_adapter_spec.rb" --format specdoc --colour

now works fine (and it caused errors before this patch).

Comments and changes to this ticket

  • Dan Kubb (dkubb)
  • Martin Kihlgren

    Martin Kihlgren April 16th, 2008 @ 08:07 AM

    • Title changed from “[patch] functions in do_mysql and do_postgres collide” to “[patch] functions and variables in do_* collide”

    Ok, here is a patch that makes all global vars and all functions except the init functions in do_sqlite3, do_postgres and do_mysql static.

    Now all tests in dm-core pass (for revision b5656eafd85e90f5ce352688e6530b39cac3cac1 with this patch applied, the next revision had other broken tests).

  • Guy van den Berg (guyvdb)

    Guy van den Berg (guyvdb) April 16th, 2008 @ 10:43 AM

    • Assigned user set to “Guy van den Berg (guyvdb)”
    • State changed from “new” to “resolved”

    All functions and variables made static - except init function. Patch applied.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Attachments

Pages