Bug 144672 - perl needs dependency on specific libdb version
Summary: perl needs dependency on specific libdb version
Alias: None
Product: Fedora
Classification: Fedora
Component: perl   
(Show other bugs)
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: David Lawrence
Keywords: Reopened
Depends On:
TreeView+ depends on / blocked
Reported: 2005-01-10 15:59 UTC by Jonathan Kamens
Modified: 2008-01-02 21:12 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-01-02 21:12:58 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Jonathan Kamens 2005-01-10 15:59:48 UTC
I just upgraded to all the current packages in Fedora Core
Development, and DB_File stopped working in Perl:

DB_File needs compatible versions of libdb & db.h
	you have db.h version 4.3.21 and libdb version 4.3.27
Compilation failed in require at /home/jik/scripts/logwatch.pl line 6.
BEGIN failed--compilation aborted at /home/jik/scripts/logwatch.pl line 6.

Rpm didn't tell me that the version of Perl I have has a dependency on
an older version of libdb than the one I was installing.  It should have.

Comment 1 Ville Skyttä 2005-04-26 15:31:06 UTC
This kind of strict version check at runtime smells a bit over-eager to me, but
(luckily :)) I'm not familiar enough with libdb to tell if it's incorrect.

Anyway, the error message is certainly confusing: it shouldn't matter at all
what db.h *header* is present at runtime, and it's not actually checking that.
Instead, AFAICT it's checking that the version of the shared libdb present on
the system at runtime is exactly the same that it was compiled against.

The version checking code is in ext/DB_File/version.c.  Upstream might be
interested to hear about the confusing error message and could probably provide
insight on what's the actual db version requirement.  (rt.cpan.org, distribution

Anyway, I guess the quick fix would be to either really require the same version
of libdb, eg:

  Requires: db4 = %(rpm -q --qf %{VERSION} db4-devel)

...or to remove comparison of the "patch" db version components in
ext/DB_File/version.c, leaving only major and minor in.  In this case, the db4
shared lib name would suffice as the dependency as it is now.  Caveat: I don't
know if this is a strict enough version check, see above.

Comment 2 Ville Skyttä 2005-04-26 15:33:12 UTC
(Or instead of removing the patch version check, turning the != into a >= there
could be a better idea.  Same caveat as in comment 1 still applies though.)

Comment 3 Warren Togami 2005-04-27 01:01:50 UTC
Since we cannot run rpm query during rpmbuild, the preferred solution is to
patch ext/DB_File/version.c?

This is not urgent, but will accept into FC4 after test3 if a patch is supplied.

Comment 4 Ville Skyttä 2005-04-27 07:05:02 UTC
I don't think there are problems running such a query at build time, but
patching would be a better solution indeed if it's the right thing to do. 
Someone more familiar with db4 would have to confirm that.

Comment 5 Warren Togami 2005-09-11 10:45:30 UTC
On second thought, mixing repositories is unsupported and the initial report was
of rawhide during an inconsistent state.  Closing WONTFIX, unless someone is
willing to submit a concrete, simple and obviously correct way to do this.

Comment 6 Jonathan Kamens 2007-10-14 04:19:44 UTC
This just bit me again.

"mixing repositories is unsupported" -- yeah, you're right, why should you go to
any effort to support the people who are willing to break their systems
regularly by keeping up-to-date with Rawhide to help find and fix bugs in
Fedora?  I mean, why take 15 minutes to add a dependency to the perl spec file
that could save your testers hours and hours of grief?  I can see how that's
just not worth it.

Comment 7 Warren Togami 2007-10-14 06:53:22 UTC
> Closing WONTFIX, unless someone is
> willing to submit a concrete, simple and obviously correct way to do this.

Nobody has.

Comment 8 Jonathan Kamens 2007-10-14 13:56:58 UTC
What's wrong with the solution already proposed?

Requires: db4 = %(rpm -q --qf %{VERSION} db4-devel)

The only objection raised to this was "Since we cannot run rpm query during
rpmbuild," but no explanation was given for why this is so, and someone else
disputed this objection.  I just tested it and it works just fine.

Comment 9 Tom "spot" Callaway 2007-10-15 18:13:51 UTC
Hi, sorry for the late response.

It isn't safe to query rpm inside of a spec file in Fedora. Here's why:

When the Fedora buildsystem builds a package, it builds each package inside a
new, clean, freshly generated chroot. It uses the system files to generate the
chroot, and the system files are not guaranteed to match the equivalent files
installed inside the chroot.

To put it succinctly, the rpm used to install the packages in the chroot build
environment is not guaranteed to (and in almost every case is not) the same as
the rpm inside the chroot. Thus, you have an rpm database inside the chroot
which was created with an older db4, and a rpm inside the chroot that uses a
newer db4. When rpm queries the database, you get a db4 environment mismatch,
and nothing useful comes out.

This is why we do not let people do that in Fedora.

It works fine for you, because you are far more likely to have the same rpm
which created the database when you are querying it.

With that explained, here's the workaround to solve this specific problem:

%define db4_major %(grep "DB_VERSION_MAJOR" /usr/include/db.h | cut -f3)
%define db4_minor %(grep "DB_VERSION_MINOR" /usr/include/db.h | cut -f3)
%define db4_patch %(grep "DB_VERSION_PATCH" /usr/include/db.h | cut -f3)


Requires: db4-devel = %{db4_major}.%{db4_minor}.%{db4_patch}

I'm committing this change to rawhide right now.

We're also contacting DB_File upstream to see if they really need this strict
version check (our suspicion is that they do not).

Comment 10 Jonathan Kamens 2007-10-15 18:16:15 UTC
Thank you.

Comment 11 Robin Norwood 2007-10-15 18:20:38 UTC
Here's the link to the upstream RT:

Comment 12 Tom "spot" Callaway 2008-01-02 21:12:58 UTC
Fixed in rawhide, and upstream relaxed the dependency in DB_File 1.816.

Note You need to log in before you can comment on or make changes to this bug.