checksetup fails if database exists with non-Bugzilla table

RESOLVED FIXED in Bugzilla 2.20

Status

()

RESOLVED FIXED
13 years ago
12 years ago

People

(Reporter: nb+bz, Assigned: bugzilla-mozilla)

Tracking

2.22
Bugzilla 2.20
Bug Flags:
approval +
approval2.22 +
approval2.20 +

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

13 years ago
If I try to install Bugzilla and the database already exists, with no Bugzilla tables but a non-Bugzilla table, then the second invocation of checksetup.pl fails.  Like this (this shell transcript is from the start of the first checksetup.pl invocation):

$ perl checksetup.pl

Checking perl modules ...
Checking for       AppConfig (v1.52)   ok: found v1.56
Checking for             CGI (v2.93)   ok: found v3.15
Checking for    Data::Dumper (any)     ok: found v2.121
Checking for    Date::Format (v2.21)   ok: found v2.22
Checking for             DBI (v1.38)   ok: found v1.50
Checking for      File::Spec (v0.84)   ok: found v3.15
Checking for      File::Temp (any)     ok: found v0.16
Checking for        Template (v2.08)   ok: found v2.14
Checking for      Text::Wrap (v2001.0131) ok: found v2001.0929
Checking for    Mail::Mailer (v1.67)   ok: found v1.67
Checking for    MIME::Base64 (v3.01)   ok: found v3.07
Checking for    MIME::Parser (v5.406)  ok: found v5.419
Checking for        Storable (any)     ok: found v2.15

The following Perl modules are optional:
Checking for              GD (v1.20)   ok: found v2.25
Checking for     Chart::Base (v1.0)    ok: found v2.3
Checking for       XML::Twig (any)      not found
Checking for       GD::Graph (any)     ok: found v1.4305
Checking for GD::Text::Align (any)     ok: found v1.18
Checking for     PatchReader (v0.9.4)  ok: found v0.9.5
Checking for   Image::Magick (any)      not found

If you want to use the bug import/export feature to move bugs to
or from other bugzilla installations, you will need to install
 the XML::Twig module by running (as root):

   perl -MCPAN -e 'install "XML::Twig"'

If you want to convert BMP image attachments to PNG to conserve
disk space, you will need to install the ImageMagick application
Available from http://www.imagemagick.org, and the Image::Magick
Perl module by running (as root):

   perl -MCPAN -e 'install "Image::Magick"'

Checking user setup ...

OPTIONAL NOTE: If you want to be able to use the
 'difference between two patches' featureof Bugzilla (requires
 the PatchReader Perl module as well), you should install
 patchutils from http://cyberelk.net/tim/patchutils/


This version of Bugzilla contains some variables that you may 
want to change and adapt to your local settings. Please edit the
file './localconfig' and rerun checksetup.pl

The following variables are new to localconfig since you last ran
checksetup.pl:   index_html cvsbin interdiffbin diffpath create_htaccess webservergroup db_driver db_host db_pass db_sock db_check

$ mysqladmin -u bugs create bz222test
$ mysql -u bugs bz222test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2890 to server version: 4.0.26

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table spong ( foo tinytext );
Query OK, 0 rows affected (0.01 sec)

mysql> Bye
$ perl checksetup.pl

Checking perl modules ...
Checking for       AppConfig (v1.52)   ok: found v1.56
Checking for             CGI (v2.93)   ok: found v3.15
Checking for    Data::Dumper (any)     ok: found v2.121
Checking for    Date::Format (v2.21)   ok: found v2.22
Checking for             DBI (v1.38)   ok: found v1.50
Checking for      File::Spec (v0.84)   ok: found v3.15
Checking for      File::Temp (any)     ok: found v0.16
Checking for        Template (v2.08)   ok: found v2.14
Checking for      Text::Wrap (v2001.0131) ok: found v2001.0929
Checking for    Mail::Mailer (v1.67)   ok: found v1.67
Checking for    MIME::Base64 (v3.01)   ok: found v3.07
Checking for    MIME::Parser (v5.406)  ok: found v5.419
Checking for        Storable (any)     ok: found v2.15

The following Perl modules are optional:
Checking for              GD (v1.20)   ok: found v2.25
Checking for     Chart::Base (v1.0)    ok: found v2.3
Checking for       XML::Twig (any)      not found
Checking for       GD::Graph (any)     ok: found v1.4305
Checking for GD::Text::Align (any)     ok: found v1.18
Checking for     PatchReader (v0.9.4)  ok: found v0.9.5
Checking for   Image::Magick (any)      not found

If you want to use the bug import/export feature to move bugs to
or from other bugzilla installations, you will need to install
 the XML::Twig module by running (as root):

   perl -MCPAN -e 'install "XML::Twig"'

If you want to convert BMP image attachments to PNG to conserve
disk space, you will need to install the ImageMagick application
Available from http://www.imagemagick.org, and the Image::Magick
Perl module by running (as root):

   perl -MCPAN -e 'install "Image::Magick"'

Checking user setup ...
Creating data directory (./data) ...
Creating local attachments directory ...
Creating graphs directory...
Creating .htaccess...
Creating ./data/attachments/.htaccess...
Creating Bugzilla/.htaccess...
Creating ./data/.htaccess...
Creating ./template/.htaccess...
Creating ./data/webdot/.htaccess...
Precompiling templates ...
Checking for      DBD::mysql (v2.9003) ok: found v3.0002
Checking for           MySQL (v4.0.14) ok: found v4.0.26

<h1>Software error:</h1>
<pre>DBD::mysql::st execute failed: Table 'bz222test.bugs' doesn't exist [for Statement &quot;SHOW INDEX FROM bugs&quot;] at Bugzilla/DB/Mysql.pm line 634
	Bugzilla::DB::Mysql::bz_index_info_real('Bugzilla::DB::Mysql=HASH(0x9a6e170)', 'bugs', 'assigned_to') called at Bugzilla/DB/Mysql.pm line 297
	Bugzilla::DB::Mysql::bz_setup_database('Bugzilla::DB::Mysql=HASH(0x9a6e170)') called at checksetup.pl line 1601
</pre>
<p>
For help, please send mail to this site's webmaster, giving this error message 
and the time and date of the error.

</p>
[Tue Jun 13 14:08:46 2006] checksetup.pl: DBD::mysql::st execute failed: Table 'bz222test.bugs' doesn't exist [for Statement "SHOW INDEX FROM bugs"] at Bugzilla/DB/Mysql.pm line 634
[Tue Jun 13 14:08:46 2006] checksetup.pl: 	Bugzilla::DB::Mysql::bz_index_info_real('Bugzilla::DB::Mysql=HASH(0x9a6e170)', 'bugs', 'assigned_to') called at Bugzilla/DB/Mysql.pm line 297
[Tue Jun 13 14:08:46 2006] checksetup.pl: 	Bugzilla::DB::Mysql::bz_setup_database('Bugzilla::DB::Mysql=HASH(0x9a6e170)') called at checksetup.pl line 1601
$
(Reporter)

Comment 1

13 years ago
This is holding up P4DTI support for Bugzilla 2.22; it is triggered by the P4DTI test suite.  I am trying to make a workaround but would welcome any suggestions for a fix.
(Reporter)

Comment 2

13 years ago
Created attachment 225421 [details] [diff] [review]
patch for Bugzilla/DB/Mysql.pm in bugzilla 2.22

This one-line addition to Mysql.pm seems to fix it, at least for MySQL installations.
Attachment #225421 - Flags: review?
Comment on attachment 225421 [details] [diff] [review]
patch for Bugzilla/DB/Mysql.pm in bugzilla 2.22

Yeah, that's right, but use grep (which is built-in) instead of lsearch (which is our own function).
Attachment #225421 - Flags: review? → review-

Updated

13 years ago
Assignee: database → nb+bz

Updated

13 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → Bugzilla 2.20
Comment on attachment 225421 [details] [diff] [review]
patch for Bugzilla/DB/Mysql.pm in bugzilla 2.22

Actually, come to think of it, you can just remove the scalar(@tables) entirely and replace it with the grep.
(Reporter)

Comment 5

13 years ago
I copied the lsearch from the previous condition in that code.  I'll change it and try again, or someone else can; I'm not sure I have time this week and I'm away next week.
(Assignee)

Comment 6

13 years ago
Created attachment 225622 [details] [diff] [review]
Patch v2: Bugzilla HEAD 2006-06-14

Stealing bug as I wanted to review it, it was allowed, plus patch is easy.

Also fixing the other case of lsearch (which I added) + made if statement conform to Bugzilla code style.
Assignee: nb+bz → bugzilla-mozilla
Attachment #225421 - Attachment is obsolete: true
Attachment #225622 - Flags: review?(mkanat)
Comment on attachment 225622 [details] [diff] [review]
Patch v2: Bugzilla HEAD 2006-06-14

Nice. :-) I like the re-spacing of the other conditionals, too. :-)
Attachment #225622 - Flags: review?(mkanat) → review+

Updated

13 years ago
Flags: approval?
Flags: approval2.22?
Flags: approval2.20?
Flags: approval?
Flags: approval2.22?
Flags: approval2.22+
Flags: approval2.20?
Flags: approval2.20+
Flags: approval+

Comment 8

13 years ago
Comment on attachment 225622 [details] [diff] [review]
Patch v2: Bugzilla HEAD 2006-06-14

This patch doesn't apply cleanly to BUGZILLA-2_20-BRANCH.

[vladd@abacron-l Bugzilla-2_20]$ patch -p0 < ../patch.txt
patching file Bugzilla/DB/Mysql.pm
Hunk #1 FAILED at 262.
Hunk #2 FAILED at 283.
2 out of 2 hunks FAILED -- saving rejects to file Bugzilla/DB/Mysql.pm.rej
(Assignee)

Comment 9

13 years ago
Created attachment 226049 [details] [diff] [review]
Patch v2 for BUGZILLA-2_20-BRANCH (2006-06-18)

Backport for 2.20. In 2.20, the MySQL 4.1.0-4.1.15 bug isn't worked around, that is why the other patch fails to apply.
Attachment #226049 - Flags: review?(mkanat)

Comment 10

13 years ago
BUGZILLA-2_20-STABLE:

Checking in Bugzilla/DB/Mysql.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v  <--  Mysql.pm
new revision: 1.24.2.8; previous revision: 1.24.2.7
done

BUGZILLA-2_22-STABLE:

Checking in Bugzilla/DB/Mysql.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v  <--  Mysql.pm
new revision: 1.36.2.1; previous revision: 1.36
done

Trunk:

Checking in Bugzilla/DB/Mysql.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Mysql.pm,v  <--  Mysql.pm
new revision: 1.39; previous revision: 1.38
done
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED

Updated

13 years ago
Attachment #226049 - Flags: review?(mkanat) → review+
You do mean that you checked them into -BRANCH, and not -STABLE, right? (Since -STABLE isn't a branch tag.)

Comment 12

13 years ago
Right. s/STABLE/BRANCH/ in my last comment.
(Assignee)

Comment 13

12 years ago
*** Bug 357256 has been marked as a duplicate of this bug. ***
*** Bug 357256 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.