Skip to content

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Aug 18, 2025

Fixes two cross-platform compatibility issues in the tag_release.sh script:

Issues Fixed

1. macOS Version Extraction Issue

Problem: The script was showing errors like:

⚠️  anomaly/tmux: Invalid version format '  version  = "1.0.0"', skipping

Root Cause: macOS's default BSD sed doesn't support \s regex pattern for whitespace, causing version extraction to fail and return entire lines instead of just version numbers.

Fix: Replace \s with [[:space:]] in all regex patterns for cross-platform compatibility.

2. Linux jq Syntax Issue

Problem: The script was showing errors like:

jq: error: syntax error, unexpected module, expecting IDENT or __loc__ (Unix shell quoting issues?)

Root Cause: Line continuations in jq commands were causing shell parsing issues on some Linux environments.

Fix: Remove backslash line continuations from jq commands and put all arguments on single lines.

Changes Made

  • Version extraction: Replace \s* with [[:space:]]* in grep and sed patterns
  • JSON functions: Remove line continuations from add_json_error(), add_json_warning(), and add_json_module()
  • Compatibility: Ensures script works on both GNU sed (Linux) and BSD sed (macOS)

Testing

✅ Tested on Linux with the current main branch
✅ Tested on the problematic commit c2bc5cd where issues occurred
✅ Verified version extraction works correctly with various whitespace patterns
✅ Confirmed jq commands execute without syntax errors

The script now correctly detects new modules from merge commits and can release them on both macOS and Linux systems.


@coder/chris-cat Please review when you have a chance!

blink-so bot added 2 commits August 18, 2025 13:42
…tinuations

Fixes jq shell quoting issues on macOS where line continuations in jq commands
cause syntax errors. The error 'unexpected module, expecting IDENT' was occurring
because macOS shell/jq was not properly handling the backslash line continuations.

Changes:
- Remove line continuations from jq commands in add_json_error()
- Remove line continuations from jq commands in add_json_warning()
- Remove line continuations from jq commands in add_json_module()
- Put all jq arguments and filter on single lines for better compatibility

Tested on both Linux and the problematic commit c2bc5cd where the issue occurred.
…] instead of \s

The \s regex pattern is not supported by macOS default sed, causing version
extraction to fail and return entire lines instead of just version numbers.
This resulted in validation errors like "Invalid version format" with full lines.

Changes:
- Replace \s* with [[:space:]]* in grep patterns
- Replace \s* with [[:space:]]* in sed patterns
- Ensures compatibility with both GNU sed (Linux) and BSD sed (macOS)

Fixes both the original macOS version extraction issue and the Linux jq issue.
@DevelopmentCats
Copy link
Contributor

Looks great to me! Sorry I work primarily on ubuntu machines with coder. I will make sure that the scripts I write are compatible with all Unix / MacOS devices going forward.

I was trying to test this on my coder deployment but its giving me trouble this morning, so I will run it as soon as its up. I foresee no issues since they were just small changes.

@matifali matifali merged commit bb667d2 into main Aug 18, 2025
4 checks passed
@matifali matifali deleted the blink/fix-macos-jq-compatibility branch August 18, 2025 14:09
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