Skip to content

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

Description

@jmagman

Steps to Reproduce

cd dev/
SHARD=add2app_test dart bots/test.dart

Logs

https://cirrus-ci.com/task/6430807339565056?command=test_all#L54

total size is 94542653  speedup is 1.00
Stripped /Users/m/Library/Developer/Xcode/DerivedData/ios_add2app-btprswwixqqclofvuogmdxvymovu/Build/Products/Debug-iphonesimulator/ios_add2app.app/Frameworks/Flutter.framework/Flutter of architectures: armv7 arm64
Code Signing /Users/m/Library/Developer/Xcode/DerivedData/ios_add2app-btprswwixqqclofvuogmdxvymovu/Build/Products/Debug-iphonesimulator/ios_add2app.app/Frameworks/Flutter.framework with Identity -
/usr/bin/codesign --force --sign -  --preserve-metadata=identifier,entitlements '/Users/m/Library/Developer/Xcode/DerivedData/ios_add2app-btprswwixqqclofvuogmdxvymovu/Build/Products/Debug-iphonesimulator/ios_add2app.app/Frameworks/Flutter.framework'
/Users/m/Library/Developer/Xcode/DerivedData/ios_add2app-btprswwixqqclofvuogmdxvymovu/Build/Products/Debug-iphonesimulator/ios_add2app.app/Frameworks/Flutter.framework: replacing existing signature
/Users/m/Library/Developer/Xcode/DerivedData/ios_add2app-btprswwixqqclofvuogmdxvymovu/Build/Products/Debug-iphonesimulator/ios_add2app.app/Frameworks/Flutter.framework: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code


Test session results, code coverage, and logs:
	/Users/m/Library/Developer/Xcode/DerivedData/ios_add2app-btprswwixqqclofvuogmdxvymovu/Logs/Test/Test-ios_add2appTests-2019.08.29_11-37-54--0700.xcresult

Testing failed:
	Command PhaseScriptExecution failed with a nonzero exit code
	Testing cancelled because the build failed.

** TEST FAILED **


The following build commands failed:
	PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/magder/Library/Developer/Xcode/DerivedData/ios_add2app-btprswwixqqclofvuogmdxvymovu/Build/Intermediates.noindex/ios_add2app.build/Debug-iphonesimulator/ios_add2app.build/Script-7FADF19EC61F97E525982780.sh
(1 failure)

