Skip to content

Conversation

@aarvio
Copy link

@aarvio aarvio commented Jan 15, 2026

  • Use similar printf formating for both text and TAP formats. Prevent printf from interpreting % as format placeholders and backslash escape sequences, preserving exact failure messages.
  • Add shellcheck disable 2329 (same reasoning as 2317).

This ensures notify_message prints messages literally, avoiding misleading or mangled failure output.

- Use similar printf formating for both text and TAP formats.
  Prevent printf from interpreting `%` as format placeholders and backslash escape sequences, preserving exact failure messages.
- Add shellcheck disable 2329 (same reasoning as 2317).

This ensures notify_message prints messages literally, avoiding misleading or mangled failure output.
@pgrange
Copy link
Member

pgrange commented Jan 18, 2026

Thanks @aarvio for your contribution but there's a problem. bash_unit depends on printf formatting in several places.

For instance, look into assert_equals:

assert_equals() {
  local expected=$1
  local actual=$2
  local message=${3:-}
  [[ -z $message ]] || message="$message\n"

  if [ "$expected" != "$actual" ]
  then
    fail "$message expected [$expected] but was [$actual]"

See how \n is added at the end of the message so that the user message is displayed on a dedicated line and then the inequality issue on another line.

Looking at that, this is ugly but it needs to be addressed before accepting your contribution. I'm not sure how, though 🤔

- To keep it more proper looking handle escape sequences are before.
  Just ensure % are not interpreted as placeholders.
@aarvio
Copy link
Author

aarvio commented Jan 18, 2026

Maybe clearer just to ensure that % is not interpreted as placeholder and keep the escape sequence rendering as it is.

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