Skip to content

Conversation

@eerhardt
Copy link
Member

There are scenarios where chmod succeeds, but the OS clears certain bits, like S_ISGID and S_ISUID. When this happens, the ZipFile tests fail because the .zip file doesn't contain the expected ExternalAttributes.

To fix this, read the file mode after calling chmod, and update the expected file mode so the tests still pass.

Fix #68293
Fix #60581

…pple OSes

There are scenarios where chmod succeeds, but the OS clears certain bits, like S_ISGID and S_ISUID. When this happens, the ZipFile tests fail because the .zip file doesn't contain the expected ExternalAttributes.

To fix this, read the file mode after calling chmod, and update the expected file mode so the tests still pass.

Fix dotnet#68293
Fix dotnet#60581
@ghost
Copy link

ghost commented May 19, 2022

Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.

Issue Details

There are scenarios where chmod succeeds, but the OS clears certain bits, like S_ISGID and S_ISUID. When this happens, the ZipFile tests fail because the .zip file doesn't contain the expected ExternalAttributes.

To fix this, read the file mode after calling chmod, and update the expected file mode so the tests still pass.

Fix #68293
Fix #60581

Author: eerhardt
Assignees: -
Labels:

area-System.IO.Compression

Milestone: -

@eerhardt
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

string updatedPermissions = Convert.ToString(status.Mode & 0xFFF, 8);
if (updatedPermissions != permissions)
{
string newFileName = Path.Combine(folderPath, $"{updatedPermissions}.txt");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of renaming?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected file mode is encoded in the file name. So the file named 755.txt expects the file mode to be 755.

See

foreach (ZipArchiveEntry entry in archive.Entries)
{
Assert.EndsWith(".txt", entry.Name, StringComparison.Ordinal);
EnsureExternalAttributes(entry.Name.Substring(0, entry.Name.Length - 4), entry);
}

@carlossanlop
Copy link
Contributor

IIRC this test is also disabled in 6.0, so this fix should be backported too.

@eerhardt
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@eerhardt
Copy link
Member Author

Analyzing the failures:

  • runtime-extra-platforms (Build tvOS arm64 Release AllSubsets_Mono)
    • All test failures were under System.Net.Sockets.Tests.SendPacketsAsync
  • runtime-extra-platforms (Libraries Test Run release coreclr Linux arm Release)
    • exit code 139 means SIGSEGV Illegal memory access. Deref invalid pointer, overrunning buffer, stack overflow etc. Core dumped. in System.Threading.Channels.Tests
  • runtime-extra-platforms (Libraries Test Run release coreclr windows x64 Release)
    • Exit Code:-900 in Common.Tests, Invariant.Tests, LibraryImportGenerator.Tests, Microsoft.Bcl.AsyncInterfaces.Tests

None of these test failures are related to Zip file tests. So this should be good to merge.

@jozkee jozkee merged commit 6069680 into dotnet:main May 20, 2022
@eerhardt eerhardt deleted the FixZipFileTests branch June 16, 2022 12:03
@ghost ghost locked as resolved and limited conversation to collaborators Jul 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

5 participants