On Tue, Dec 9, 2008 at 10:44 AM, Michael DeHaan <mdehaan(a)redhat.com> wrote:
Steve Milner wrote:
> On Sat, Dec 6, 2008 at 5:00 PM, Max Spevack <mspevack(a)redhat.com> wrote:
>
>> I'm trying to do a fresh run of ekg -- without a pre-existing database,
>> and I think I found a bug, but I don't know how to fix it.
>>
>> I don't really understand how it figures out if a database exists or not
>> (it's looking for the sqlite3.db file, I suppose. Regardless, if you
>> run an ekg --scan w/ no db existing, the "foo" is printed, but the
"bar"
>> never is, meaning that the database is never properly initialized.
>>
>> Something in the line in between is triggering the exception, and then
>> the "using existing database" code path tries to execute, leading to
the
>> program crashing when it tries to do stuff with a database that was
>> never fully set up.
>>
>> [spevack@localhost v2]$ git diff db.rb
>> diff --git a/v2/db.rb b/v2/db.rb
>> index b172cb0..81e519a 100644
>> --- a/v2/db.rb
>> +++ b/v2/db.rb
>> @@ -22,7 +22,9 @@ class Db
>> begin
>> ActiveRecord::Schema.define do
>> create_table :scans do |table|
>> + puts "foo"
>> table.column :url
>> + puts "bar"
>> end
>> create_table :posts do |table|
>> table.column :url, :string
>> table.column :subject, :string
>> table.column :list_id, :string
>> table.column :from_domain, :string
>> table.column :from_addr, :string
>> table.column :sent_date, :date
>> end
>> end
>> rescue
>> puts "using existing database"
>> end
>> end
>>
>> _______________________________________________
>> ekg mailing list
>> ekg(a)lists.fedorahosted.org
>>
https://fedorahosted.org/mailman/listinfo/ekg
>>
>>
>
> I submitted a patch that I *think* fixes this .... the issue was a
> missing type ...
>
>
> - table.column :url
> + table.column :url, :string
> _______________________________________________
> ekg mailing list
> ekg(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/ekg
>
Strange, didn't happen to me ... also, sqlite does not have types.
_______________________________________________
ekg mailing list
ekg(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/ekg
Hmmm ... that is odd. Now I know if you already had a DB and ran the
code it would work fine .... but creating a new DB is where it would
error out for me.