fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems with .sh script permissions

canxin121 opened this issue · comments

Describe the bug

If the project is created under windows, then the sh script permissions cannot be changed to 0o755, and when these under-privileged sh scripts are uploaded to github and executed when running flutter build ios in the MacOs Runner using Github Actions, the build process crashes due to the sh script permission issue and crashes.

(Ps. There seems to be a big problem with Flutter's logging system, when flutter build ios crashes due to sh permissions issues, Flutter incorrectly reports Building a deployable iOS app requires a selected Development Team with a Please ensure that a Development Team is selected by. )

Steps to reproduce

  1. In windows, use flutter_rust_bridge_codegen create new_app to create a new demo project.
  2. Upload the project to github, then use github action to build a ios ipa.

The workflow file used above: https://github.com/canxin121/new_app/blob/main/.github/workflows/build.yml

Logs

with --verbose

2024-03-27T14:51:56.1985690Z /Users/runner/work/myapp/myapp/ios/Pods/../.symlinks/plugins/rust_lib_violet/ios/../cargokit/build_pod.sh: line 52: /Users/runner/work/myapp/myapp/rust_builder/cargokit/run_build_tool.sh: Permission denied
2024-03-27T14:51:56.1985690Z /Users/runner/work/myapp/myapp/ios/Pods/../.symlinks/plugins/rust_lib_violet/ios/../cargokit/build_pod.sh:第52行:/ Users/runner/work/myapp/myapp/rust_builder/cargokit/run_build_tool.sh:权限被拒绝

without --verbose:

Run flutter build ios --release --no-codesign
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building com.example.hw2 for device (ios-release)...
Updating minimum iOS deployment target to 12.0.
Upgrading Podfile
Running pod install...                                           1,183ms
Running Xcode build...                                          
Xcode build done.                                            4.9s
Failed to build iOS app
════════════════════════════════════════════════════════════════════════════════
Building a deployable iOS app requires a selected Development Team with a 
Provisioning Profile. Please ensure that a Development Team is selected by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team. 
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again

For more information, please visit:
  https://flutter.dev/docs/get-started/install/macos#deploy-to-ios-devices

Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Encountered error while building for device.
Error: Process completed with exit code 1.

Expected behavior

sh scripts should be secured with executable permissions before they are used.

OS

Windows and MacOS

Hi! Thanks for opening your first issue here! 😄

Hmm, IIRC you do need to select a provisioning profile when developing ios flutter. Does it work if we just follow what Flutter says and select a provisioning profile?

Hmm, IIRC you do need to select a provisioning profile when developing ios flutter. Does it work if we just follow what Flutter says and select a provisioning profile?

I don't have a mac, but theoretically with --no-signcode there should be no need for a provisioning profile. Without using flutter_rust_bridge, it's true that building ipa can be done without it. Or with using this https://github.com/project-violet/violet to run action, it's also build ipa successfully without provisioning profile. I've confirmed this by forking it and run it mannuly.

Hmm, what about --verbose to flutter build and see the logs, maybe it will reveal something.

Hmm, what about --verbose to flutter build and see the logs, maybe it will reveal something.嗯, --verbose 来 flutter build 并查看日志怎么样,也许它会揭示一些东西。

I found something very strange.

https://github.com/canxin121/myapp
https://github.com/canxin122/myapp
These are two myapp repos from two different accounts with identical files except for .git. The second link is from a fork, and the first repo is from copying all the files (except .git) from the second repo.
44d8c75bd6dfb6dec928cec8da79149d

But now there is a very strange situation, the same GitHub action workflow builds flutter's ios ipa in the second repo, but the first repo gives me the following error:
ca1db04a20062701e87d5f8ca8581299

Then I tried to use --mirror to duplicate the second repo exactly, and it builds the ios ipa fine.

I will try to use --verbose right now.

Hmm, what about --verbose to flutter build and see the logs, maybe it will reveal something.嗯, --verbose 来 flutter build 并查看日志怎么样,也许它会揭示一些东西。

This is the action for a failed build and --verbose: https://github.com/canxin121/myapp/actions/runs/8453774701/job/23157246140; this is the action for a successful build and --verbose: https://github.com/canxin122/myapp/actions/runs/8453759931/job/23157195246

The failed one says:

2024-03-27T14:51:56.1985690Z /Users/runner/work/myapp/myapp/ios/Pods/../.symlinks/plugins/rust_lib_violet/ios/../cargokit/build_pod.sh: line 52: /Users/runner/work/myapp/myapp/rust_builder/cargokit/run_build_tool.sh: Permission denied

So it looks like your sh is not executable (wrong permission)

The failed one says:失败者说道:

2024-03-27T14:51:56.1985690Z /Users/runner/work/myapp/myapp/ios/Pods/../.symlinks/plugins/rust_lib_violet/ios/../cargokit/build_pod.sh: line 52: /Users/runner/work/myapp/myapp/rust_builder/cargokit/run_build_tool.sh: Permission denied2024-03-27T14:51:56.1985690Z /Users/runner/work/myapp/myapp/ios/Pods/../.symlinks/plugins/rust_lib_violet/ios/../cargokit/build_pod.sh:第52行:/ Users/runner/work/myapp/myapp/rust_builder/cargokit/run_build_tool.sh:权限被拒绝

So it looks like your sh is not executable (wrong permission)所以看起来你的 sh 不可执行(错误的权限)

It's really a file permissions issue, when my project is created under windows, the permissions on run_build_tool.sh can't be changed to 0o755, which results in run_build_tool.sh being uploaded to git and then having too low of permissions under the MacOS Runner in github action cannot be executed.

This can indeed be fixed by adding the line chmod a+x "$BASEDIR/run_build_tool.sh" to build_pod.sh .
canxin121/myapp@b2a809c

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 issue.