SoftwareNetwork / sw

Software Manager. Build System, Build System Generator and Package Manager. C/C++ and other languages. Tools and libraries for Software Management.
https://software-network.org
Other
115 stars 23 forks source link

"sw setup" installs as wrong user on Windows #94

Closed pschlan closed 2 years ago

pschlan commented 2 years ago

Describe the bug On Windows, sw setup first elevates and then installs files in $HOME/.sw/ and registry keys in HKEY_CURRENT_USER. In setups where the current user and the Administrator account are different, after elevation, sw setup incorrectly installs the files and registry keys in the Administrator's account, since the current home dir and HKEY_CURRENT_USER are now pointing to the Administrator account.

As a result, sw setup does not work correctly. The CMake package is not installed correctly for the current user, but for the system administrator account instead.

Expected behavior sw setup should first install things which are for the current user, and only then elevate and install system-wide things (like HKEY_CLASSES_ROOT reg keys).

To Reproduce Steps to reproduce the behavior:

  1. Log in as a non-admin user
  2. Run sw setup and elevate using an admin account

Information:

egorpugin commented 2 years ago

Hi,

The possible fix is in https://github.com/SoftwareNetwork/sw/commit/8e37f37068672f4aa7a861f183096d9edda4d97d You can try to download build artifacts from CI after build and try it. They will be on this page https://github.com/SoftwareNetwork/sw/actions/runs/2345978897

pschlan commented 2 years ago

Just tried the CI binaries and it looks like the issue is solved. Registry keys and files are created in the proper location. Thanks for the quick fix!