Bug 233215 - verify-db.pl still assumes the db dir is always in the instance dir
verify-db.pl still assumes the db dir is always in the instance dir
Status: CLOSED CURRENTRELEASE
Product: 389
Classification: Community
Component: Command Line Utilities (Show other bugs)
1.0.4
All Linux
high Severity high
: ---
: ---
Assigned To: Noriko Hosoi
Viktor Ashirov
:
Depends On:
Blocks: 152373 240316 FDS1.1.0
  Show dependency treegraph
 
Reported: 2007-03-20 19:12 EDT by Noriko Hosoi
Modified: 2015-12-07 11:46 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-07 11:46:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
cvs diff template-verify-db.pl.in (7.69 KB, patch)
2007-03-21 13:28 EDT, Noriko Hosoi
no flags Details | Diff
cvs commit message (1.00 KB, text/plain)
2007-03-21 13:43 EDT, Noriko Hosoi
no flags Details
(* cvs diff create_instance.c (* create_instance.c.diff in Comment #7) (1.17 KB, patch)
2007-03-29 21:32 EDT, Noriko Hosoi
no flags Details | Diff
svn diff db4.template (** db4.template.diff in Comment #7) (1.95 KB, patch)
2007-03-29 21:37 EDT, Noriko Hosoi
no flags Details | Diff
cvs diff ldapserver/m4/db.m4 (*** db.m4.diff) (1.44 KB, patch)
2007-03-29 21:42 EDT, Noriko Hosoi
no flags Details | Diff
Proposed patch (**** patch.4.2.52.txn) (2.50 KB, patch)
2007-03-29 21:47 EDT, Noriko Hosoi
no flags Details | Diff
cvs commit messages (2.05 KB, text/plain)
2007-03-30 14:22 EDT, Noriko Hosoi
no flags Details
cvs commit message (970 bytes, text/plain)
2007-04-12 17:07 EDT, Noriko Hosoi
no flags Details
cvs commit message (526 bytes, text/plain)
2007-12-05 21:50 EST, Noriko Hosoi
no flags Details

  None (edit)
Description Noriko Hosoi 2007-03-20 19:12:26 EDT
Description of problem:
The command line utility failed to be updated with the FHS change.

If the db is not in the instance dir (or the directory where verify-db.pl is
located), it does not check the db files.
Comment 1 Noriko Hosoi 2007-03-21 13:28:19 EDT
Created attachment 150603 [details]
cvs diff template-verify-db.pl.in

File: ldap/admin/src/scripts/template-verify-db.pl.in

Changes:
0) eliminated the "current directory" from the utility.  Now, it can be run
from  any location.
1) changed to take a new option [-a <fullpath_to_db_dir> ] to allow specifying
the db dir/changelog dir; by default the start point is "db_dir"
(nsslapd-directory in cn=config,cn=ldbm database,cn=plugins,cn=config)
2) instead of assuming the db dir structure (e.g.,
db/<backend_instance>/<db_files>), now it checks all the db files found under
the specified path.  This allows to run the utility against the backup files,
as well.
Comment 2 Rich Megginson 2007-03-21 13:38:02 EDT
Ok.
Comment 3 Noriko Hosoi 2007-03-21 13:43:42 EDT
Created attachment 150606 [details]
cvs commit message

Reviewed by Rich (Thank you!)

Checked in into HEAD.
Comment 7 Noriko Hosoi 2007-03-29 21:30:24 EDT
There are mutiple problems found around verify-db.pl on Solaris... :(

1, I introduced "DB-DIR" macro for template-verify-db.pl.in, but the
corresponding version if create_instance.c hasn't been checked in yet (*
create_instance.c.diff is being attached)
2. template-verify-db.in has the following envirament variable PATH set:
    $ENV{'PATH'} = "$prefix@db_bindir@:$prefix/usr/bin:@db_bindir@:/usr/bin";
    And the derived verify-db.pl on 64-bit Solaris looks like this:
    $ENV{'PATH'} = "$prefix/usr/bin:$prefix/usr/bin:/usr/bin:/usr/bin";
2-1. The problem is db_* utilities on 64-bit Solaris are installed in
/usr/bin/sparcv9, thus verify-db.pl fails to find the executables and exits.
2-2. To get the right path, db4 packaging is supposed to generate db.pc and put
the file in /usr/lib/sparcv9/pkgconfig, but svn:pkgs/db4 spec file does not have
the code (** db4.template.diff is being attached)  Note: the system Berkeley DB
on RHELs has db.pc in /usr/lib/pkgconfig.
2-3. Even though db.pc is placed in the right place, ldapserver/m4/db.m4 does
not check db.pc with pkg-config, but sets the hardcoded path /usr/bin to
db_bindir (*** db.m4.diff is being attached)
3. With all the above fixes, ran verify-db.pl, then one of the Berkeley DB
utilities db_printlog crashed...  The cause of the crash was a field called
timestamp is declared as int32_t, but the pointer to the value is casted to
(time_t *), where time_t is 64 bits on the 64-bit machine.  The cast mismatch
makes ctime/localtime fail and it leads the utility crash.   I looked at the db
4.4.20 code, and verified it was fixed.  I back-ported the change to 4.2.52 and
made a patch since I could not find the patch on the Sleepycat site. (****
patch.4.2.52.txn is being attached)
Comment 8 Noriko Hosoi 2007-03-29 21:32:55 EDT
Created attachment 151245 [details]
(*
cvs diff create_instance.c (* create_instance.c.diff in Comment #7)

File: ldap/admin/src/create_instance.c

Change: 
1, I introduced "DB-DIR" macro for template-verify-db.pl.in, but the
corresponding version if create_instance.c hasn't been checked in yet.
Comment 9 Noriko Hosoi 2007-03-29 21:37:53 EDT
Created attachment 151246 [details]
svn diff db4.template (** db4.template.diff in Comment #7)

File: svn:rpms/pkgs/db4/SPECS/db4.template

Changes: 
1) added a code to generate db.pc for pkg-config
2) apply a patch to fix the db_printlog crash problem.	The patch proposal is
being attached later (**** patch.4.2.52.txn)
Comment 10 Noriko Hosoi 2007-03-29 21:42:23 EDT
Created attachment 151247 [details]
cvs diff ldapserver/m4/db.m4 (*** db.m4.diff)

File: ldapserver/m4/db.m4

Change: To set db_bindir, if db.pc exists, check if bindir variable is defined
in the file or not.  If it's defined, set it to db_bindir.  If not, set the
default path /usr/bin to db_bindir.
Comment 11 Noriko Hosoi 2007-03-29 21:47:16 EDT
Created attachment 151248 [details]
Proposed patch (**** patch.4.2.52.txn)

File: svn:rpms/pkgs/db4/SOURCES/patch.4.2.52.txn

Fix Description: The cause of the db_printlog crash was the unexpected cast
from  the pointer to the 32-bit integer to the pointer to time_t/long (64-bit).
 The patch is a back-port from db 4.4.20, where the problem was already fixed.
Comment 12 Nathan Kinder 2007-03-30 13:51:30 EDT
The changes look good.
Comment 13 Noriko Hosoi 2007-03-30 14:22:10 EDT
Created attachment 151305 [details]
cvs commit messages

Reviewed by Nathan (Thank you!!)

Checked in into HEAD.

I'm rebuilding RHATdb4x packages for Solaris...
Comment 14 Noriko Hosoi 2007-04-12 14:59:42 EDT
After the check-in in Comment #10, I forgot to check in these derived files, and
the fix was not used indeed... :(
  Makefile.in
  aclocal.m4
  configure
  ltmain.sh

(In reply to comment #10)
> Created an attachment (id=151247) [edit]
> cvs diff ldapserver/m4/db.m4 (*** db.m4.diff)
> File: ldapserver/m4/db.m4
> Change: To set db_bindir, if db.pc exists, check if bindir variable is defined
> in the file or not.  If it's defined, set it to db_bindir.  If not, set the
> default path /usr/bin to db_bindir.

Comment 15 Noriko Hosoi 2007-04-12 17:07:11 EDT
Created attachment 152506 [details]
cvs commit message

Thank you for the approval, Rich and Nathan.

Checked in into HEAD.
Comment 16 Noriko Hosoi 2007-04-13 14:09:50 EDT
It finally worked on Solaris.
520|6 6 8760 1 1|CLU Utilities test: verify
520|6 6 8760 1 2|--------------------------
520|6 6 8760 1 3|1) verify-db.pl -a <db_dir> from /tmp
520|6 6 8760 1 4|-------------------------------------
520|6 6 8760 1 5|Verify db (from /tmp with -a option): passed
520|6 6 8760 1 6|2) verify-db.pl from
/export/DS7.2-26189/server/slapd-agamemnon/../slapd-utiltest
520|6 6 8760 1 7|-----------------------------
520|6 6 8760 1 8|Verify db (from MYIROOT with no option): passed
520|6 6 8760 1 9|3) run verify-db.pl against broken db
520|6 6 8760 1 10|-------------------------------------
520|6 6 8760 1 11|Verify db: failed as expected
520|6 6 8760 1 12|ERROR MESSAGE:
520|6 6 8760 1 13|DB ERROR: db_verify:
/export/DS7.2-26189/server/slapd-agamemnon/../slapd-utiltest/db/userRoot/id2entry.db4:
unexpected file type or format DB
ERROR: db_verify: DB->open:
/export/DS7.2-26189/server/slapd-agamemnon/../slapd-utiltest/db/userRoot/id2entry.db4:
Invalid argument
220|6 6 0 04:48:56|PASS
Comment 19 Noriko Hosoi 2007-12-05 21:50:26 EST
Created attachment 279051 [details]
cvs commit message

Reviewed by Rich (Thank you!!)

Checked in into TET CVS HEAD.

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