Skip to content

fix: guard symlinks and grep-q in build_latest_perl.sh and build_imagick.sh#18

Merged
teodesian merged 1 commit into
masterfrom
koan.trogbot/fix-perl-imagick-idempotency
Apr 26, 2026
Merged

fix: guard symlinks and grep-q in build_latest_perl.sh and build_imagick.sh#18
teodesian merged 1 commit into
masterfrom
koan.trogbot/fix-perl-imagick-idempotency

Conversation

@troglodyne

Copy link
Copy Markdown
Contributor

What

Two idempotency/correctness fixes in the perl and imagick build scripts.

Why

build_latest_perl.sh: Four ln -s calls (lines 43–46) were unguarded. On any re-run after initial provision they fail with "File exists", aborting the script. Also: /root/bin was never created before the symlinks into it, so even the first run would fail if /root/bin didn't already exist.

build_imagick.sh: [ $(grep "/usr/local/lib" /etc/ld.so.conf) ] uses the same word-splitting-on-grep-output pattern flagged in PR #15. If the line is found, $(grep ...) returns a path string that may contain spaces or appear multiple times — this is fragile and can silently misbehave depending on shell word-splitting.

How

  • build_latest_perl.sh: [ -L target ] || ln -s ... guard on all four symlinks; mkdir -p /root/bin before the symlinks into it. Matches the pattern used everywhere else in the codebase.
  • build_imagick.sh: grep -q "/usr/local/lib" /etc/ld.so.conf || echo ... — clean idiom, no word-splitting. Also changed mkdir /tmp/imagick; /bin/true to mkdir -p /tmp/imagick.

Testing

bash -n passes on both scripts. Changes are mechanical guards matching established patterns.

build_latest_perl.sh: ln -s calls on lines 43–46 were unguarded — they
fail with "File exists" on every re-run after initial provision. Guard
each with [ -L target ] || ln -s ... matching the pattern from all other
recipes. Also add mkdir -p /root/bin (was missing; ln -s would fail even
on first run if /root/bin doesn't exist).

build_imagick.sh: [ $(grep ...) ] is word-splitting on grep output —
same pattern flagged in the DKIM records fix (PR #15). Replace with
grep -q. Also change mkdir /tmp/imagick; /bin/true to mkdir -p.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@troglodyne

Copy link
Copy Markdown
Contributor Author

This one looks ok to me, taking out of draft

@troglodyne troglodyne marked this pull request as ready for review April 26, 2026 06:11
@teodesian teodesian merged commit 2c0578e into master Apr 26, 2026
@troglodyne troglodyne deleted the koan.trogbot/fix-perl-imagick-idempotency branch May 23, 2026 20:37
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.

3 participants