Conversation
Tsk 4.14.0 update
…mber-to-4.22.1 Uprade version number to 4.22.1
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughA new Bash script is introduced that builds a macOS application bundle at Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@macos-bundle.sh`:
- Around line 74-77: The echo message has a typo ("Copyng") and the rsync source
uses invalid parameter expansion `${autopsy,bin,etc}` which should be a
brace-expanded list; update the echo to "Copying application..." and change the
rsync source to explicitly list the three directories (or use brace expansion)
so rsync copies "$SRC/autopsy" "$SRC/bin" "$SRC/etc" (or
"$SRC/{autopsy,bin,etc}") into "$APP/Contents/Resources/app/"; ensure variables
SRC and APP are used as in the original rsync command.
- Around line 1-2: Add strict mode to the top of macos-bundle.sh by enabling set
-euo pipefail and IFS handling, and update the icon generation block (the
section that references autopsy.png, sips and iconutil) to stop suppressing
stdout/stderr, validate that autopsy.png exists and that sips and iconutil are
available (use which/command -v checks), and abort with a clear error message if
any dependency or file is missing; ensure the icon generation commands
themselves return non-zero on failure so the script exits under strict mode.
- Around line 53-66: The copied etc/autopsy.conf contains a stale jdkhome="jre"
that will override the JAVA_HOME chosen by the launcher (JAVA_HOME logic and
exec "$APP_ROOT/bin/autopsy"); after the rsync/copy step in macos-bundle.sh but
before exec "$APP_ROOT/bin/autopsy", remove any existing jdkhome entries from
"$APP_ROOT/etc/autopsy.conf" (e.g. use sed -i or grep -v to delete lines
matching ^jdkhome=) so the launcher’s JAVA_HOME selection is not overridden;
ensure the removal targets the same file referenced by APP_ROOT and is done on
macOS-compatible sed/commands.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b41d9aff-2385-4f95-bd0a-f7fbf14df8c0
⛔ Files ignored due to path filters (1)
autopsy.pngis excluded by!**/*.png
📒 Files selected for processing (1)
macos-bundle.sh
| #! /usr/bin/env bash | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n 'set -euo pipefail|sips|iconutil|> /dev/null 2>&1' macos-bundle.shRepository: sleuthkit/autopsy
Length of output: 874
🏁 Script executed:
head -50 macos-bundle.sh | cat -nRepository: sleuthkit/autopsy
Length of output: 1664
🏁 Script executed:
sed -n '80,100p' macos-bundle.sh | cat -nRepository: sleuthkit/autopsy
Length of output: 1106
Top-level script lacks strict mode, and the icon block suppresses all tool output.
The macos-bundle.sh script has no set -euo pipefail at the top level, allowing silent failures. The icon generation block (lines 83–98) silently suppresses all output with > /dev/null 2>&1 and has no checks for required dependencies (autopsy.png, sips, iconutil). A missing source file or unavailable tool will produce a broken bundle without any error indication.
Proposed fix
#! /usr/bin/env bash
+set -euo pipefail
+For lines 83–98:
echo "Creating icon set..."
+[ -f "autopsy.png" ] || { echo "autopsy.png not found" >&2; exit 1; }
+command -v sips >/dev/null || { echo "sips is required" >&2; exit 1; }
+command -v iconutil >/dev/null || { echo "iconutil is required" >&2; exit 1; }
mkdir -p tmp/autopsy.iconset
(
sips -z 16 16 autopsy.png --out tmp/autopsy.iconset/icon_16x16.png
@@ -94,7 +94,7 @@
sips -z 512 512 autopsy.png --out tmp/autopsy.iconset/icon_512x512.png
-) > /dev/null 2>&1
+)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #! /usr/bin/env bash | |
| #! /usr/bin/env bash | |
| set -euo pipefail | |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@macos-bundle.sh` around lines 1 - 2, Add strict mode to the top of
macos-bundle.sh by enabling set -euo pipefail and IFS handling, and update the
icon generation block (the section that references autopsy.png, sips and
iconutil) to stop suppressing stdout/stderr, validate that autopsy.png exists
and that sips and iconutil are available (use which/command -v checks), and
abort with a clear error message if any dependency or file is missing; ensure
the icon generation commands themselves return non-zero on failure so the script
exits under strict mode.
| # Prefer a JDK 17 if present; fall back to default | ||
| if [ -z "${JAVA_HOME:-}" ]; then | ||
| if /usr/libexec/java_home -v 17 >/dev/null 2>&1; then | ||
| export JAVA_HOME="$("/usr/libexec/java_home" -v 17)" | ||
| else | ||
| export JAVA_HOME="$("/usr/libexec/java_home" 2>/dev/null || true)" | ||
| fi | ||
| [ -n "${JAVA_HOME:-}" ] && export PATH="\$JAVA_HOME/bin:\$PATH" | ||
| fi | ||
|
|
||
| # Start from the app's root so relative paths work | ||
| cd "\$APP_ROOT" | ||
| exec "\$APP_ROOT/bin/autopsy" | ||
| EOT |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C3 'jdkhome|--jdkhome|JAVA_HOME' \
macos-bundle.sh \
netbeans-plat/15/harness/launchers/app.sh \
unix_setup.sh
rg -n '^[[:space:]]*#?[[:space:]]*jdkhome=' etc/autopsy.conf || trueRepository: sleuthkit/autopsy
Length of output: 3799
🏁 Script executed:
cat -n macos-bundle.sh | sed -n '1,90p'Repository: sleuthkit/autopsy
Length of output: 3120
🏁 Script executed:
# Check the full context of how jdkhome is handled in app.sh
cat -n netbeans-plat/15/harness/launchers/app.sh | sed -n '80,110p'Repository: sleuthkit/autopsy
Length of output: 873
🏁 Script executed:
# Search for any nbexec or java launcher documentation
fd -type f \( -name "*.md" -o -name "*.txt" -o -name "README*" \) | head -20Repository: sleuthkit/autopsy
Length of output: 231
🏁 Script executed:
# Check if there's a default autopsy.conf to see typical jdkhome entries
fd -type f -name "autopsy.conf*"Repository: sleuthkit/autopsy
Length of output: 231
🏁 Script executed:
# Search for autopsy.conf files
find . -name "*autopsy.conf*" -type f 2>/dev/null | head -20Repository: sleuthkit/autopsy
Length of output: 97
🏁 Script executed:
# Check what bin/autopsy actually is
cat -n bin/autopsy | head -30Repository: sleuthkit/autopsy
Length of output: 104
🏁 Script executed:
# Search for any netbeans nbexec documentation or comments about --jdkhome
rg -A2 -B2 'jdkhome' netbeans-plat/15/harness/launchers/ --type shRepository: sleuthkit/autopsy
Length of output: 1386
🏁 Script executed:
# Check the default autopsy.conf
cat installer_autopsy/etc/autopsy.confRepository: sleuthkit/autopsy
Length of output: 3517
🏁 Script executed:
# Search for where bin/autopsy gets created - it's likely from netbeans-plat
find . -path "*/bin/*" -type f | grep -E "(autopsy|launcher)" | head -20Repository: sleuthkit/autopsy
Length of output: 229
🏁 Script executed:
# Check if app.sh actually uses JAVA_HOME or only jdkhome
rg -n 'JAVA_HOME|jdkhome' netbeans-plat/15/harness/launchers/app.sh | head -20Repository: sleuthkit/autopsy
Length of output: 328
🏁 Script executed:
# Verify the rsync command at lines 76-77
cat -n macos-bundle.sh | sed -n '73,80p'Repository: sleuthkit/autopsy
Length of output: 312
🏁 Script executed:
# Check if there's a template or mechanism to customize jdkhome in macos-bundle.sh
rg -n 'jdkhome|autopsy.conf' macos-bundle.shRepository: sleuthkit/autopsy
Length of output: 43
Remove stale jdkhome from config after bundle assembly.
The launcher carefully selects JAVA_HOME (preferring JDK 17), but bin/autopsy (which is the netbeans app.sh launcher) reads jdkhome from etc/autopsy.conf and passes --jdkhome to nbexec, overriding the launcher's selection. The copied config file contains jdkhome="jre", which will override the JAVA_HOME set at lines 54-61.
This mirrors the pattern in unix_setup.sh (lines 55-57), which removes jdkhome before setting a new value (though the comment notes this only works on Linux). The same cleanup is needed here after rsync copies the stale config.
Proposed fix
rsync -a --delete --exclude=".git" --exclude="target" \
"$SRC/${autopsy,bin,etc}" "$APP/Contents/Resources/app/"
+
+# Prevent stale jdkhome from overriding launcher JAVA_HOME selection
+CONF="$APP/Contents/Resources/app/etc/autopsy.conf"
+if [ -f "$CONF" ]; then
+ awk '!/^[[:space:]]*jdkhome=/' "$CONF" > "$CONF.tmp"
+ mv "$CONF.tmp" "$CONF"
+fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@macos-bundle.sh` around lines 53 - 66, The copied etc/autopsy.conf contains a
stale jdkhome="jre" that will override the JAVA_HOME chosen by the launcher
(JAVA_HOME logic and exec "$APP_ROOT/bin/autopsy"); after the rsync/copy step in
macos-bundle.sh but before exec "$APP_ROOT/bin/autopsy", remove any existing
jdkhome entries from "$APP_ROOT/etc/autopsy.conf" (e.g. use sed -i or grep -v to
delete lines matching ^jdkhome=) so the launcher’s JAVA_HOME selection is not
overridden; ensure the removal targets the same file referenced by APP_ROOT and
is done on macOS-compatible sed/commands.
| echo "Copyng application..." | ||
| SRC="$PWD" # Change if necessary | ||
| rsync -a --delete --exclude=".git" --exclude="target" \ | ||
| "$SRC/${autopsy,bin,etc}" "$APP/Contents/Resources/app/" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n '\$\{autopsy,bin,etc\}' macos-bundle.sh
bash -lc 'unset autopsy; SRC=/tmp/src; printf "current=[%s]\n" "$SRC/${autopsy,bin,etc}"'
bash -lc 'SRC=/tmp/src; printf "expected=[%s]\n" "$SRC"/{autopsy,bin,etc}'Repository: sleuthkit/autopsy
Length of output: 433
Fix invalid Bash expansion in the rsync source list and typo on line 74.
Line 77 uses ${autopsy,bin,etc} (parameter expansion), not brace expansion. When the autopsy variable is unset, this resolves to an empty value, causing rsync to sync only $SRC/ instead of the three required directories. Additionally, line 74 contains a typo: "Copyng" should be "Copying".
Proposed fix
-echo "Copyng application..."
+echo "Copying application..."
SRC="$PWD" # Change if necessary
-rsync -a --delete --exclude=".git" --exclude="target" \
- "$SRC/${autopsy,bin,etc}" "$APP/Contents/Resources/app/"
+for d in autopsy bin etc; do
+ [ -d "$SRC/$d" ] || { echo "Missing required directory: $SRC/$d" >&2; exit 1; }
+done
+rsync -a --delete --exclude=".git" --exclude="target" \
+ "$SRC/autopsy/" "$SRC/bin/" "$SRC/etc/" "$APP/Contents/Resources/app/"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| echo "Copyng application..." | |
| SRC="$PWD" # Change if necessary | |
| rsync -a --delete --exclude=".git" --exclude="target" \ | |
| "$SRC/${autopsy,bin,etc}" "$APP/Contents/Resources/app/" | |
| echo "Copying application..." | |
| SRC="$PWD" # Change if necessary | |
| for d in autopsy bin etc; do | |
| [ -d "$SRC/$d" ] || { echo "Missing required directory: $SRC/$d" >&2; exit 1; } | |
| done | |
| rsync -a --delete --exclude=".git" --exclude="target" \ | |
| "$SRC/autopsy/" "$SRC/bin/" "$SRC/etc/" "$APP/Contents/Resources/app/" |
🧰 Tools
🪛 Shellcheck (0.11.0)
[warning] 77-77: autopsy is referenced but not assigned.
(SC2154)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@macos-bundle.sh` around lines 74 - 77, The echo message has a typo ("Copyng")
and the rsync source uses invalid parameter expansion `${autopsy,bin,etc}` which
should be a brace-expanded list; update the echo to "Copying application..." and
change the rsync source to explicitly list the three directories (or use brace
expansion) so rsync copies "$SRC/autopsy" "$SRC/bin" "$SRC/etc" (or
"$SRC/{autopsy,bin,etc}") into "$APP/Contents/Resources/app/"; ensure variables
SRC and APP are used as in the original rsync command.
|
Notes on this:
|
Summary by CodeRabbit
.appbundle in the Applications folder. The bundling process automatically configures Java 17 runtime settings, generates application icons, applies code signing, and removes quarantine attributes for a smooth user experience.