Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR feedback.
  • Loading branch information
tmds committed Aug 18, 2022
commit daed79e774ddcf5d1ce02ab03087fda45a01f7a7
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal static void CreateDirectory(string fullPath, UnixFileMode? mode, bool o
return;
}

// Missing parents are created using default permissions.
// If there are missing parents, Directory.CreateDirectory will create them using default permissions.
if (mode.HasValue)
{
// Ensure we have sufficient permissions to extract in the directory.
Expand All @@ -95,7 +95,6 @@ internal static void CreateDirectory(string fullPath, UnixFileMode? mode, bool o
}
else
{
// Create directory using default permissions.
Directory.CreateDirectory(fullPath);
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/libraries/System.Formats.Tar/tests/TarTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public enum TestTarFormat

protected TarTestsBase()
{
CreateDirectoryDefaultMode = PlatformDetection.IsWindows ? UnixFileMode.None : Directory.CreateDirectory(GetRandomDirPath()).UnixFileMode;
CreateDirectoryDefaultMode = Directory.CreateDirectory(GetRandomDirPath()).UnixFileMode; // '0777 & ~umask'
}

protected static string GetTestCaseUnarchivedFolderPath(string testCaseName) =>
Expand Down Expand Up @@ -416,7 +416,8 @@ protected static void AssertEntryModeFromFileSystemEquals(TarEntry entry, UnixFi

protected static void AssertFileModeEquals(string path, UnixFileMode mode)
{
if (!PlatformDetection.IsWindows)
if (!PlatformDetection.IsWindows &&
!PlatformDetection.IsAndroid) // Android may change the requested permissions.
{
Assert.Equal(mode, File.GetUnixFileMode(path));
}
Expand Down