Skip to content

fix: make bin/log compatible with Bash 3.2 on macOS (closes #1440) - #1442

Merged
markshust merged 1 commit into
release/nextfrom
fix/log-bash3-compat
Jun 22, 2026
Merged

fix: make bin/log compatible with Bash 3.2 on macOS (closes #1440)#1442
markshust merged 1 commit into
release/nextfrom
fix/log-bash3-compat

Conversation

@markshust

Copy link
Copy Markdown
Owner

Summary

bin/log used the mapfile builtin (Bash 4+), which fails on stock macOS (Bash 3.2) with bin/log: line 44: mapfile: command not found (#1440).

This replaces mapfile with portable constructs:

  • All-logs branch: while IFS= read -r loop
  • Specific-files branch: a direct for loop building the path array

The latter also fixes a latent bug — the old generate_logs_file_path helper echo'd all paths onto one space-separated line, so multiple file args (bin/log system.log cache.log) collapsed into a single tail argument even on Bash 4. The now-unused helper was removed.

Testing

  • bash -n compose/bin/log passes
  • No Bash 4+ features remain; all constructs work on Bash 3.2

Closes #1440

🤖 Generated with Claude Code

Replace the Bash 4+ `mapfile` builtin with portable `while read` and
`for` loops so bin/log works on stock macOS (Bash 3.2). Also build the
specific-files path array directly, fixing a latent bug where multiple
log file arguments collapsed into a single tail argument.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug labels Jun 22, 2026
@what-the-diff

what-the-diff Bot commented Jun 22, 2026

Copy link
Copy Markdown

PR Summary

  • Simplified log file path generation
    The function generate_logs_file_path, which was used to create log file paths based on a container log path, is removed. This simplification makes it easier to track and handle log files.

  • Improved help commands implementation
    We've updated how -h and --help commands handle mapfile by replacing it with a loop. This loop draws from get_all_logs_file_path to store log file paths in the all_logs_file_path array. This ensures smoother assistance when needed.

  • Enhanced logs file path creation with additional parameters
    In instances where extra parameters are passed, we've modified the log file path generation. We've replaced mapfile with a loop that constructs logs_file_path by directly concatenation CONTAINER_LOG_PATH with the provided file names. This change boosts flexibility in inputting file names into the system.

@markshust
markshust merged commit d72875d into release/next Jun 22, 2026
3 checks passed
@markshust
markshust deleted the fix/log-bash3-compat branch June 22, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bin/log: line 44: mapfile: command not found

1 participant