Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'Operation not permitted @ apply2files - app/build.gradle' #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fgbreel
Copy link

@fgbreel fgbreel commented Mar 9, 2022

Hi, thanks for this plugin! 🙏🏼

I found an issue when using this plugin when the /tmp and the android code are in different devices:

`rename': Invalid cross-device link @ rb_file_s_rename - (/tmp/fastlaneIncrementVersionCode20220309-4119-s2dzmz, app/build.gradle) (Errno::EXDEV)

Changing to FileUtils.cp fixes the issue.

Best,

Gabriel Francisco

@oklimberg
Copy link
Collaborator

Hi,

what do you mein by 'different devices'? For example your Android code is on an external drive?
Whats happens with the original temp file, if you now copy it instead of moving it?
Should we delete it afterwards as well?

@fgbreel
Copy link
Author

fgbreel commented Mar 9, 2022

Hi @oklimberg I mean, different block/storage devices. The error EXDEV happens because it crosses the filesystem boundaries.

AFAICS the temp file is unlinked (removed) right after the cp happens.

@stuikomma
Copy link

Note that you can work around this issue by setting the "TMPDIR" variable to a directory on the same device.

export TMPDIR=/some/other/path

This path will be used under the hood https://github.com/ruby/ruby/blob/master/lib/tmpdir.rb#L27

In our case with gitlab CI, we do it like this. Watch out that TMPDIR doesn't mess up downloading artifacts.

job:
  script:
      # Set the tmpdir so that we don't run into this issue when incrementing the version number https://github:com/Jems22/fastlane-plugin-increment_version_code/pull/22
      # This has to be set as part of the script, because this breaks downloading artifacts when set in `variables`
    - export TMPDIR='${CI_PROJECT_DIR}/tmp'
    - mkdir -p $TMPDIR
    - bundle exec fastlane android build

@fgbreel
Copy link
Author

fgbreel commented Nov 10, 2023

Thanks @stuikomma for the suggestion, just to add more context to the discussion: I found this issue when using a (memory based) tmpfs backed temporary directory.

This patch uses cp instead of mv keeping the same behavior and the file is removed on line 73 anyway.

I'm surprised that the line 73 does not fail when the file is mv-ed (current code). 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants