From ec6611b346733719b65b49aecc32ada0114f6199 Mon Sep 17 00:00:00 2001 From: flutteractionsbot <154381524+flutteractionsbot@users.noreply.github.com> Date: Tue, 21 May 2024 07:10:28 -0700 Subject: [PATCH] [CP-stable]Fixes incorrect read/write permissions on Flutter.framework and FlutterMacOS.framework (#148717) This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/wiki/Flutter-Cherrypick-Process#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? https://github.com/flutter/flutter/issues/148354 https://github.com/flutter/flutter/issues/147142 ### Changelog Description: Correct read/write permisions for FlutterMacOS.framework to allow MacOS developers to publish to the app store ### Impact Description: MacOS developers. ### Workaround: Is there a workaround for this issue? Run chmod locally after building https://github.com/flutter/flutter/issues/148354#issuecomment-2116391118 ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? 1. `flutter build macos --release` any macos project 2. `ls -la macos/Build/Products/Release/test_create.app/Contents/Frameworks/` 3. Note that the permissions for FlutterMacOS.framework is `drwxr-xr-x`, NOT `dr-------` (note that this is validated to work here https://github.com/flutter/flutter/issues/148354#issuecomment-2116447391) --- .../lib/src/build_system/targets/ios.dart | 1 + .../lib/src/build_system/targets/macos.dart | 1 + .../build_system/targets/ios_test.dart | 2 ++ .../build_system/targets/macos_test.dart | 2 ++ .../ios_content_validation_test.dart | 17 ++++++++++++++--- .../macos_content_validation_test.dart | 5 +++++ 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart index 9ca6e543a2..56d73f7cfa 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart @@ -314,6 +314,7 @@ abstract class UnpackIOS extends Target { '--delete', '--filter', '- .DS_Store/', + '--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r', basePath, environment.outputDir.path, ]); diff --git a/packages/flutter_tools/lib/src/build_system/targets/macos.dart b/packages/flutter_tools/lib/src/build_system/targets/macos.dart index 9996664a0a..e9f48cc88e 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/macos.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/macos.dart @@ -60,6 +60,7 @@ abstract class UnpackMacOS extends Target { '--delete', '--filter', '- .DS_Store/', + '--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r', basePath, environment.outputDir.path, ]); diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart index 33bf54e29a..a21fb095af 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart @@ -541,6 +541,7 @@ void main() { '--delete', '--filter', '- .DS_Store/', + '--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r', 'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.physical', outputDir.path, ]); @@ -597,6 +598,7 @@ void main() { '--delete', '--filter', '- .DS_Store/', + '--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r', 'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.simulator', outputDir.path, ], diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart index 680d826b49..21898bd3dc 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart @@ -73,6 +73,7 @@ void main() { '--delete', '--filter', '- .DS_Store/', + '--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r', 'Artifact.flutterMacOSFramework.debug', environment.outputDir.path, ], @@ -133,6 +134,7 @@ void main() { '--delete', '--filter', '- .DS_Store/', + '--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r', // source 'Artifact.flutterMacOSFramework.debug', // destination diff --git a/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart b/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart index 2e0587524e..0f7befcac5 100644 --- a/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart +++ b/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart @@ -422,10 +422,16 @@ void main() { .whereType<Directory>() .singleWhere((Directory directory) => fileSystem.path.extension(directory.path) == '.app'); + final Directory flutterFrameworkDir = fileSystem.directory( + fileSystem.path.join( + appBundle.path, + 'Frameworks', + 'Flutter.framework', + ), + ); + final String flutterFramework = fileSystem.path.join( - appBundle.path, - 'Frameworks', - 'Flutter.framework', + flutterFrameworkDir.path, 'Flutter', ); @@ -456,6 +462,11 @@ void main() { ], ); expect(appCodesign, const ProcessResultMatcher()); + + // Check read/write permissions are being correctly set + final String rawStatString = flutterFrameworkDir.statSync().modeString(); + final String statString = rawStatString.substring(rawStatString.length - 9); + expect(statString, 'rwxr-xr-x'); }); }, skip: !platform.isMacOS, // [intended] only makes sense for macos platform. timeout: const Timeout(Duration(minutes: 10)) diff --git a/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart b/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart index 5568ad2f9a..2ff219c764 100644 --- a/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart +++ b/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart @@ -164,6 +164,11 @@ void main() { ), ); + // Check read/write permissions are being correctly set + final String rawStatString = outputFlutterFramework.statSync().modeString(); + final String statString = rawStatString.substring(rawStatString.length - 9); + expect(statString, 'rwxr-xr-x'); + // Check complicated macOS framework symlink structure. final Link current = outputFlutterFramework.childDirectory('Versions').childLink('Current'); -- GitLab