* fix(updater): restore the current app when a macOS install fails
On macOS `install_inner` moved the installed app into a `TempDir` backup and
then renamed the new bundle into place. Neither of the two steps after that
move restored the app on failure, and the `TempDir` deleted the backup on
every exit path, so a failed final rename left the user with no app at the
install path and no way back. The privileged fallback had the same shape:
`rm -rf` the app, then `mv` the new one in.
Both moves are now `replace_bundle`, which renames the current app to the
backup, renames the staged bundle into place, and renames the backup back if
that second step fails. The privileged script moves the current app aside,
moves the new one in, and restores on failure; it deletes the previous bundle
only after the new one is in place. The temp and install locations are
compared with `st_dev` before anything moves, returning the existing
`TempDirNotOnSameMountPoint` rather than failing after the app has already
been moved, and the staged bundle root is set to 0755 because `tempfile`
creates it 0700 and that mode followed it into `/Applications`.
Two unit tests cover `replace_bundle`: the staged bundle ends up in place with
the previous one in the backup, and a failed second rename leaves the current
bundle where it was and returns that error.
Closes#3505, closes#3506.
* fix(updater): exchange the current and new bundles atomically on APFS
Even with the restore in place there was a moment between the two renames
where the install path held nothing, and a process killed in that moment
left the previous app in the temp dir rather than where it belonged.
`swap_bundle` calls `renamex_np` with `RENAME_SWAP`, which exchanges the two
directories in one step so the install path always holds one of the two. The
previous app ends up in the extraction temp dir and is removed with it. Where
the file system does not support the swap (`ENOTSUP`, or `EINVAL` on older
systems) the two-rename path with the restore is used as before, and a
`PermissionDenied` from either still goes to the privileged fallback.
`libc` is added for the macOS target only; it was already in the lockfile
through tauri. One macOS test checks the exchange and skips on a file system
that reports `ENOTSUP`.
* fix(updater): keep the previous app when it cannot be restored
If the restore rename also failed, the previous app was left only in the backup TempDir and deleted with it. Keep the backup in that case and return Error::PreviousAppNotRestored with its path.
* fix(updater): quote the paths in the privileged macOS install script
The paths went into single-quoted sh words inside an AppleScript string unescaped, so a quote in the app path broke the command (run as root) or panicked on the compile expect. Quote them for sh and AppleScript, and report script failures instead of panicking.
* fix(updater): fall back to moving the bundles on any swap error
Only ENOTSUP and EINVAL got the two-rename fallback, so volumes reporting EOPNOTSUPP or ENOSYS for RENAME_SWAP failed every update. Fall back on anything but a permission error, and have the swap test skip only off APFS.
* fix(updater): stage the macOS update on the app's volume
When the system temp dir was on another volume than the app, every update was refused. Create the temp dirs next to the app in that case, and compare the install path itself rather than what a symlink there points to.
* test(updater): update a macOS app on another volume than the temp dir
Runs the app from APFS and HFS+ disk images, covering the atomic swap and the two-rename fallback with the update staged next to the app.
* fix(updater): swap the bundles atomically in the privileged macOS install
The admin path ran two mv calls, leaving the install path empty between them. Run renamex_np with RENAME_SWAP as root through osascript's JavaScript bridge, and only fall back to the moves where the swap fails.
* add test
* cleanup
---------
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
* fix(android): missing `consumer-rules.pro`
* setup android test
* copy right too new
* build api first
* we're still on gradle 8 right now...
* restore the right host on mac
* refactor(sql): Allow multiple drivers at the same time
* fmt
* remove default feature comment [skip ci]
* what was that doing there [skip ci]
* disable public methods for now
* chore: adjust prettier config, .gitignore and use taplo to format toml files
This brings the plugins-workspace repository to the same code style of the main tauri repo
* format toml
* ignore examples gen dir
* add .vscode/extensions.json
* remove packageManager field
* fmt
* fix audit
* taplo ignore permissions autogenerated files
* remove create dummy dist
* fix prettier workflow
* install fmt in prettier workflow
---------
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
* fix(updater): linux not retaining AppImage permissions, enhance tests
- adds a test for migration from v1 to v2
- extends the existing integration test to actually verify if the app was updated
* remove test framework
* fix macos test
* fix windows
* wait on windows
* fix wix
* typo
* fmt
* install webkit2gtk-4.0 on ci
* fix npm command on windows
* fix test on windows
* ubuntu-22.04
---------
Co-authored-by: Tillmann <28728469+tweidinger@users.noreply.github.com>
* init geolocation plugin
* ios impl (w/o js api)
* generate ts api
* use newer tauri commit
* add temporary postinstall
* include src in files
* guest-js
* just ship dist-js for now
* fix watcher
* fix android compile error
* fix android build for real
* fix heading type
* initial getCurrentPosition android impl (wip)
* prevent panics if errors (strings) are sent over the channel
* Add android watchPosition implementation
* init haptics plugin (android)
* ios and new apis (ANDROID IS LIKELY BROKEN - MAY NOT EVEN COMPILE)
* use tauri-specta that accounts for raw fn arg idents
* add complete android support (it's not working great due to random soft-/hardware support)
* fix(haptics): Fix the NotificationFeedbackType::Success and Version (#1)
* Fix success feedback and version
* Apply suggestions from code review
* Update package.json
---------
Co-authored-by: Fabian-Lars <118197967+FabianLars-crabnebula@users.noreply.github.com>
* android: improve permission callback handling
* keep track of ongoing perms requests
* rebuild
* license headers
* rm sqlite feat
* fmt
* what diff u talkin bout?
* ignore dist-js again
* fix audits
* dedupe api.js
* clippy
* changefiles
* readmes
* clean up todos
* rm dsstore
* rm wrong feats
* mirror
* covector
* rebuild
* ios requires the wry feature
* lint
* update lock
---------
Co-authored-by: fabianlars <fabianlars@fabianlars.de>
Co-authored-by: Brendan Allan <brendonovich@outlook.com>
Co-authored-by: Naman Garg <155433377+naman-crabnebula@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@crabnebula.dev>
Currently it compares it to the default branch (v1) which makes it always run all plugin checks. While i plan to change default branches soon i still need a bit more time for this.