Skip to content

Keep Flutter.framework binaries writable so they can be code signed#39539

Merged
jmagman merged 2 commits intoflutter:masterfrom
jmagman:writable
Sep 4, 2019
Merged

Keep Flutter.framework binaries writable so they can be code signed#39539
jmagman merged 2 commits intoflutter:masterfrom
jmagman:writable

Conversation

@jmagman
Copy link
Member

@jmagman jmagman commented Aug 30, 2019

Description

Flutter.framework files were made read-only to "Provide a strong hint to developers that editing Flutter framework headers isn't supported" (cb2b89c) However this is making the Flutter binary readonly, which is being copied into the final embedded Frameworks directories, then can't be codesigned.

Related Issues

Fixes #39507.

Tests

Turn back on add2app shard.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change (Please read [Handling breaking changes]). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@jmagman jmagman added tool Affects the "flutter" command-line tool. See also t: labels. a: existing-apps Integration with existing apps via the add-to-app flow t: xcode "xcodebuild" on iOS and general Xcode project management labels Aug 30, 2019
@jmagman jmagman self-assigned this Aug 30, 2019
@jmagman
Copy link
Member Author

jmagman commented Aug 30, 2019

This is a bit speculative. See #39507 (comment).

  1. The original logic was introduced in 2017, so what changed?
  2. I wasn't able to reproduce this in a non-module, so what's the difference?
  3. This seems flaky. Even though according to a git bisect this was exposed 20 days ago with 78cca62, there are many Cirrus runs of add2app that succeeded. So why is this flaky?

@xster xster requested a review from cbracken August 30, 2019 03:45
@jmagman
Copy link
Member Author

jmagman commented Aug 30, 2019

First add2app-macos test passed. Will keep rebasing to see if it's still flaky.

@jmagman
Copy link
Member Author

jmagman commented Aug 30, 2019

First add2app-macos test passed. Will keep rebasing to see if it's still flaky.

Passed a second time.

@jmagman
Copy link
Member Author

jmagman commented Aug 30, 2019

First add2app-macos test passed. Will keep rebasing to see if it's still flaky.

Passed a second time.

add2app-macos test failed, but got way past signing permissions to a flaky unit test? So not from this change (though still concerning).
https://cirrus-ci.com/task/4538022030213120

@jmagman
Copy link
Member Author

jmagman commented Sep 3, 2019

First add2app-macos test passed. Will keep rebasing to see if it's still flaky.

Passed a second time.

add2app-macos test failed, but got way past signing permissions to a flaky unit test? So not from this change (though still concerning).
https://cirrus-ci.com/task/4538022030213120

