Closed Bug 298405 Opened 19 years ago Closed 19 years ago

whineatnews.pl can't find Bugzilla/BugMail.pm

Categories

(Bugzilla :: Whining, defect)

2.18.1
defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: john.mills, Assigned: glob)

References

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

If I use the command line for the whineat cron job shown in
http://www.bugzilla.org/docs/win32install.html

I get 
C:\Bugzilla>C:\Perl\bin\perl.exe -T C:\bugzilla\whineatnews.pl
Can't locate Bugzilla/BugMail.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/sit
e/lib) at C:\bugzilla\whineatnews.pl line 34.
BEGIN failed--compilation aborted at C:\bugzilla\whineatnews.pl line 34.


If you change the command-line to

C:\Perl\bin\perl.exe -I/bugzilla -T C:\bugzilla\whineatnews.pl

It works.

Unless I have screwed up the installation and the original command should have
workd, could someone update the installation guide?

Reproducible: Always

Steps to Reproduce:
1. Install as per "windows installation" instructions at 
http://www.bugzilla.org/docs/win32install.html

2. use a command-line prompt to run:
 C:\Perl\bin\perl.exe -T C:\bugzilla\whineatnews.pl 

(or let the cron job run, but you can't see the error message!)

Actual Results:  
C:\Bugzilla>C:\Perl\bin\perl.exe -T C:\bugzilla\whineatnews.pl
Can't locate Bugzilla/BugMail.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/sit
e/lib) at C:\bugzilla\whineatnews.pl line 34.
BEGIN failed--compilation aborted at C:\bugzilla\whineatnews.pl line 34.

Expected Results:  
C:\Bugzilla>C:\Perl\bin\perl.exe -I/bugzilla -T C:\bugzilla\whineatnews.pl
yourname@yourcomany.com      2

(for example)

I installed Version 2.18.1  and I took the CVS package, not the zip file.
When I describe a 'cron' job, I mean the windows scheduled tasks service.

It makes no difference at all where you run the original command-line.  It fails
the same way when the starting directory is c:\  c:\perl\bin c:\bugzilla
c:\bugzilla\bugzilla  etc
confirming.

this is due to a bug in whineatnews.pl, patch coming up.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Summary: cron job for wineatnews.pl needs /I switch to work → whineatnews.pl can't find Bugzilla/BugMail.pm
Target Milestone: --- → Bugzilla 2.18
Version: unspecified → 2.18.1
Attached patch v1Splinter Review
fix whineatnews.pl's @INC
Assignee: erik → bugzilla
Attachment #186985 - Flags: review?
i have updated http://www.bugzilla.org/docs/win32install.html with a reference
to this bug and the -I parameter.
this affects all platforms ..

[root@darling head]# perl -T whineatnews.pl 
Can't locate Bugzilla/BugMail.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i686-linux /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i686-linux /usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.005
/usr/lib/perl5/site_perl) at whineatnews.pl line 34.
BEGIN failed--compilation aborted at whineatnews.pl line 34.

by default @INC includes '.'; however '.' is dropped from @INC when you enable
taint mode.

Severity: normal → major
OS: Windows 2000 → All
Hardware: PC → All
Comment on attachment 186985 [details] [diff] [review]
v1

Yeah... I have no idea why that wasn't there before.
Attachment #186985 - Flags: review? → review+
Flags: approval?
Flags: approval2.18?
*** Bug 298453 has been marked as a duplicate of this bug. ***
I'm not sure if this is right.... (well, yes, we should have the use lib '.')
but this needs a documentation fix as well.

when you're running a cron job, there's no guarantee that the working directory
will be the one containing the script.  Everyplace I have this set up as a cron
job does it like this:

0 3 * * * (cd /path/to/bugzilla ; ./whineatnews.pl)

ditto for collectstats.pl.

We should add the use lib '.' line anyway, but has anyone checked to see that
doing that actually solves the problem that was reported?
Flags: approval?
Flags: approval2.18?
justdave,

> We should add the use lib '.' line anyway, but has anyone checked to see that
> doing that actually solves the problem that was reported?

yes i did.

normally the cwd is in the lib path, so whineatnews works if you cd prior to
execution.  however if you use taint mode '.' is dropped from the cwd, so
whineatnews won't work regardless of the cwd.

my sample in comment 4 was run in the bugzilla directory.


as an aside, checksetup will set the cwd if it's incorrect:

BEGIN {
    if ($^O =~ /MSWin32/i) {
        require 5.008001; # for CGI 2.93 or higher
    }
    require 5.006_001;
    use File::Basename;
    chdir dirname($0);
}

perhaps this should be added to *.pl ?
Flags: approval?
Flags: approval2.18?
yeah, probably should.
Flags: approval?
Flags: approval2.18?
Flags: approval2.18+
Flags: approval+
Checking in whineatnews.pl;
/cvsroot/mozilla/webtools/bugzilla/whineatnews.pl,v  <--  whineatnews.pl
new revision: 1.19; previous revision: 1.18
done

Checking in whineatnews.pl;
/cvsroot/mozilla/webtools/bugzilla/whineatnews.pl,v  <--  whineatnews.pl
new revision: 1.14.2.4; previous revision: 1.14.2.3
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: