google / earthenterprise

Google Earth Enterprise - Open Source
Apache License 2.0
2.67k stars 887 forks source link

RPMs can install in the wrong order when they are installed in a single transaction #1912

Closed tst-lsavoie closed 3 years ago

tst-lsavoie commented 3 years ago

Describe the bug

RPMs can install out of order when they are installed as part of a single transaction. For example, if you have a previous version of Open GEE installed and then run:

yum install opengee-common opengee-postgis opengee-server opengee-fusion

yum will only ensure that the state is consistent at the end of the transaction, not during the transaction. Thus, the RPMs could install in the order opengee-common, opengee-server, opengee-postgis. This is a problem if common upgrades a library that's not compatible with the older version of postgis because server relies on postgis in its post-install script, and postgis will not be in a working state (due to the incompatibility with the newer version of common).

This problem also occurs with opengee-extra, but it is harder to fix because extra can be installed in any order relative to the other RPMs, but it relies on Fusion and Server working if they have been installed previously. Thus, if you have an old version of Open GEE installed and opengee-common upgrades a library that is incompatible with an older version of opengee-postgis, you will have a problem in this scenario:

yum install opengee-common
yum install opengee-extra

The install will fail because postgis (and therefore opengee-server) will be in a non-working state after the opengee-common upgrade, causing the opengee-extra post-install script to fail.

To Reproduce

There are two related problems here and both are difficult to reproduce. The first depends on the behavior of yum, and both depend on upgrading to a new version of a library. For an example of code that upgrades a library, see https://github.com/google/earthenterprise/pull/1897/files.

Problem 1:

  1. Install Open GEE 5.3.7 or before from RPMs
  2. Create Open GEE RPMs that upgrade a library (such as in the PR above)
  3. Install the new version of Open GEE using yum install opengee-common opengee-postgis opengee-server opengee-fusion
  4. If yum installs the RPMs in the order opengee-common, opengee-server, opengee-postgis (which is not forbidden), the opengee-server post-install script will fail.

Problem 2:

  1. Install Open GEE 5.3.7 or before from RPMs
  2. Create Open GEE RPMs that upgrade a library (such as in the PR above)
  3. Install the new opengee-common RPM
  4. Install the new opengee-extra RPM. Note that the post-install script fails

Expected behavior

  1. RPMs are forced to install in a supported order, even if they are installed/upgraded in a single transaction
  2. The opengee-extra RPM installs without failing no matter the install/upgrade order