Post install script fails - undefined perl sub bsd_glob

RESOLVED WORKSFORME

Status

SeaMonkey
Build Config
--
blocker
RESOLVED WORKSFORME
15 years ago
12 years ago

People

(Reporter: jakyar, Assigned: blizzard)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021017
Build Identifier: ftp.mozilla.org/pub/releases/mozilla/mozilla1.3b/Red_Hat_7x_RPMS/RPMS/i386/mozilla-1.3b-0.i386.rpm

I run Redhat 7.2, kernel 2.4.20, on AMD Thunderbird 1.13G with 512M memory

Root executed "rpm - Uvh  --force /home/jayar/mozilla-1.3b-0.i386.rpm"
Install failed with message:

"undefined subroutine &main::bsd_glob called at
/usr/lib/mozilla-1.3b/mozilla-rebuild-databases.pl 
  line 93
  error:  execution of %post scriplet from mozilla-1.3b-0.i386.rpm failed, exit
status 255"

Mozilla 1.3b won't load/execute.

Reproducible: Always

Steps to Reproduce:
1.Just execute command on second line of Details, above.  
2.
3.

Actual Results:  
See Details above

Expected Results:  
rpm normal satisfactory install

Comment 1

15 years ago
It looks like the perl script had a problem.  What version of perl do you have?

RPMs => blizzard
Assignee: dveditz → blizzard
Component: Installer → Build Config
QA Contact: bugzilla → granrose
(Assignee)

Comment 2

15 years ago
Yeah, I thought that bsd_glob had been around for a while.  I do admit though
that I haven't tested it on 7.2.
(Reporter)

Comment 3

15 years ago
I'm running Perl 5.6.0 - jakyar

Updated

15 years ago
Summary: Post install script fails - undefined subroutine → Post install script fails - undefined perl sub bsd_glob

Comment 4

15 years ago
*** Bug 197625 has been marked as a duplicate of this bug. ***

Comment 5

15 years ago
Created attachment 117490 [details] [diff] [review]
Use perl's classic globbing syntax.

Perl's classic glob syntax is to enclose the pattern in <>. This syntax has
probably been around since perl v4 if not earler, and it's being used elsewhere
in the script (line 18). None of bsd_glob()'s additional features are being
used here, so the classic glob syntax should work fine.

If LIBDIR or MOZILLA_VERSION contains white space, classic glob will treat it
as multiple patterns where bsd_glob() won't--of course, if this happens, it'll
also break the glob on line 18. If this is considered an issue then the pattern
can be stored in a variable and fixed up before globbing.

Unfortunately I'm not in a position where I can test this patch. Someone else
will have to do that.

Comment 6

15 years ago
Doesn't the patch have an extra ')' which causes perl to bail?

Comment 7

15 years ago
I've been getting the same error as reported in this issue and in bug 197625
since (at least) Mozilla 1.3b on a RedHat 7.2 box, and am still getting it with
Mozilla 1.3 final.

dlr@warrior:dlr$ rpm -q perl
perl-5.6.0-17
dlr@warrior:dlr$ /usr/bin/perl -w
use File::Glob ':glob';
print bsd_glob("/usr/lib/mozilla-1.3/chrome/lang/lang-*.txt"), "\n";
Undefined subroutine &main::bsd_glob called at - line 2.

My Perl 5.6.0 comes with File::Glob version 0.991, which does not define a
bsd_glob subroutine.  I've noticed a File::BSDGlob module on CPAN
<http://cpan.org/modules/by-module/File/> which contains a C implementation of
the bsd_glob() routine, but it is not installed on my RH 7.2 box.

I concur with jt.marsh@excite.com's comments about the extra closing paren in
patch already attached to this issue, but disagree that Perl's built-in glob()
is the way to go -- my laptop certainly didn't appreciate it:

dlr@warrior:dlr$ sudo /usr/lib/mozilla-1.3/mozilla-rebuild-databases.pl 
Password:
Out of memory!

A better implementation actually uses the File::Glob module imported by the
script, being carefull to use the fully qualified name of the glob() subroutine
to avoid accidently invoking Perl's built-in version:

--- /usr/lib/mozilla-1.3/mozilla-rebuild-databases.pl	Thu Mar 20 12:05:38 2003
+++ /home/dlr/mozilla-rebuild-databases.pl	Thu Mar 20 12:05:38 2003
@@ -2,7 +2,7 @@
 
 use File::Path;
 use File::Copy;
-use File::Glob ":glob";
+use File::Glob;
 use POSIX ":sys_wait_h";
 
 $timeout = 60;
@@ -90,7 +90,7 @@
     copy("/usr/lib/mozilla-1.3/chrome/lang/installed-chrome.txt",
 	 \*OUTPUT);
 
-    foreach (bsd_glob("/usr/lib/mozilla-1.3/chrome/lang/lang-*.txt")) {
+    foreach (File::Glob::glob("/usr/lib/mozilla-1.3/chrome/lang/lang-*.txt")) {
 	copy($_, \*OUTPUT);
     }
 
 
The import of File::Glob's glob() subroutine was removed from the "use"
statement to avoiding fooling people into thinking that we're actually able to
override Perl's built-in.

Comment 8

15 years ago
My workstation at home currently runs a slightly newer version of RedHat (7.3),
and includes a newer version of Perl which doesn't have this problem because its
version File::Glob (also listed as 0.991, bleh) defines bsd_glob() routine and
exports it via the ':glob' tag:

dlr@despot:svn$ rpm -q perl
perl-5.6.1-34.99.6


sub bsd_glob {
    my ($pat,$flags) = @_;
    $flags = $DEFAULT_FLAGS if @_ < 2;
    return doglob($pat,$flags);
}

# File::Glob::glob() is deprecated because its prototype is different from
# CORE::glob() (use bsd_glob() instead)
sub glob {
    goto &bsd_glob;
}

What we're dealing with here is a situation where the RedHat 7.x series of RPMs
are using a subroutine which doesn't necessarilly exist on RedHat 7.x.  

Since File::Glob::glob() has been deprecated (with good reason) in favor of the
name bsd_glob(), I wouldn't suggest changing the mainline
mozilla-rebuild-databases.pl script to use the deprecated name.  One reasonable
solution is to use a patch for the RedHat 7.x series of RPMs which uses the
fully qualified File::Glob::glob() in place of bsd_glob().

Another more 100% backwards compatible (but slightly messier) solution would be
to check whether File::Glob::bsd_glob() is defined, and fall back to using
File::Glob::glob() otherwise.  This would make sense in Mozilla's trunk, as it
would work both on older systems which have new versions of Perl installed, and
on systems with old versions of Perl installed, and on systems with
bogus/outdated File::Glob modules in their Perl's library path.

Comment 9

15 years ago
Perl didn't come with File::Glob until 5.6. If there's a desire to support
versions of perl before 5.6, then the script shouldn't depend on File::Glob.

Perl 5.6 and later supposedly loads File::Glob automatically to support the
builtin <pattern> and glob(pattern) functions. So once again, using a core
globbing function should be sufficient. Comment 7 notes an out-of-memory error
trying to do that, but the mechanism is supposed to work.

Explicitly calling File::Glob::glob() should be avoided. As noted in comment 8,
the function is deprecated and may disappear in the future. And we all know that
bsd_glob() should be avoided because it may not be there either.

As I noted previously, there's another glob earlier in the script using the core
<pattern> syntax, which apparently isn't causing anyone any trouble.

Bottom line, I still like my original patch, without the extraneous ')' of
course. The reason for that out-of-memory error needs to be determined, though.
Status: UNCONFIRMED → NEW
Ever confirmed: true
*** Bug 200725 has been marked as a duplicate of this bug. ***

Comment 11

15 years ago
I had the same problem in Red Hat Linux 7.1 (Kernel 2.4.18 RPM) when
upgrading/installing Mozilla v1.4. I have perl-5.6.0-12.
Product: Browser → Seamonkey

Comment 12

12 years ago
This bug is quite old - can it be closed ?

Comment 13

12 years ago
yes.  Mozilla no longer ships RPMs, so this problem is no longer relevant.
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → WORKSFORME

Comment 14

12 years ago
What a fantastic solution. :-\
You need to log in before you can comment on or make changes to this bug.