Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read %LOCALAPPDATA% on Windows service accounts #12285

Closed
AlexAltea opened this issue Jul 6, 2020 · 1 comment · Fixed by #12370
Closed

Unable to read %LOCALAPPDATA% on Windows service accounts #12285

AlexAltea opened this issue Jul 6, 2020 · 1 comment · Fixed by #12370
Assignees

Comments

@AlexAltea
Copy link
Contributor

AlexAltea commented Jul 6, 2020

After the merging of #12091 (cc @ras0219), the instances of vcpkg running in our Windows CI exited reporting that %LOCALAPPDATA% cannot be read. This environment variable is undefined as the CI jobs are running on a Windows service account (running as SYSTEM).

As a hacky workaround, $Env:LOCALAPPDATA = $Env:TEMP solves the problem, but a proper fix would be much appreciated.

Environment

  • OS: Windows Server 2019
  • Compiler: MSVC 14.26
  • Relevant environment variables (some have been redacted to [...])
> Get-ChildItem Env:

Name                           Value
----                           -----
ALLUSERSPROFILE                C:\ProgramData
APPDATA                        C:\Windows\system32\config\systemprofile\AppData\Roaming
[...]
HOME                           C:\Windows\TEMP\drone-[...]\home\drone
HOMEPATH                       C:\Windows\TEMP\drone-[...]\home\drone
OS                             Windows_NT
Path                           C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;...
[...]
PSMODULEPATH                   WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;...
PUBLIC                         C:\Users\Public
SystemDrive                    C:
SystemRoot                     C:\Windows
TEMP                           C:\Windows\TEMP
TMP                            C:\Windows\TEMP
USERNAME                       [...]$
USERPROFILE                    C:\Windows\TEMP\drone-[...]\home\drone
VCPKG_ROOT                     C:\vcpkg
windir                         C:\Windows

To reproduce

Steps to reproduce the behavior:

  1. Run vcpkg install on a Windows service account.

  2. See error below:

    > vcpkg install
    
    Failed at [C:\vcpkg\toolsrc\src\vcpkg\userconfig.cpp(14)] with message:
    unable to read %LOCALAPPDATA%
    

Expected behavior

The command should succeed on service accounts. If %LOCALAPPDATA% is undefined, maybe it should fallback to one of the following directories:

  • C:\Windows\System32\config\systemprofile\AppData\Local
  • C:\Windows\SysWOW64\config\systemprofile\AppData\Local
@JackBoosY
Copy link
Contributor

@BillyONeal @ras0219 @ras0219-msft Can you take a look?

Thanks.

ras0219 pushed a commit to ras0219/vcpkg that referenced this issue Jul 10, 2020
ras0219-msft added a commit that referenced this issue Jul 13, 2020
* [vcpkg] Enable binary caching by default. Support `x-` migration.

Fix passing multiple copies of single parameter arguments.

* [vcpkg] Handle x- prefixes for general arguments

* [vcpkg] Fix #12285 and improve documentation of default binary cache path

* [vcpkg] Revert x- prefix homogenization for per-command arguments

* [vcpkg] Only use accelerated compiler detection for Windows Desktop + Ninja. Improve breadcrumbs for users encountering issues.

* [vcpkg] Fix compiler tracking not pre-downloading Ninja. Fix compiler tracking not looking in -err.log.

* [vcpkg] Update toolsrc/src/vcpkg/binarycaching.cpp

Co-authored-by: Billy O'Neal <[email protected]>

* [vcpkg] Format

Co-authored-by: Robert Schumacher <[email protected]>
Co-authored-by: Billy O'Neal <[email protected]>
strega-nil pushed a commit to strega-nil/vcpkg that referenced this issue May 5, 2021
* [vcpkg] Enable binary caching by default. Support `x-` migration.

Fix passing multiple copies of single parameter arguments.

* [vcpkg] Handle x- prefixes for general arguments

* [vcpkg] Fix microsoft#12285 and improve documentation of default binary cache path

* [vcpkg] Revert x- prefix homogenization for per-command arguments

* [vcpkg] Only use accelerated compiler detection for Windows Desktop + Ninja. Improve breadcrumbs for users encountering issues.

* [vcpkg] Fix compiler tracking not pre-downloading Ninja. Fix compiler tracking not looking in -err.log.

* [vcpkg] Update toolsrc/src/vcpkg/binarycaching.cpp

Co-authored-by: Billy O'Neal <[email protected]>

* [vcpkg] Format

Co-authored-by: Robert Schumacher <[email protected]>
Co-authored-by: Billy O'Neal <[email protected]>
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 a pull request may close this issue.

3 participants