Cirrus CI
[Remove](#)


  [Instruction test_all failed in 02:52](https://cirrus-ci.com/task/4538022030213120)




  
    ✅ 01:41 clone

✅ 00:01 print_date
✅ 00:03 install_cocoapods
✅ 01:06 git_fetch
✅ 05:45 setup
✅ 00:02 setup_xcpretty
❌ 02:52 test_all

> > [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Full Screen (Cold)")]
> > performAction:grey_tap()];
> > ```
> > 
> > testFullScreenCanPop, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
> > /tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:41
> > ```
> > 
> > 
> > [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Full Screen (Cold)")]
> > performAction:grey_tap()];
> > ```
> > 
> > testHybridView, Exception: NoMatchingElementException
> > /tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:114
> > ```
> > 
> > 
> > [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Hybrid View (Warm)")]
> > performAction:grey_tap()];
> > ```
> > 
> > testHybridView, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
> > /tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:114
> > ```
> > 
> > 
> > [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Hybrid View (Warm)")]
> > performAction:grey_tap()];
> > ```
> > 
> > 
> >    Executed 4 tests, with 6 failures (6 unexpected) in 22.883 (22.919) seconds
> > 2019-08-30 14:50:15.653 xcodebuild[16360:33968] [MT] IDETestOperationsObserverDebug: 103.533 elapsed -- Testing started completed.
> > 2019-08-30 14:50:15.654 xcodebuild[16360:33968] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
> > 2019-08-30 14:50:15.654 xcodebuild[16360:33968] [MT] IDETestOperationsObserverDebug: 103.533 sec, +103.532 sec -- end
> > 
> > Failing tests:
> >   ios_add2appTests:
> >   	-[FlutterTests testDualFlutterView]
> >   	-[FlutterTests testDualFlutterView]
> >   	-[FlutterTests testFullScreenCanPop]
> >   	-[FlutterTests testFullScreenCanPop]
> >   	-[FlutterTests testHybridView]
> >   	-[FlutterTests testHybridView]
> > 
> > Test session results and logs:
> >   /Users/anka/Library/Developer/Xcode/DerivedData/ios_add2app-csiwhdwugybmwjeggtidemdjpolj/Logs/Test/Test-ios_add2appTests-2019.08.30_14-47-54--0700.xcresult
> > 
> > ** TEST FAILED **
> > 
> > ▌14:50:22▐ ELAPSED TIME: 3min 53.429s for ../../../build_and_test.sh  in dev/integration_tests/ios_add2app
> > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> > ERROR: Last command exited with 65 (expected: zero).
> > Command: ../../../build_and_test.sh 
> > Relative working directory: dev/integration_tests/ios_add2app
> > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> > ```
> > 
> > 
> >       
> >       
> >        Show more
> >        Show less

Test Suite ios_add2appTests.xctest started
FlutterTests
    ✗ testDualFlutterView, Exception: NoMatchingElementException
    ✗ testDualFlutterView, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
    ✗ testFullScreenCanPop, Exception: NoMatchingElementException
    ✗ testFullScreenCanPop, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
    ✗ testHybridView, Exception: NoMatchingElementException
    ✗ testHybridView, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
ViewControllerRelease
    ✓ testReleaseFlutterViewController (2.455 seconds)
FlutterTests
  testDualFlutterView, Exception: NoMatchingElementException
  /tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:96

// Verify that there are two Flutter views with the expected marquee text.
[[[EarlGrey
selectElementWithMatcher:grey_accessibilityLabel(@"This is Marquee")]

testDualFlutterView, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
/tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:96

// Verify that there are two Flutter views with the expected marquee text.
[[[EarlGrey
selectElementWithMatcher:grey_accessibilityLabel(@"This is Marquee")]

testFullScreenCanPop, Exception: NoMatchingElementException
/tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:41

[[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Full Screen (Cold)")]
performAction:grey_tap()];

testFullScreenCanPop, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
/tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:41

[[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Full Screen (Cold)")]
performAction:grey_tap()];

testHybridView, Exception: NoMatchingElementException
/tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:114

[[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Hybrid View (Warm)")]
performAction:grey_tap()];

testHybridView, failed: caught "EarlGreyInternalTestInterruptException", "Immediately halt execution of testcase"
/tmp/flutter sdk/dev/integration_tests/ios_add2app/ios_add2appTests/IntegrationTests.m:114

[[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Hybrid View (Warm)")]
performAction:grey_tap()];

   Executed 4 tests, with 6 failures (6 unexpected) in 22.883 (22.919) seconds

@jmagman
Copy link
Member Author

jmagman commented Sep 3, 2019

First add2app-macos test passed. Will keep rebasing to see if it's still flaky.

Passed a second time.

Passed (the step in question) a fourth time. Removing WIP.

@cbracken Does any of this make sense to you? #39539 (comment)

@jmagman jmagman changed the title WIP Keep Flutter.framework binaries writable so they can be code signed Keep Flutter.framework binaries writable so they can be code signed Sep 3, 2019
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

mkdir "${derived_dir}/engine"
RunCommand cp -r -- "${flutter_podspec}" "${derived_dir}/engine"
RunCommand cp -r -- "${flutter_framework}" "${derived_dir}/engine"
RunCommand find "${derived_dir}/engine/Flutter.framework" -type f -exec chmod a-w "{}" \;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment noting this is marking all non-binary files as read-only so that we can code-sign the binaries.

Copy link
Member

Choose a reason for hiding this comment

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

I also wonder if there's any way to get the same list using only options to find rather than feeding it through grep -Il then into xargs.

Looking at the manpage, I don't see anything promising though.

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my first thought but I couldn't find any such flag.

@jmagman
Copy link
Member Author

jmagman commented Sep 4, 2019

Even though I can't prove this will fix the flaky add-to-app test, I'm going to merge it since I still think it's a good change. If we continue to see the flakes we can try to gather more info about the environments where this is reproducing.

@jmagman jmagman merged commit 72cacb4 into flutter:master Sep 4, 2019
@jmagman jmagman deleted the writable branch September 4, 2019 01:00
@Hixie
Copy link
Contributor

Hixie commented Sep 5, 2019

This broke devicelab, because now we can't delete the flutter repo anymore.

Hixie added a commit that referenced this pull request Sep 5, 2019
Hixie added a commit that referenced this pull request Sep 5, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: existing-apps Integration with existing apps via the add-to-app flow t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot codesign Flutter.framework, replacing existing signature, Permission denied

4 participants