Bug 233215 - verify-db.pl still assumes the db dir is always in the instance dir
Summary: verify-db.pl still assumes the db dir is always in the instance dir
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Command Line Utilities
Version: 1.0.4
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 152373 240316 FDS1.1.0
TreeView+ depends on / blocked
 
Reported: 2007-03-20 23:12 UTC by Noriko Hosoi
Modified: 2015-12-07 16:46 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-12-07 16:46:44 UTC
Embargoed:


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

Description Noriko Hosoi 2007-03-20 23:12:26 UTC
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 17:28:19 UTC
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 17:38:02 UTC
Ok.

Comment 3 Noriko Hosoi 2007-03-21 17:43:42 UTC
Created attachment 150606 [details]
cvs commit message

Reviewed by Rich (Thank you!)

Checked in into HEAD.

Comment 7 Noriko Hosoi 2007-03-30 01:30:24 UTC
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-30 01:32:55 UTC
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-30 01:37:53 UTC
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-30 01:42:23 UTC
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-30 01:47:16 UTC
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 17:51:30 UTC
The changes look good.

Comment 13 Noriko Hosoi 2007-03-30 18:22:10 UTC
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 18:59:42 UTC
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 21:07:11 UTC
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 18:09:50 UTC
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-06 02:50:26 UTC
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.