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
On Sat, Dec 6, 2008 at 5:00 PM, Max Spevack mspevack@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
endputs "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
ekg mailing list ekg@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
On Sat, 6 Dec 2008, Steve Milner wrote:
I submitted a patch that I *think* fixes this .... the issue was a missing type ...
table.column :url
table.column :url, :string
Well that seems pretty easy, and obvious when you compare the scans table to the posts table. I really need to learn a bit about database code, in any language. :P
I just tried it out, and that fixed it.
--Max
On Sun, 7 Dec 2008, Max Spevack wrote:
I just tried it out, and that fixed it.
http://git.fedorahosted.org/git/?p=ekg.git;a=commit;h=dd93621ff7599a5cbf2fb8...
or
--Max
On Sun, Dec 7, 2008 at 2:34 AM, Max Spevack mspevack@redhat.com wrote:
On Sat, 6 Dec 2008, Steve Milner wrote:
I submitted a patch that I *think* fixes this .... the issue was a missing type ...
table.column :url
table.column :url, :string
Well that seems pretty easy, and obvious when you compare the scans table to the posts table. I really need to learn a bit about database code, in any language. :P
I just tried it out, and that fixed it.
--Max _______________________________________________ ekg mailing list ekg@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/ekg
For ekg the AR documentation is helpful ... http://ar.rubyonrails.com/ ... I know Ruby but don't consider myself a 'Ruby guy' so referencing ruby/RoR docs is how I roll :-)
Steve Milner wrote:
On Sat, Dec 6, 2008 at 5:00 PM, Max Spevack mspevack@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
endputs "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
ekg mailing list ekg@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@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/ekg
Strange, didn't happen to me ... also, sqlite does not have types.
On Tue, Dec 9, 2008 at 10:44 AM, Michael DeHaan mdehaan@redhat.com wrote:
Steve Milner wrote:
On Sat, Dec 6, 2008 at 5:00 PM, Max Spevack mspevack@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
endputs "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
ekg mailing list ekg@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@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@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.