Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Conversation

@mdqst
Copy link

@mdqst mdqst commented Nov 23, 2024

Description:

This pull request addresses an issue in the release.sh script where the echo $usage command is not enclosed in quotes:

if [ ! -d "$brewdir" ]; then echo "Missing/invalid homebrew-pact dir"; echo $usage; exit 1; fi

The Issue:

When $usage is expanded without quotes, it can lead to unexpected behavior if the variable contains special characters, spaces, or line breaks. For example:

  • Spaces can cause echo to break the text into unintended multiple arguments.
  • Special characters can trigger unexpected shell behavior, making the output unreliable.

The Fix:

The corrected line ensures $usage is properly quoted to handle any content safely:

if [ ! -d "$brewdir" ]; then echo "Missing/invalid homebrew-pact dir"; echo "$usage"; exit 1; fi

Importance:

This fix ensures:

  1. Robustness: The script will behave as expected regardless of the content in $usage.
  2. Readability: Consistent use of quoting for variables in shell scripts improves maintainability and prevents subtle bugs.
  3. Preventive Maintenance: While $usage may currently contain simple text, future updates to the script could inadvertently introduce complex or multi-line content. This fix preemptively avoids potential issues.

PR checklist:

  • Test coverage for the proposed changes
  • PR description contains example output from repl interaction or a snippet from unit test output
  • New builtins have a FV translation
  • Documentation has been (manually) updated at https://docs.kadena.io/pact
  • Any changes that could be relevant to users have been recorded in the changelog
  • In case of changes to the Pact trace output (pact -t), make sure pact-lsp is in sync.

Additionally, please justify why you should or should not do the following:

  • Confirm replay/back compat
  • Benchmark regressions
  • (For Kadena engineers) Run integration-tests against a Chainweb built with this version of Pact

Fix missing quotes around $usage to prevent potential errors
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant