Comment 5 for bug 536958

I took a closer look at the slapd.postinst script, and I believe I see what is causing this issue.

In the "postinst_upgrade_configuration" function, the script first checks to see if the configuration info needs to be converted from "slapd.conf" to "slapd.d" format, and if so it runs the "slaptest" command to perform that conversion.

The script then checks to see if the previous version of the of package used a different Berkeley DB version, and if so it actually moves the old BDB files out of the way and creates new database files using the "slapadd" program (based on the export of the directory data that was saved using the prior version of "slapcat" in the slapd.preinst script).

This arrangement worked fine for the Hardy -> Intrepid -> Jaunty upgrade path, because the two conversions did not happen during the same run of the postinst script. (The configuration was converted when going to Intrepid, and the BDB version was changed during the upgrade to Jaunty.)

However, the direct Hardy -> Lucid upgrade does need to perform both conversions in the same postinst run -- but in the existing arrangement, the script tries to run "slapadd" before the BDB files have been regenerated, and thus triggering the "Program version 4.7 doesn't match environment version" error....

So, it appears that the solution to this problem is to perform the conversions in the opposite order.

Currently, the "load_databases" function assumes that the configuration information is in the directory format, so it can't be used until after that conversion has happened. However, it seems like it should be fairly easy to tweak it to work with either configuration format (e.g. using the same logic as is currently found in the "dump_databases" function). The two conversion steps in "postinst_upgrade_configuration" could then be switched, which would (hopefully) allow both to be performed successfully during the same upgrade....