-
Notifications
You must be signed in to change notification settings - Fork 12
Restore extracted linuxdeploy plugin discovery #543
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -742,14 +742,15 @@ prepare_tauri_linuxdeploy_tools_cache() { | |||||||||||||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| local arch linuxdeploy_arch tools cache bash_path linuxdeploy_wrapper appimage_wrapper | ||||||||||||||||||||||||||||||||||
| local arch linuxdeploy_arch tools cache bash_path linuxdeploy_wrapper appimage_wrapper linuxdeploy_appdir_bin | ||||||||||||||||||||||||||||||||||
| arch="$(linuxdeploy_tools_arch)" | ||||||||||||||||||||||||||||||||||
| linuxdeploy_arch="${arch}" | ||||||||||||||||||||||||||||||||||
| tools="${MAPLE_NIX_TAURI_LINUXDEPLOY_TOOLS}" | ||||||||||||||||||||||||||||||||||
| cache="${TAURI_DIR}/target/.tauri" | ||||||||||||||||||||||||||||||||||
| bash_path="$(command -v bash)" | ||||||||||||||||||||||||||||||||||
| linuxdeploy_wrapper="${cache}/linuxdeploy-${linuxdeploy_arch}.AppImage" | ||||||||||||||||||||||||||||||||||
| appimage_wrapper="${cache}/linuxdeploy-plugin-appimage.AppImage" | ||||||||||||||||||||||||||||||||||
| linuxdeploy_appdir_bin="${cache}/linuxdeploy-${linuxdeploy_arch}.AppDir/usr/bin" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| mkdir -p "${cache}" | ||||||||||||||||||||||||||||||||||
| install -m 0755 "${tools}/AppRun-${arch}" "${cache}/AppRun-${arch}" | ||||||||||||||||||||||||||||||||||
|
|
@@ -761,6 +762,9 @@ prepare_tauri_linuxdeploy_tools_cache() { | |||||||||||||||||||||||||||||||||
| extract_appimage_tool "${cache}/linuxdeploy-${linuxdeploy_arch}.real.AppImage" "${cache}/linuxdeploy-${linuxdeploy_arch}.AppDir" | ||||||||||||||||||||||||||||||||||
| extract_appimage_tool "${cache}/linuxdeploy-plugin-appimage.real.AppImage" "${cache}/linuxdeploy-plugin-appimage.AppDir" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| install -m 0755 "${cache}/linuxdeploy-plugin-gtk.sh" "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-gtk" | ||||||||||||||||||||||||||||||||||
| install -m 0755 "${cache}/linuxdeploy-plugin-gstreamer.sh" "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-gstreamer" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| cat > "${linuxdeploy_wrapper}" <<EOF | ||||||||||||||||||||||||||||||||||
| #!${bash_path} | ||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||
|
|
@@ -840,11 +844,66 @@ exec "\${real_plugin}" "\$@" | |||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||
| chmod +x "${appimage_wrapper}" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| rm -f "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-appimage" | ||||||||||||||||||||||||||||||||||
| cat > "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-appimage" <<EOF | ||||||||||||||||||||||||||||||||||
| #!${bash_path} | ||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| for arg in "\$@"; do | ||||||||||||||||||||||||||||||||||
| case "\${arg}" in | ||||||||||||||||||||||||||||||||||
| --plugin-type) | ||||||||||||||||||||||||||||||||||
| printf '%s\n' output | ||||||||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||
| --plugin-api-version) | ||||||||||||||||||||||||||||||||||
| printf '%s\n' 0 | ||||||||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| appdir="" | ||||||||||||||||||||||||||||||||||
| previous="" | ||||||||||||||||||||||||||||||||||
| for arg in "\$@"; do | ||||||||||||||||||||||||||||||||||
| if [ "\${previous}" = "--appdir" ]; then | ||||||||||||||||||||||||||||||||||
| appdir="\${arg}" | ||||||||||||||||||||||||||||||||||
| previous="" | ||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| case "\${arg}" in | ||||||||||||||||||||||||||||||||||
| --appdir=*) | ||||||||||||||||||||||||||||||||||
| appdir="\${arg#--appdir=}" | ||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||
| --appdir) | ||||||||||||||||||||||||||||||||||
| previous="--appdir" | ||||||||||||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if [ -n "\${appdir}" ]; then | ||||||||||||||||||||||||||||||||||
| rm -f "\${appdir}/.DirIcon" | ||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| real_plugin="$(printf '%q' "${cache}/linuxdeploy-plugin-appimage.AppDir/AppRun")" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if [ ! -x "\${real_plugin}" ]; then | ||||||||||||||||||||||||||||||||||
| echo "Missing extracted linuxdeploy AppImage plugin at \${real_plugin}" >&2 | ||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| exec "\${real_plugin}" "\$@" | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+888
to
+895
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
tmp="$(mktemp -d "/tmp/maple verify.XXXXXX")"
mkdir -p "${tmp}"
touch "${tmp}/AppRun"
chmod +x "${tmp}/AppRun"
bad="$(printf '%q' "${tmp}/AppRun")"
good="${tmp}/AppRun"
echo "bad=${bad}"
echo "good=${good}"
[ -x "${good}" ] && echo "good path resolves"
if [ -x "${bad}" ]; then
echo "unexpected: bad path resolved"
exit 1
else
echo "expected: %q-escaped value is not a valid filesystem path in variable context"
fiRepository: OpenSecretCloud/Maple Length of output: 236 Avoid Suggested patch-real_plugin="$(printf '%q' "${cache}/linuxdeploy-plugin-appimage.AppDir/AppRun")"
+real_plugin="${cache}/linuxdeploy-plugin-appimage.AppDir/AppRun"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||
| chmod +x "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-appimage" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| print_file_hashes \ | ||||||||||||||||||||||||||||||||||
| "${cache}/AppRun-${arch}" \ | ||||||||||||||||||||||||||||||||||
| "${cache}/linuxdeploy-${linuxdeploy_arch}.real.AppImage" \ | ||||||||||||||||||||||||||||||||||
| "${cache}/linuxdeploy-${linuxdeploy_arch}.AppImage" \ | ||||||||||||||||||||||||||||||||||
| "${cache}/linuxdeploy-${linuxdeploy_arch}.AppDir/AppRun" \ | ||||||||||||||||||||||||||||||||||
| "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-appimage" \ | ||||||||||||||||||||||||||||||||||
| "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-gtk" \ | ||||||||||||||||||||||||||||||||||
| "${linuxdeploy_appdir_bin}/linuxdeploy-plugin-gstreamer" \ | ||||||||||||||||||||||||||||||||||
| "${cache}/linuxdeploy-plugin-appimage.real.AppImage" \ | ||||||||||||||||||||||||||||||||||
| "${cache}/linuxdeploy-plugin-appimage.AppImage" \ | ||||||||||||||||||||||||||||||||||
| "${cache}/linuxdeploy-plugin-appimage.AppDir/AppRun" \ | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡
printf '%q'escaping conflicts with surrounding double quotes in generated scriptOn line 888,
printf '%q'is used to shell-escape the${cache}path, and the result is placed inside double quotes in the generated script. Since this is an unquoted<<EOFheredoc, the$(printf '%q' ...)is evaluated at generation time, and the escaped output is embedded literally into the generated script.printf '%q'produces output meant to be used as unquoted shell input (e.g., a space becomes\). But when that output appears inside double quotes in the generated script (real_plugin="<escaped_output>"), the escaping semantics change:\inside double quotes is not a recognized escape sequence, so the backslash is preserved literally. If${cache}ever contains spaces or other special characters, the generatedreal_pluginvariable will contain literal backslashes, causing theexecon line 895 to fail with a "No such file or directory" error.Example of incorrect generated script when path has spaces
If cache =
/home/my user/project/.tauri,printf '%q'outputs/home/my\ user/project/.tauri/..., and the generated script becomes:real_plugin="/home/my\ user/project/.tauri/linuxdeploy-plugin-appimage.AppDir/AppRun"The variable now contains a literal backslash instead of just a space.
Compare with the analogous
appimage_wrapperscript atscripts/ci/_common.sh:836which correctly uses\${script_dir}(a runtime variable inside double quotes) — noprintf '%q'needed. The fix here is to either dropprintf '%q'and rely on the double quotes in the generated script, or remove the double quotes and letprintf '%q'stand alone as an unquoted assignment.Was this helpful? React with 👍 or 👎 to provide feedback.