[lokisetup] [PATCH] freeing the product info
Stéphane Peter
megastep at megastep.org
Sat Apr 17 20:20:13 EDT 2004
I'm a bit nervous to commit this because the last patch addressing this
problem actually broke component installs for me. I'll try this but I've
been using the current CVS code in a commercial product with
post-install scripts among a bunch of platforms with no problem so far.
So I'm not sure why this wouldn't work for you ?
> Hi,
>
> Handling of info->product is broken. It just can't work if you assign
> something to info->product, free it and then try to access it. That
> happens for example when installers have post install scripts.
>
> Since info->product ist created in create_install(), I propose to
> free it in delete_install() instead of generate_uninstall(). I
> tested the component install and uninstall with Rune HoV, worked
> fine with the patch.
>
>
> Index: loki_setup/install.c
> ===================================================================
> --- loki_setup.orig/install.c 2004-04-17 19:31:46.553443982 +0200
> +++ loki_setup/install.c 2004-04-17 19:48:33.033714876 +0200
> @@ -1410,6 +1410,12 @@
> free(comp->message);
> free(comp);
> }
> + if(info->product)
> + {
> + loki_closeproduct(info->product);
> + info->product = NULL;
> + }
> +
> delete_cdrom_install(info);
> if ( info->lookup ) {
> close_lookup(info->lookup);
> @@ -1763,10 +1769,8 @@
> product_option_t *option;
> struct component_elem *comp;
>
> - if ( info->component ) { /* Component install, the product has already been opened */
> - product = info->product;
> - component = info->component;
> - } else {
> + if(!info->product) {
> + log_debug("create new product");
> /* Try to open the product first in case it was installed previously */
> product = loki_openproduct(info->name);
> if ( ! product ) {
> @@ -1779,6 +1783,9 @@
> info->product = product;
> }
>
> + product = info->product;
> + component = info->component;
> +
> if ( product ) {
> char buf[PATH_MAX];
> struct envvar_elem *var;
> @@ -1951,8 +1958,6 @@
>
> snprintf(buf, sizeof(buf), "setup.data/bin/%s/%s/uninstall", detect_os(), detect_arch());
> loki_upgrade_uninstall(product, buf, "setup.data/locale");
> - /* We must call the following in all cases - component installs even, as we have to save the changes */
> - loki_closeproduct(product);
> } else {
> log_fatal(_("Could not create install log"),
> detect_home(), info->name);
>
> cu
> Ludwig
--
Stephane Peter
Sr. Software Engineer
Codehost, Inc.
More information about the Lokisetup
mailing list