App Paths problem

Discussion of bugs and problems found in Altap Salamander. In your reports, please be as descriptive as possible, and report one incident per report. Do not post crash reports here, send us the generated bug report by email instead, please.
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

App Paths problem

Post by SvA »

On most machines I use Altap Salamander on, I usually add an entry under the the App Path registry key like thus:

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\salamand.exe]
@="C:\\Program Files\\Altap Salamander\\salamand.exe"
"Path"="C:\\Program Files\\Altap Salamander\\Tools"
This enabled me to launch Salamander from the Run... dialog or a command line and to keep a set of tools in the path named above, which I can access from within Salamander and from within programs launched from Salamander in a way that enables me to share part of the configuration and make Salamander more portable.

However, with the latest version, the PATH is not changed according to the setting. AS 2.54 gets the path, AS 3.0 (x64) does not.

Strangely, salmon, as a subprocess of salamand.exe has the enhanced path, so it seams the amendment was there in Salamander's environment at the time that process was spawned, but somehow, the environment, and thus my path setting is changed later on. Neither Salamand.exe nor any of the programs I launch from it have it.
User avatar
mdruiter
Posts: 262
Joined: 22 Feb 2006, 15:33
Location: Amsterdam, The Netherlands
Contact:

Re: App Paths problem

Post by mdruiter »

Could it be due to the x64 nature of the process? How do you change the registry key?
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

Re: App Paths problem

Post by SvA »

Hi mdruiter,
I don't think so, but that was my guess at first also.
But for one, values in App Paths are shared between subsystems since Win 7 (and this happens to be a Win 7 system). It used to be redirected, which strongly suggests that these settings are intended to be honored by design.
And then, I strongly assume that salmon, as spawned by the x64 version of AS, is a 64-bit process also. (I did not explicitly check this, and right now have no access to a 64-bit system in order to verify.)
And then, I am pretty sure that this worked before. I cannot tell for sure for the Beta 4, but I am sure, that it worked for some Beta or PreBeta of As 3.0 x64.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: App Paths problem

Post by Jan Rysavy »

Note: could be related to http://forum.altap.cz/viewtopic.php?p=25251 problem, I will look at it.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: App Paths problem

Post by Jan Rysavy »

Unfortunately it is the same problem - we are ignoring differences in PATH variable during environment variables regeneration.

It is possible to reproduce the same problem with Altap Salamander 2.54 when you trigger environment variables reload by changing them using Control Panel. It will lost Path variable specified at App Paths\salamand.exe\Path. From AS 3.0 we are doing regeneration during process startup so related problems are more visible and reproducible.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: App Paths problem

Post by Jan Rysavy »

We should probably introduce a new option (command line switch or inside AS configuration) to disable run-time environment variables regeneration. In this mode Salamander will receive environment block from parent process and it will not change with system environment variables changes. This way you will not lost environment variables inherited from the parent process such as pre-pended Path from App Paths.

Are you able to pass such option as command line parameter?
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

Re: App Paths problem

Post by SvA »

Jan Rysavy wrote:We should probably introduce a new option (command line switch or inside AS configuration) to disable run-time environment variables regeneration.
Yes, I thought about this, but hoped you'd be able to fix this for good.
Jan Rysavy wrote:Are you able to pass such option as command line parameter?
Yes, I was, but would prefer for it to be configurable from within Salamander. As I explained in my first post, I make the change in the first place to be able to launch Salamander from the Run dialog or the command line. I needed to always remember to add the parameter. I use this on user profiles which are not my own. I am happy with any remedy, though.
Edit: If you would not like to add it to the configuration GUI, how about an entry directly in the registry, which gets saved and loaded with Import/Export Configuraion, though?
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: App Paths problem

Post by Jan Rysavy »

SvA wrote:Yes, I thought about this, but hoped you'd be able to fix this for good.
It would be nice. I hoped too and actually implemented PATH diff/patch function yesterday just for the test. Unfortunately the only clean solution we can think off is choose one or second option but not both. We can regenerate env. variables but in such case we cannot inherit them from parent process. Or we can inherit and keep snapshot of environment block (default behavior of Windows process) but in such case we cannot regenerate it run-time.

When you imagine both these options merged together, you will get very strange state - variables partially inherited and partially regenerated from current system environment block. There will be conflicts and unintended states. Windows Explorer is regenerating environment block run-time but it is still running, there is no need to inherit from parent process.

We can put it into AS configuration as a new option, it is probably not a problem.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: App Paths problem

Post by Jan Rysavy »

There is a new option in AS 3.01: Keep environment variables updated to system values
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

Re: App Paths problem

Post by SvA »

Thanks, Jan.

I thought about it again, and I came up with two possible solutions, both not perfect and maybe not worth the hassle:
  1. Try to compose the path from the values in the registry (user and machine) and additionally apply settings in App Paths (User or Machine) for salamand.exe on top of this. This solution takes only path into consideration. Any part of the registry which was inherited from the parent process will (possibly) still get lost (including changes to PATH).
  2. Stow away the environment settings from the registry on start-up. Later on, when you receive the message to update system settings, compare the settings with the previous ones and only apply the differences in the registry to the proces' environment. (Of course you could do this just for PATH.)
By the way, why are you refreshing the registry on start-up. Aren't you supposed to inherit the registry from your parent? What do you (or the user of AS) gain by doing so?
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: App Paths problem

Post by Jan Rysavy »

With AS 3.01 you have two options, I think it is a good solution. You can choose in AS configuration dialog box:

1. (default) Salamander has environment variables up-to-date with Windows settings. In this case AS cannot inherit variables from parent process.
2. Standard Windows behavior (99.999% applications) - AS is using environment variables inherited from parent process. You should use this option.
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

Re: App Paths problem

Post by SvA »

Yes, thanks Jan.

That's what I understood from the preceding communication. The solution is not perfect, but in my opinion absolutely adequate and sufficient.

I came up with the thoughts expressed in the former post while thinking about the perfect fix. I just thought I share.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5231
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: App Paths problem

Post by Jan Rysavy »

Actually what you see on right side of file comparator in this thread http://forum.altap.cz/viewtopic.php?p=25251 is what we get when (undocumented API) RegenerateUserEnvironment is called. Several variables are missing, we have no idea why. This is the reason we are (from AS 3.0) doing regeneration on AS startup - we are comparing initial state with state after regeneration. We are storing differences and patching all following regenerated environment blocks.

We could hard-code missing variables but it would probably break with next Windows so we selected this way. It is not perfect because we are including inherited (standalone) variables into patch. But we are ignoring variables that exist after/before first regeneration and are different. And it is your case, the PATH variable has different content.

I tried to implement patching of PATH variable the similar way we are patching whole environment block. Extract all paths from PATHS list. Compare and store differences. Patch after regeneration. But it seems confusing to us :(
Post Reply