Activity

  1. added
    a: tests"flutter test", flutter_test, or one of our tests
    c: contributor-productivityTeam-specific productivity, code health, technical debt.
    a: existing-appsIntegration with existing apps via the add-to-app flow
    on Aug 29, 2019
  2. jmagman commented on Aug 29, 2019

    @jmagman
    MemberAuthor

    git bisect says it's caused by 78cca62.

  3. jmagman commented on Aug 30, 2019

    @jmagman
    MemberAuthor

    The Flutter.framework/Flutter binary is made read-only, so can't be signed:
    https://github.com/flutter/flutter/blob/master/packages/flutter_tools/bin/xcode_backend.sh#L145

    But that was added with cb2b89c (and changed with e22d0e6) back in 2017, with the intention of making the headers (not the binary) read-only. So how did this ever work? What recently changed with signing? Why does this only seem to happen in modules and not for other Flutter apps using CocoaPods?

    @christopherfujino @xster Do you have any insights?

  4. jmagman commented on Aug 30, 2019

    @jmagman
    MemberAuthor

    On a normal Flutter app:

    $ ls -la DerivedData/Runner-bccqvzuansojwlfqejmweubuujjs/Build/Products/Release-iphoneos/Runner.app/Frameworks/Flutter.framework/Flutter
    -rwxr-xr-x   1 m  primarygroup  339098928 Aug 29 17:37 Flutter
    

    In the module app:

    -r-xr-xr-x  1 m  primarygroup  33486788 Aug 29 17:35 Flutter
    

    Why is the app version writable (and therefore signable) but the module one isn't?

  5. xster commented on Aug 30, 2019

    @xster
    Member

    ummm this is really curious... I have no idea. Maybe @cbracken knows.

  6. cbracken commented on Sep 4, 2019

    @cbracken
    Member

    I am equally surprised :(

  7. jmagman commented on Sep 4, 2019

    @jmagman
    MemberAuthor

    And now I can't reproduce on my machine even on master.

  8. jmagman commented on Sep 10, 2019

    @jmagman
    MemberAuthor

    Reopening, PR was reverted.

  9. changed the title [-]add2app_test shard is failing[/-] [+]Cannot codesign Flutter.framework, replacing existing signature, Permission denied[/+] on Sep 10, 2019
  10. 5 remaining items

  11. endrelovas commented on Nov 21, 2019

    @endrelovas

    code_sign_if_enabled() {
    if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then

    Use the current code_sign_identity

    echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
    chmod -R +w $1
    local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"

    if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
      code_sign_cmd="$code_sign_cmd &"
    fi
    echo "$code_sign_cmd"
    eval "$code_sign_cmd"
    

    fi
    }

    This gets overwritten every time flutter clean is run

    Yes it does. What I do I keep open terminal with vim running. Then I save the file again typing ":w"
    This is not a solution but we can work at least until Flutter never ending beta test fixes this.

  12. Yud4du commented on Nov 29, 2019

    @Yud4du

    Screen Shot 2019-11-29 at 09 55 57

    Open Xcode -> Pods File on the left bar -> build settings -> on Install permissions, set the value to -R +w $1

    its not going to replace after flutter clean..

    poke @endrelovas @TheBestMoshe

  13. endrelovas commented on Dec 3, 2019

    @endrelovas

    Screen Shot 2019-11-29 at 09 55 57

    Open Xcode -> Pods File on the left bar -> build settings -> on Install permissions, set the value to -R +w $1

    its not going to replace after flutter run..

    poke @endrelovas @TheBestMoshe

    Nice catch if works. I will revert you back when I am in trouble again with this "feature".

  14. endrelovas commented on Dec 4, 2019

    @endrelovas

    Screen Shot 2019-11-29 at 09 55 57

    Open Xcode -> Pods File on the left bar -> build settings -> on Install permissions, set the value to -R +w $1

    its not going to replace after flutter clean..

    poke @endrelovas @TheBestMoshe

    It does not work for me.

  15. garrettlove8 commented on Dec 9, 2019

    @garrettlove8

    Still getting this issue 12/9/19
    I am on a Mac using 10.15.1. Something to note which changed in macOS Catalina is that Apple became more strict on what app they allow you open, so now the only options in Security and Privacy settings are "App Store" and "App Store and identified developers". If you follow the steps in this article to allow apps that are downloaded from anywhere this issue seems to go away

    https://www.imore.com/how-open-apps-anywhere-macos-catalina-and-mojave

  16. endrelovas commented on Dec 12, 2019

    @endrelovas

    Still getting this issue 12/9/19
    I am on a Mac using 10.15.1. Something to note which changed in macOS Catalina is that Apple became more strict on what app they allow you open, so now the only options in Security and Privacy settings are "App Store" and "App Store and identified developers". If you follow the steps in this article to allow apps that are downloaded from anywhere this issue seems to go away

    https://www.imore.com/how-open-apps-anywhere-macos-catalina-and-mojave

    I experience issue on both Mojave and High Sierra. IMO it is either flutter or cocoapods related bug.

  17. ArtemGr commented on Dec 15, 2019

    @ArtemGr

    I was hitting this after downgrading from v1.12.13+hotfix.5 to v1.9.1+hotfix.6 and cleaning the Pods resolved the issue. (cd ios && rm -rf Podfile.lock Podfile Pods)

  18. ZQ1297089376 commented on May 19, 2020

    @ZQ1297089376
  19. jmagman commented on May 19, 2020

    @jmagman
    Author
  20. nullfy commented on May 21, 2020

    @nullfy

    I was hitting this after downgrading from v1.12.13+hotfix.5 to v1.9.1+hotfix.6 and cleaning the Pods resolved the issue. (cd ios && rm -rf Podfile.lock Podfile Pods)

    it work, thanks

  21. TahaAli07 commented on Jul 1, 2020

    @TahaAli07

    I was hitting this after downgrading from v1.12.13+hotfix.5 to v1.9.1+hotfix.6 and cleaning the Pods resolved the issue. (cd ios && rm -rf Podfile.lock Podfile Pods)

    I did this , but after that if I run pod install , its says "Podfile not found"

  22. TahaAli07 commented on Jul 1, 2020

    @TahaAli07

    Moved from v1.9.1+hotfix.6 to v1.11.0 .

    To change flutter version to 1.11.0 just run

    flutter version v1.11.0

    This fixed this issue for me , tried all other other highly voted solutions but none worked.

  23. github-actions commented on Aug 19, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  24. locked as resolved and limited conversation to collaborators on Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: existing-appsIntegration with existing apps via the add-to-app flowa: tests"flutter test", flutter_test, or one of our testsc: contributor-productivityTeam-specific productivity, code health, technical debt.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions