Closed Bug 275752 Opened 20 years ago Closed 20 years ago

Make checksetup.pl chdir to the bugzilla directory

Categories

(Bugzilla :: Installation & Upgrading, defect)

2.18
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: glob, Assigned: glob)

Details

Attachments

(1 file, 2 obsolete files)

checksetup.pl fails if the current working directory isn't bugzilla.

this is expected, however the error message is the standard perl library error:

  Can't locate Bugzilla/Constants.pm in @INC

it'd be easy, and nice, to get checksetup.pl to check the cwd and throw a
different error, such as

  You must run checksetup.pl from the Bugzilla directory
Attached patch v1 (obsolete) — Splinter Review
Attachment #169415 - Flags: review?
or even better, make checksetup.pl to change the cwd to bugzilla.
Attachment #169415 - Attachment is obsolete: true
Attachment #169415 - Flags: review?
Attached patch v2 (obsolete) — Splinter Review
this does a cwd instead of throwing an error.

as the cwd uses File::Basename, we have to ensure the perl version is checked
before we can use it (File::Basename is part of the 5.6 core).
Attachment #169439 - Flags: review?
I think that the check and die from the first patch could still be done - in
case someone has been mad enough to move checksetup.pl.

Also, should we indicate that we have done the change directory?
> I think that the check and die from the first patch could still be done - in
> case someone has been mad enough to move checksetup.pl.

if someone moves checksetup.pl, they are asking for trouble.  what if they move
Bugzilla/Constants, or any other file?  i think we're best off assuming that the
files will be in the correct location.

> Also, should we indicate that we have done the change directory?

personally i don't think so.  things "should just work", the user doesn't need
to know every detail that happened in order to acheive this.
Comment on attachment 169439 [details] [diff] [review]
v2

This looks good to me.

I have a couple of questions.
Is there a reason to have the chdir part inside the BEGIN block?
Does it make sense to keep require 5.006 inside the BEGIN block, right after
the Win32 5.8.1 check?
And why did you replace the unless/die-combinations by require-statements?
I'm fine with these changes, in fact I like the require variant better, I'm
just curious...

Live and learn: when testing, I was surprised to see that chdir() switches
drives on Win32. Didn't know that. Good thing, makes the patch work.
Attachment #169439 - Flags: review? → review+
Flags: approval?
Attached patch v3Splinter Review
> Is there a reason to have the chdir part inside the BEGIN block?

yes, "uses" is compile time, so the chdir needs to happen at compile time also.
 

> Does it make sense to keep require 5.006 inside the BEGIN block, right after
> the Win32 5.8.1 check?

yes, that's logical.  don't know what i was thinking before.  here's an update.

carrying forward r+

> And why did you replace the unless/die-combinations by require-statements?
> I'm fine with these changes, in fact I like the require variant better, I'm
> just curious...

a few reasons:

  1.  it's the standard perl way of checking for the version
  2.  it's less, cleaner code
  3.  the error message includes the current perl version
Attachment #169439 - Attachment is obsolete: true
Attachment #170318 - Flags: review+
I hate to be messing with this kind of stuff in checksetup.pl during a freeze,
but this is a frequent support issue lately, so better to nip it sooner than
later...
Flags: approval? → approval+
Target Milestone: --- → Bugzilla 2.20
Whiteboard: patch awating checkin
Checking in checksetup.pl;
/cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v  <--  checksetup.pl
new revision: 1.328; previous revision: 1.327
done
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Summary: checksetup.pl should check that the cwd is bugzilla → Make checksetup.pl chdir to the bugzilla directory
Whiteboard: patch awating checkin
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: