Skip to content

Fix: gh_report_command_failure loses argument boundaries in error message #126

Description

@codeforester

Summary

gh_report_command_failure in lib/bash/gh/lib_gh.sh uses $* to format the failing command in its error message, causing arguments with embedded spaces to lose their boundaries.

Root cause

gh_report_command_failure() {
    local status="$1"
    shift

    log_error "GitHub command failed: gh $*"   # ← $* joins args with IFS (space)
    ...
}

$* inside double quotes expands positional parameters joined by the first character of IFS (a space). An invocation like:

gh_run issue create --title "my PR title"

logs:

GitHub command failed: gh issue create --title my PR title

The quoted argument boundary is gone. A reader cannot tell whether my PR title is one argument or three.

Fix

Use printf '%q ' to build a shell-quoted representation:

local printable_args
printf -v printable_args '%q ' "$@"
log_error "GitHub command failed: gh ${printable_args% }"

This matches how __std_run_impl__ formats commands for its error messages.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions