-
Notifications
You must be signed in to change notification settings - Fork 109
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
Path::homeDirectory(): asserts when run by Windows users without home directory #132
Comments
Interesting, apparently I overlooked this error case. I have a fix locally, but would like to have an explicit test for it -- do you still have access to the home-less VM runner to explore a bit? In particular I'd like to know what environment variables are present there, especially |
I seem to be unable to find documentation on what environment is present for local system/service accounts on Windows, hence I tried running a powershell script as a local service account to grep the environment. (Using this for the system account execution and this for retrieving the environment. The script is attached for reference. That returned nothing at all, so I am suspecting that system/service accounts don't have access to the environment at all. This post hints and individual variables needing explicit access to environment variables, controlled by Windows registry values. Powershell script for grepping the environment as system user$ErrorActionPreference = 'Stop'
Clear-Host
$taskName = "it3xl_dummy_PowerShell_job"
# Unregister-ScheduledJob it3xl_dummy_PowerShell_job -Confirm:$false
$task = Get-ScheduledJob -Name $taskName -ErrorAction SilentlyContinue
if ($task -ne $null)
{
Unregister-ScheduledJob $task -Confirm:$false
Write-Host "Old $taskName job has been unregistered"; Write-Host;
}
$trigger = New-JobTrigger -AtStartup;
$options = New-ScheduledJobOption -StartIfOnBattery -RunElevated;
Write-Host "Registering new $taskName job";
Register-ScheduledJob -Name $taskName -Trigger $trigger -ScheduledJobOption $options `
-ScriptBlock {
$somthing = Get-ChildItem env:
Write-Host $something
}
#$accountId = "NT AUTHORITY\SYSTEM";
$accountId = "NT AUTHORITY\LOCAL SERVICE";
$principal = New-ScheduledTaskPrincipal -UserID $accountId `
-LogonType ServiceAccount -RunLevel Highest;
$psSobsSchedulerPath = "\Microsoft\Windows\PowerShell\ScheduledJobs";
$someResult = Set-ScheduledTask -TaskPath $psSobsSchedulerPath `
-TaskName $taskName -Principal $principal
Write-Host;
Write-Host "Let's show proofs that our PowerShell job will be running under the LocalSytem account"
$task = Get-ScheduledTask -TaskName $taskName
$task.Principal
Write-Host "Let's start $taskName"
Start-Job -DefinitionName $taskName | Format-Table
Write-Host "Let's proof that our PowerShell job was ran"
Start-Sleep -Seconds 3
Receive-Job -Name $taskName |
Awesome, so for testing it might be enough to just check that Thanks in advance! :) |
Hi @mosra,
summarizing gitter messages: It is possible to run applications on windows through system users without home directories. In this case
CSIDL_PERSONAL
does not known andSHGetFolderPathW()
will not returnS_OK
, but ratherE_INVALIDARG
.This means the assert that is assumed to never possibly fail can indeed fail:
corrade/src/Corrade/Utility/Path.cpp
Lines 581 to 583 in ba75f71
Expectation would be that this returns a null optional instead.
Best,
Jonathan
The text was updated successfully, but these errors were encountered: