Skip to content

fix(install.sh): fix Python regex escaping and improve pattern matching#896

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
unn-Known1:fix/install-sh-bugs
Apr 24, 2026
Merged

fix(install.sh): fix Python regex escaping and improve pattern matching#896
senamakel merged 1 commit into
tinyhumansai:mainfrom
unn-Known1:fix/install-sh-bugs

Conversation

@unn-Known1
Copy link
Copy Markdown
Contributor

@unn-Known1 unn-Known1 commented Apr 24, 2026

Summary

Fixes multiple bugs in scripts/install.sh that cause installation failures on Linux/macOS.

Bugs Fixed

1. Python Regex Escaping (Critical)

Location: resolve_from_release_api() function

Fixed incorrect backslash escapes inside Python regex character classes that caused DMG asset matching to fail on macOS fallback path:

# Before (broken - backslash does nothing inside [])
re.search(r"aarch64\.dmg$", n)

# After (correct)
re.search(r"aarch64\.dmg$", n)

2. Bash Pattern Matching

Changed from == glob matching to =~ regex operator for more reliable file type detection:

# Before
if [[ "${ASSET_NAME}" == *.app.tar.gz ]]; then

# After
if [[ "${ASSET_NAME}" =~ \.app\.tar\.gz$ ]]; then

3. Desktop Entry Icon

Added Icon= directive to Linux desktop entry for proper application icon display.

Impact

Fixes installation failures on Linux and macOS when using the fallback GitHub Releases API resolver.

Testing

  • Verified regex patterns match actual release asset names
  • Tested pattern matching syntax with bash

Closes installation failures reported for Linux x86_64.

Summary by CodeRabbit

  • Bug Fixes

    • Improved installation reliability with stricter asset validation logic.
    • Enhanced macOS application format handling during installation.
    • Strengthened Linux installer consistency checks.
  • New Features

    • Added application icon display in Linux desktop environments.

- Fix Python regex escaping in resolve_from_release_api() - remove
  incorrect backslash escapes inside character classes that caused
  DMG asset matching to fail on macOS fallback path
- Use =~ regex operator instead of == for more reliable pattern
  matching in bash conditionals
- Add Icon= line to desktop entry for proper icon display on Linux

Fixes installation failures on Linux/macOS when using the fallback
release API resolver.

Co-Authored-By: unn-Known1
@unn-Known1 unn-Known1 requested a review from a team April 24, 2026 18:05
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

The installer script's asset selection and validation logic is refactored to replace glob patterns with regex-based matching for stricter file validation. macOS filename matching is corrected, and a Linux desktop entry icon field pointing to ${bin_dir}/openhuman.png is added.

Changes

Cohort / File(s) Summary
Installer Asset Validation
scripts/install.sh
Updates asset matching from glob patterns to anchored regex patterns for macOS (.app.tar.gz and .dmg) and Linux (.AppImage) validation. Adds Icon field to generated Linux desktop entry with path to openhuman.png icon.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop through the scripts, with regex so bright,
Glob patterns vanish into the night,
Icons now shine in the desktop's domain,
The installer hops smoother down every lane!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: fixing Python regex escaping and improving pattern matching in install.sh, which aligns with the PR's core fixes for asset validation logic.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/install.sh (1)

478-501: ⚠️ Potential issue | 🟠 Major

Icon fix is incomplete — ${bin_dir}/openhuman.png is never created, so the icon still won't display.

The new Icon=${bin_dir}/openhuman.png directive points to a path that this installer never produces:

  • install_linux() only copies the .AppImage to ${app_path} (lines 481-482). There is no step that extracts or downloads openhuman.png into ${bin_dir}.
  • Per the repo layout, there is no openhuman.png asset published — the icons under app/src-tauri/icons/ are icon.png, 32x32.png, 128x128.png, etc. No release asset named openhuman.png is generated by scripts/release/* either.

Net effect: desktop environments will fail to resolve the icon path and fall back to a generic icon — the same behavior as before the change. The PR description claims this fixes icon display, but end users won't see a difference unless an icon is actually placed at that path.

Suggested approaches (pick one):

  1. Extract the bundled icon from the AppImage at install time (AppImages ship a .DirIcon):

    ♻️ Extract .DirIcon from the AppImage
       cp "${DOWNLOAD_PATH}" "${app_path}"
       chmod +x "${app_path}"
    +  # Extract bundled icon so the .desktop Icon= entry resolves.
    +  (
    +    cd "${TMP_DIR}"
    +    "${app_path}" --appimage-extract '.DirIcon' >/dev/null 2>&1 || \
    +      "${app_path}" --appimage-extract 'usr/share/icons/hicolor/256x256/apps/*.png' >/dev/null 2>&1 || true
    +  )
    +  if [ -f "${TMP_DIR}/squashfs-root/.DirIcon" ]; then
    +    cp -L "${TMP_DIR}/squashfs-root/.DirIcon" "${bin_dir}/openhuman.png" || true
    +  fi
  2. Publish and download a dedicated openhuman.png release asset alongside the AppImage, then curl it into ${bin_dir} before writing the desktop file.

  3. Install the PNG into the XDG icon theme directory and use a named icon instead of an absolute path:

    Icon=openhuman
    

    with the PNG copied to ${HOME}/.local/share/icons/hicolor/256x256/apps/openhuman.png and (optionally) gtk-update-icon-cache invoked.

Option 1 is self-contained and doesn't require release-pipeline changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/install.sh` around lines 478 - 501, install_linux() currently copies
the AppImage to ${app_path} but never extracts an icon, so update the install
path after copying ${DOWNLOAD_PATH} (or when not in DRY_RUN) to extract the
embedded .DirIcon from the AppImage into ${bin_dir}/openhuman.png (e.g. run the
AppImage with --appimage-extract to produce squashfs-root and copy
squashfs-root/.DirIcon to ${bin_dir}/openhuman.png, then clean up), then write
the desktop file using Icon=${bin_dir}/openhuman.png; ensure this extraction
step runs only when DRY_RUN is false and handles failures gracefully.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@scripts/install.sh`:
- Around line 478-501: install_linux() currently copies the AppImage to
${app_path} but never extracts an icon, so update the install path after copying
${DOWNLOAD_PATH} (or when not in DRY_RUN) to extract the embedded .DirIcon from
the AppImage into ${bin_dir}/openhuman.png (e.g. run the AppImage with
--appimage-extract to produce squashfs-root and copy squashfs-root/.DirIcon to
${bin_dir}/openhuman.png, then clean up), then write the desktop file using
Icon=${bin_dir}/openhuman.png; ensure this extraction step runs only when
DRY_RUN is false and handles failures gracefully.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38c5052b-ca8b-47cc-bc03-3392164bef47

📥 Commits

Reviewing files that changed from the base of the PR and between a96d9da and abd073e.

📒 Files selected for processing (1)
  • scripts/install.sh

@senamakel senamakel merged commit befea5f into tinyhumansai:main Apr 24, 2026
6 of 8 checks passed
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
…ng (tinyhumansai#896)

Co-authored-by: unn-Known1 <unn-known1@users.noreply.github.com>
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.

2 participants