tauri icon indicating copy to clipboard operation
tauri copied to clipboard

fix(cli): handle symlinks in updater bundler, closes #3933

Open dceddia opened this issue 3 years ago • 13 comments

What kind of change does this PR introduce?

  • [x] Bugfix
  • [ ] Feature
  • [ ] Docs
  • [ ] New Binding issue #___
  • [ ] Code style update
  • [ ] Refactor
  • [ ] Build-related changes
  • [ ] Other, please describe:

Does this PR introduce a breaking change?

  • [ ] Yes, and the changes were approved in issue #___
  • [x] No

Checklist

  • [x] When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • [ ] A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • [ ] I have added a convincing reason for adding this feature, if necessary

Other information

dceddia avatar Apr 21 '22 03:04 dceddia

Nice catch! Though linking frameworks shows how slow the extract process is. I'll address that in another PR.

lucasfernog avatar Apr 21 '22 23:04 lucasfernog

Do we also need to handle symlinks here? I'm not sure how macOS links frameworks in the app bundle.

lucasfernog avatar Apr 21 '22 23:04 lucasfernog

Ooh yeah, probably need to handle symlinks at extraction time too. I imagine otherwise it’ll end up creating hard directories and files and/or falling over.

dceddia avatar Apr 21 '22 23:04 dceddia

The #3963 change is essential for frameworks in the updater bundle since the extract process was super slow (and a framework folder has a lot of files).

lucasfernog avatar Apr 25 '22 17:04 lucasfernog

I added a test to check that symlinks inside frameworks extract correctly, and updated the extract function to handle symlinks. I noticed the built-in entry.unpack() function seems to handle all the different types of files, so I went with that. (it didn't handle directories unfortunately, so I left the branch that deals with those).

dceddia avatar May 14 '22 16:05 dceddia

Even though the test is passing and the symlinks look good after a test run, this isn't working in my actual app. Not sure why yet...

Update: oof, nevermind me. I had built and installed a local copy of tauri-cli but my app was still building against the rc10 from crates.io instead of this version with the fixes 🤦‍♂️ Once I point my Cargo.toml at this copy it works fine.

dceddia avatar May 14 '22 23:05 dceddia

Heads up that I think I found an issue with this where it's making symlinks to absolute paths, maybe only sometimes, maybe only if the app name has a space in it. I'm looking into it, but just wanted to leave a note here not to merge this yet.

dceddia avatar Jun 07 '22 13:06 dceddia

I think this is good now. I've been running with the last fix ("avoid broken symlinks in updater bundle") for a few releases of my app, haven't seen any problems myself, and haven't had any complaints from users about Mac updates being broken.

dceddia avatar Jul 18 '22 15:07 dceddia

Hello,

Just stumbled upon the issue linked to this PR while working on https://github.com/spacedriveapp/spacedrive/pull/768. Our app requires a framework to be bundled, but after linking it in tauri.macOS.frameworks the bundle step for the updater started to fail with the error message Failed to tar.gz update directory: 'Is a directory (os error 21)'.

Is there anything else that needs to be addressed for this PR to move forward?

HeavenVolkoff avatar May 04 '23 04:05 HeavenVolkoff

Let's try to release it on 1.4, I'll let the auditors know about this.

lucasfernog avatar May 04 '23 12:05 lucasfernog

@lucasfernog what's breaking changes in this PR?

wusyong avatar May 04 '23 13:05 wusyong

There's no breaking changes, it could be a patch too.

lucasfernog avatar May 04 '23 14:05 lucasfernog

There's no breaking changes, it could be a patch too.

It would be great if this could be included in a patch release.

Also, the failed test seems to be just a typo: bundle_path should be bundle_paths here https://github.com/tauri-apps/tauri/pull/3934/files#diff-e7c0c60e9bef4a36a5940e86d4b58739b653f64ce5b116a84a6bd3a64f7268aaR317

HeavenVolkoff avatar May 08 '23 18:05 HeavenVolkoff

can we have this in v2 as well?

morajabi avatar Jul 13 '23 15:07 morajabi

Yeah @morajabi we'll merge 1.x into dev for the last time when 1.5 lands.

lucasfernog avatar Jul 13 '23 17:07 lucasfernog