Add tar tests to confirm entries owned by deleted users can still be read or written#83126
Merged
carlossanlop merged 2 commits intodotnet:mainfrom Mar 10, 2023
carlossanlop:TarDeletedUserTests
Merged
Add tar tests to confirm entries owned by deleted users can still be read or written#83126carlossanlop merged 2 commits intodotnet:mainfrom carlossanlop:TarDeletedUserTests
carlossanlop merged 2 commits intodotnet:mainfrom
carlossanlop:TarDeletedUserTests
Conversation
lewing
approved these changes
Mar 10, 2023
Contributor
Author
|
Since this is a test-only change, I'd like to backport it to 7.0 (tell-mode). |
Contributor
Author
|
/backport to release/7.0 |
Contributor
|
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/4386255953 |
Contributor
|
@carlossanlop backporting to release/7.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Add tar tests to confirm entries owned by deleted users can still be read and written.
Using index info to reconstruct a base tree...
M src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntry.File.Tests.Unix.cs
M src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntryAsync.File.Tests.Unix.cs
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntryAsync.File.Tests.Unix.cs
Auto-merging src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntry.File.Tests.Unix.cs
CONFLICT (content): Merge conflict in src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntry.File.Tests.Unix.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add tar tests to confirm entries owned by deleted users can still be read and written.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
Contributor
|
@carlossanlop an error occurred while backporting to release/7.0, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I recently fixed a tar bug in Unix where attempting to write an entry into an archive where the groupName didn't exist, we would unexpectedly throw instead of silently continuing. #81070
I checked if we had the same issue with userName, and fortunately we don't, because when we do the syscall to try to obtain the userName of a non-existent user, the syscall returns empty string, and we can store that in the entry that we are going to write.
What we were missing were test to verify the userName behavior, so I added them in this PR. I also added tests in which neither the userName or the groupName exist in the system.
I manually ran these tests as
rootin my Ubuntu WSL instance, and they all passed. I did have to add a 250 ms sleep after deleting a user or a group. The tests would intermittently fail because the OS sometimes takes too long to delete the user or the group, causing us to successfully retrieve the values and setting them to the written entry, instead of writing empty string.I also fixed the logic we use with Process to prevent the deadlock described in the Process docs remarks whenm consuming the standard output: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.standardoutput?view=net-7.0#remarks