vcorazza
Posts: 17
Joined: Wed Dec 06, 2017 3:14 pm

Chained package condition evaluation fails if string comparison is present

Hi
I've struggled in understanding why a chained package was not installed, and on the end I think it is an AdvancedInstaller bug (version 16.8)

The installer has an INI search parameter MYVAR. Then a chained package has to be installed based on this parameter.
The condition that I use is:

NOT Installed AND (MYVAR="A" OR MYVAR="B" OR MYVAR="A_B")

The chained package never installs. The only way I've found to evaluate MYVAR is without comparing it to a string:

NOT Installed AND MYVAR

If it has value (any value) then the package is installed. But this is not what I need to do. And I think there is no way to test the presence of a value in an INI file, so that I could create 3 variables MYVAR_A, MYVAR_B, MYVAR_A_B

How can I solve this?
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Chained package condition evaluation fails if string comparison is present

Hello,

I have tested this and everything worked as expected on my end (to mention here that I've been testing this using AI 17.0). The chained package was correctly launched for installation.

First of all, for more information about how a chained package behaves, please have a look on the following article:

Chained Package Behavior
NOT Installed AND (MYVAR="A" OR MYVAR="B" OR MYVAR="A_B")
In what regards this, it is important to note the fact that both conditions must be true in order for the chained package to execute.

In our case, it looks like the condition is not evaluated as true, which means either:

- the (NOT Installed) condition is false

- the (MYVAR="A" OR MYVAR="B" OR MYVAR="A_B") condition is false

- there is indeed an issue with this

Based on the fact that everything works as expected when you use a condition like this:
NOT Installed AND MYVAR
makes me think that the second condition is evaluated as false.

Basically, the above condition evaluates as such:

the chained package is not installed and the MYVAR property exists (doesn't matter what value it has)

What I think here is the fact that your property does not store any of those values you have specified (A, B or A_B).
And I think there is no way to test the presence of a value in an INI file, so that I could create 3 variables MYVAR_A, MYVAR_B, MYVAR_A_B
Actually, there is. You can check if a value is present in an INI file by using an "INI File Search".

If not with the above, could you please let me know how did you get the value from the INI value in your MYVAR property?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vcorazza
Posts: 17
Joined: Wed Dec 06, 2017 3:14 pm

Re: Chained package condition evaluation fails if string comparison is present

Well, that's right. Thank you for your reply. Really my situation is a bit more complex, but trying to find the issue in my tests I made some mistakes.

So this is the situation which I cannot find a solution for.
I have an installer A, which has various prerequisites and a chained package B, which has another chained package C.
B and C are the ones of my previous example, with the complex evaluation condition.
The property MYVAR is read correctly from the .ini file, as I can see it's value in the logs.

Anyway there is no way to install package C.

Package A has external resources.
Package B is an msi with resources inside. The only unusual thing is that package B is not registered with Windows Installer.
Package B starts everytime, but noway to start installation of package C

This is an extract of the logs regarding C package

MSI (s) (34!1C) [18:31:37:227]: PROPERTY CHANGE: Adding AI_CHAINER_CMD_LINE property. Its value is 'IC:\Users\QServer\AppData\Local\Temp\Apetta.msiFV'.
MSI (s) (34!1C) [18:31:37:227]: PROPERTY CHANGE: Adding AI_MSI_CHAINER_CONDITION property. Its value is '1'.
MSI (s) (34!1C) [18:31:37:227]: PROPERTY CHANGE: Adding AI_CommitChainers property. Its value is 'C:\Users\QServer\AppData\Local\Temp\Apetta.msi'.
MSI (s) (34!1C) [18:31:37:227]: Doing action: AI_CommitChainers
Inizio azione 18:31:37: AI_CommitChainers.
MSI (c) (A0:54) [18:31:37:227]: Creating MSIHANDLE (3270) of type 790531 for thread 7764
MSI (c) (A0:54) [18:31:37:227]: Closing MSIHANDLE (3270) of type 790531 for thread 7764
MSI (c) (A0:54) [18:31:37:227]: Creating MSIHANDLE (3271) of type 790531 for thread 7764
MSI (c) (A0:54) [18:31:37:227]: Closing MSIHANDLE (3271) of type 790531 for thread 7764
Termine azione 18:31:37: AI_CommitChainers. Valore di ritorno 1.
MSI (s) (34!1C) [18:31:37:227]: PROPERTY CHANGE: Deleting AI_CommitChainers property. Its current value is 'C:\Users\QServer\AppData\Local\Temp\Apetta.msi'.
MSI (s) (34!1C) [18:31:37:227]: Closing MSIHANDLE (6065) of type 790540 for thread 6172
MSI (s) (34!1C) [18:31:37:227]: Closing MSIHANDLE (6064) of type 790541 for thread 6172
MSI (s) (34!1C) [18:31:37:242]: Closing MSIHANDLE (6062) of type 790541 for thread 6172
MSI (s) (34:30) [18:31:37:242]: Closing MSIHANDLE (6061) of type 790542 for thread 836
Termine azione 18:31:37: AI_PrepareChainers. Valore di ritorno 1.
.
.
.
Property(S): AI_CHAINER_CMD_LINE = IC:\Users\QServer\AppData\Local\Temp\Apetta.msiFV
Property(S): AI_MSI_CHAINER_CONDITION = 1


No error. Windows Event Viewer has no evidence that apetta.msi has been launched.
Btw: package B has verbose logging enabled. I don't know why, and I'm not able to reduce it. Where do I setup logging parameters for a chained package?
Catalin wrote: Thu May 21, 2020 3:46 pm
And I think there is no way to test the presence of a value in an INI file, so that I could create 3 variables MYVAR_A, MYVAR_B, MYVAR_A_B
Actually, there is. You can check if a value is present in an INI file by using an "INI File Search".
This is not clear to me. It seems not to be what I was asking for: I can check the presence of a key of any value, but I cannot specify the presence of a specific value for the key. I meam: I can search for section S, key K and obtain its value "VV" or "XX", but I cannot test if the key K has value "XX" (so that the variable is true or false)
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Chained package condition evaluation fails if string comparison is present

Hello,

Please accept my apologies for the delayed reply (I had few sick days off).

Thank you for the detailed followup.

I have tested this scenario. Here is how I've tested this:

- three packages: A,B and C.

- C is a chained package for B and B is a chained package for A.

The problem I encountered here is the fact that package C is never launched, no matter how I pass the property to it (either MY_VAR = "something" or MY_VAR), when everything is launched through package A.

If I launch package B separately, package C is launched correctly. However, if I launch package A which then launches package B, package C is never launched.

In the first thread, you have mentioned that this works as expected if you use only the MY_VAR property as a condition. Unfortunately, I was not able to make this work. Could you please confirm that our scenarios are the same?

Basically, what I want to know here is: do you launch the package A --> which installs package A--> launches package B --> package B installs --> (should) launch package C --> package C (should be) is installed?

or:

you launch package B --> package B installs --> package C is not launched?
Btw: package B has verbose logging enabled. I don't know why, and I'm not able to reduce it. Where do I setup logging parameters for a chained package?
This might happen if you have the "Enable logging" option enabled for your B package ("Prerequisites" page --> your chained package --> "Logging" section --> "Enable Logging")
I can search for section S, key K and obtain its value "VV" or "XX", but I cannot test if the key K has value "XX" (so that the variable is true or false)
You can check this through a "MessageBox" custom action. You can have this custom action display, during the installation process, the value of your property, like this:

Code: Select all

[MY_VAR]
Another way of seing the value of the property is from the log file.

Looking forward to hearing from you.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vcorazza
Posts: 17
Joined: Wed Dec 06, 2017 3:14 pm

Re: Chained package condition evaluation fails if string comparison is present

Hi,
on the end the MY_VAR issue was a false positive issue: it was due to mistakes I've made in subsequent tests trying to isolate the real one.
So forget about the MY_VAR.
Catalin wrote: Thu May 28, 2020 2:11 pm The problem I encountered here is the fact that package C is never launched, no matter how I pass the property to it (either MY_VAR = "something" or MY_VAR), when everything is launched through package A.

If I launch package B separately, package C is launched correctly. However, if I launch package A which then launches package B, package C is never launched.
This is exactly my issue.
Catalin wrote: Thu May 28, 2020 2:11 pm Basically, what I want to know here is: do you launch the package A --> which installs package A--> launches package B --> package B installs --> (should) launch package C --> package C (should be) is installed?
Exactly: C should be installed, but it is not.
Catalin wrote: Thu May 28, 2020 2:11 pm or:

you launch package B --> package B installs --> package C is not launched?
If I launch package B only, package C is launched correctly.
Catalin wrote: Thu May 28, 2020 2:11 pm This might happen if you have the "Enable logging" option enabled for your B package ("Prerequisites" page --> your chained package --> "Logging" section --> "Enable Logging")
Is there any way to specify the verbosity level of the chained package log?
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Chained package condition evaluation fails if string comparison is present

Hello,

Thank you for your followup on this and for the additional information.

Good to know that the encountered behaviour is the same.

This is currently under investigation. I will update this thread as soon as I will have more information about this.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: Chained package condition evaluation fails if string comparison is present

Hello,

After some further investigations, it looks like this is a Windows Installer limitation.

It seems that Windows Installer does not execute package C.

Our custom actions from package B are executing correctly and prepare everything in order to launch package C, but our executable which launches chain packages is not launched by Windows Installer, therefore package C is never deployed.

This being the scenario, unfortunately, I'm afraid we can not do much to "improve" this.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”