Skip to content

Conversation

florisvdh
Copy link
Member

@florisvdh florisvdh commented Sep 20, 2023

If for some reason qgis_reconfigure() is interrupted, the cache elements are set back to
NULL by qgis_unconfigure(), but qgis_process can possibly still be accessed.

An example was seen in #176.

This PR adds some protection in order to maintain some package functionality
in a situation where package configuration did not succeed completely, but
qgis_process can be accessed nevertheless:

  • making qgis_run() able to access the backend, will at least aid in further debugging.
  • avoid erroring in qgis_configure() which would lead to resetting the package cache. As a result, half-configured states can emerge, but the problem of not being able to build & save the cache (which needs has_qgis()) is communicated to the user. Also the individual fails are reported. Moreover, the half-configured state still allows some functionality.

If for some reason qgis_reconfigure() is interrupted, the cache elements remain
NULL, but qgis_process can possibly still be accessed.

An example was seen in #176.

This commit adds some protection, in essence making qgis_run() able to access the backend,
which will at least aid in further debugging.
If path is NULL, then typically also version will be NULL. Furthermore it is wise
to update version anyway after path has been (re)set.

So if path is NULL, both path and version are now queried and cached by qgis_run().
This is part of a series of small efforts to maintain some package functionality
in a situation where package configuration did not succeed completely, but
qgis_process can be accessed nevertheless.
…ting error *

Avoiding to throw an error during configuration also avoids triggering qgis_unconfigure(), which otherwise
resets the cache environment elements to NULL.

As a result, half-configured states can emerge, but the problem of not being able to build & save the cache
(which needs has_qgis()) is communicated to the user. Also the individual fails are reported. Moreover, the
half-configured state still allows some functionality, and also the hardening in this commit ensures a
graceful, non-interrupted execution of qgis_configure().
@florisvdh florisvdh changed the title Protect qgis_run() against a 'soft' package configuration failure. Protect against a 'soft' package configuration failure. Sep 21, 2023
The assertion is well taken care of during pkg loading already.

This assert_qgis() statement prevented qgis_algorithms() (which calls qgis_providers() in
a message) to run in a semi-corrupted setup that could be recovered.
qgis_query_algorithms() is not run often, and printing qgis_process's stderr here
may help in debugging if needed.
@florisvdh florisvdh merged commit a88e665 into main Sep 22, 2023
@florisvdh florisvdh deleted the path_null branch September 22, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant