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.
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.
Ok.
Created attachment 150606 [details] cvs commit message Reviewed by Rich (Thank you!) Checked in into HEAD.
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)
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.
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)
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.
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.
The changes look good.
Created attachment 151305 [details] cvs commit messages Reviewed by Nathan (Thank you!!) Checked in into HEAD. I'm rebuilding RHATdb4x packages for Solaris...
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.
Created attachment 152506 [details] cvs commit message Thank you for the approval, Rich and Nathan. Checked in into HEAD.
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
Created attachment 279051 [details] cvs commit message Reviewed by Rich (Thank you!!) Checked in into TET CVS HEAD.