Skip to content

Conversation

@adamsitnik
Copy link
Member

@adamsitnik adamsitnik commented Dec 16, 2020

fixes #28922

Explanation: This test gets the current user: name, id, and groups:

string userName = GetCurrentRealUserName();
string userId = GetUserId(userName);
string userGroupId = GetUserGroupId(userName);
string userGroupIds = GetUserGroupIds(userName);

and starts a process using the given user name:

invokeOptions.StartInfo.UserName = userName;

It was failing because so far we were using two different ways of getting the user group Ids:

  • id -G $username to get the expected ids (called from parent process)
  • libc.getgroups to get the actual ids (called from child process started as given user)

There are some differences in what id -G and libc.getgroups can return and I've verified that by just comparing the output without starting any new processes (see #28922 (comment) for details).

The solution is to use id -G for getting both the expected and actual ids. The parent process passes the username to the command, the child command passes no username to get it for the current user (the test verifies if the process was started as the given user)

@ghost
Copy link

ghost commented Dec 16, 2020

Tagging subscribers to this area: @eiriktsarpalis
See info in area-owners.md if you want to be subscribed.

Issue Details

fixes #28922

Author: adamsitnik
Assignees: -
Labels:

area-System.Diagnostics.Process

Milestone: -

@adamsitnik
Copy link
Member Author

/azp list

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-linux

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-osx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik adamsitnik added the disabled-test The test is disabled in source code against the issue label Dec 16, 2020
@adamsitnik adamsitnik added this to the 6.0.0 milestone Dec 16, 2020
@adamsitnik
Copy link
Member Author

For OSX outerloop the failing tests are unrelated:

  • System.Net.Http.Functional.Tests.SocketsHttpHandlerTest_Http2.SocketSendQueueFull_RequestCanceled_ThrowsOperationCanceled
  • System.IO.Tests.FileSystemWatcher_Multiple_Test.FileSystemWatcher_File_Delet_NotAffectEachOther

@adamsitnik
Copy link
Member Author

However, the Mono leg failed for this particular test:

Test System.Diagnostics.Tests.ProcessTests.TestCheckChildProcessUserAndGroupIds has failed. Check the Test tab or this console log: https://helix.dot.net/api/2019-06-17/jobs/b97699fb-54bc-411c-9043-8e640639d1b9/workitems/System.Diagnostics.Process.Tests/console

@adamsitnik
Copy link
Member Author


Unhandled Exception:
Xunit.Sdk.XunitException: Expected: 4
Actual: 
   at System.AssertExtensions.Equal[UInt32](HashSet`1 expected, HashSet`1 actual) in /_/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs:line 379
   at System.Diagnostics.Tests.ProcessTests.CheckUserAndGroupIds(String userId, String groupId, String groupIdsJoined, String checkGroupsExact) in /_/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs:line 533
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /_/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 378
--- End of stack trace from previous location ---
   at Microsoft.DotNet.RemoteExecutor.Program.Main(String[] args)
[ERROR] FATAL UNHANDLED EXCEPTION: Xunit.Sdk.XunitException: Expected: 4
Actual: 
   at System.AssertExtensions.Equal[UInt32](HashSet`1 expected, HashSet`1 actual) in /_/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs:line 379
   at System.Diagnostics.Tests.ProcessTests.CheckUserAndGroupIds(String userId, String groupId, String groupIdsJoined, String checkGroupsExact) in /_/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs:line 533
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /_/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 378
--- End of stack trace from previous location ---
   at Microsoft.DotNet.RemoteExecutor.Program.Main(String[] args)
    System.Diagnostics.Tests.ProcessTests.TestCheckChildProcessUserAndGroupIds [FAIL]
      Microsoft.DotNet.RemoteExecutor.RemoteExecutionException : Remote process failed with an unhandled exception.
      Stack Trace:
        
        Child exception:
          Xunit.Sdk.XunitException: Expected: 4
        Actual: 
        /_/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs(379,0): at System.AssertExtensions.Equal[UInt32](HashSet`1 expected, HashSet`1 actual)
        /_/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs(533,0): at System.Diagnostics.Tests.ProcessTests.CheckUserAndGroupIds(String userId, String groupId, String groupIdsJoined, String checkGroupsExact)
        /_/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs(378,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
        
        Child process:
          System.Diagnostics.Process.Tests, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 System.Diagnostics.Tests.ProcessTests Int32 CheckUserAndGroupIds(System.String, System.String, System.String, System.String)
        
        Child arguments:
          1001, 4, 4, True     

@adamsitnik adamsitnik added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Dec 16, 2020
@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-osx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-linux

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-osx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-linux

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-osx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-linux

@adamsitnik
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-osx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@adamsitnik adamsitnik changed the title try to re-enable TestCheckChildProcessUserAndGroupIds test fix and re-enable TestCheckChildProcessUserAndGroupIds test Dec 18, 2020
@adamsitnik adamsitnik removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Dec 18, 2020
@adamsitnik
Copy link
Member Author

The test that I wanted to fix has passed (it was failing at the beginning), the current CI failures are not related:

.packages/microsoft.dotnet.helix.sdk/6.0.0-beta.20615.4/tools/Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(76,5): error : (NETCORE_ENGINEERING_TELEMETRY=Test) Work item System.Text.RegularExpressions.Tests in job eb0e5f55-01bf-4a05-ae2e-a449442a2cac has failed.
Failure log: https://helix.dot.net/api/2019-06-17/jobs/eb0e5f55-01bf-4a05-ae2e-a449442a2cac/workitems/System.Text.RegularExpressions.Tests/console

.packages/microsoft.dotnet.helix.sdk/6.0.0-beta.20615.4/tools/Microsoft.DotNet.Helix.Sdk.MultiQueue.targets(76,5): error : (NETCORE_ENGINEERING_TELEMETRY=Test) Work item System.Text.RegularExpressions.Tests in job eb0e5f55-01bf-4a05-ae2e-a449442a2cac has failed.
Failure log: https://helix.dot.net/api/2019-06-17/jobs/eb0e5f55-01bf-4a05-ae2e-a449442a2cac/workitems/System.Text.RegularExpressions.Tests/console

@wfurt
Copy link
Member

wfurt commented Dec 21, 2020

I feel this is move wrong direction. This starts new process and add dependency on finding the right executable. I think that was OK for the test where we control the environment and overhead does not matter. Further more, it can report group the process actually does not have. I'm wondering if that can cause issues does the road.

@adamsitnik
Copy link
Member Author

it can report group the process actually does not have

@wfurt good point, I've read the docs one more time and I think I've found a "proper fix", PTAL at #46302

@adamsitnik adamsitnik closed this Dec 21, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 21, 2021
@adamsitnik adamsitnik deleted the 28922 branch July 2, 2021 11:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Diagnostics.Process disabled-test The test is disabled in source code against the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: System.Diagnostics.Tests.ProcessTests/TestCheckChildProcessUserAndGroupIds

3 participants