Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Script Compatibility Across Different Bash Versions #1185

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

cubxxw
Copy link
Contributor

@cubxxw cubxxw commented Oct 11, 2023

Replaced the -v operator with a more universally compatible method for variable checking in the bash script. The update uses parameter expansion to check if a variable is set, ensuring the script runs smoothly on environments with different Bash versions.

Issue: #1182


馃攳 What type of PR is this?

/kind bug

馃憖 What this PR does / why we need it:

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

馃叞 Which issue(s) this PR fixes:

Fixes #1182

What Has Changed

  • Updated the method used to check if a variable is set within the bash script. Previously, the -v operator was used which is not supported in some Bash versions, leading to an error in certain environments.

Why Change It

  • The use of the -v operator can lead to errors in environments using an older Bash version or different shells, hampering the script's reliability and portability.
  • Implementing a more universally compatible variable checking method allows our script to operate consistently across various environments, increasing its robustness and usability.

How the Change Has Been Implemented

  • Replaced instances of the -v operator with a more traditionally compatible method, using parameter expansion.

Test and Verification

  • The updated script has been tested in environments with different Bash versions to ensure compatibility and functionality.

Example:

# Replacing:
# if [[ ! -v COLOR_OPEN ]]; then

# With:
if [ -z "${COLOR_OPEN+x}" ]; then
    COLOR_OPEN=1
fi

Linked Issue: [If there鈥檚 an associated issue/ticket, reference it here]

Testing Procedures: Provide detailed instructions on how the changes have been tested and verified. Specify environments, tools, and scenarios used for testing.

Screenshots: Include any screenshots or GIFs if they provide relevant visual context.

Additional Context: Add any other context or information to help reviewers understand the changes and their impact.

Replaced the `-v` operator with a more universally compatible method for variable checking in the bash script. The update uses parameter expansion to check if a variable is set, ensuring the script runs smoothly on environments with different Bash versions.

Issue: #1182
@cubxxw cubxxw requested a review from Bloomingg October 11, 2023 16:20
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 11, 2023
@cubxxw cubxxw temporarily deployed to openim October 11, 2023 16:20 — with GitHub Actions Inactive
@cubxxw cubxxw temporarily deployed to openim October 11, 2023 16:20 — with GitHub Actions Inactive
@cubxxw cubxxw temporarily deployed to openim October 11, 2023 16:20 — with GitHub Actions Inactive
@cubxxw cubxxw temporarily deployed to openim October 11, 2023 16:20 — with GitHub Actions Inactive
@cubxxw cubxxw temporarily deployed to openim October 11, 2023 16:20 — with GitHub Actions Inactive
@cubxxw cubxxw temporarily deployed to openim October 11, 2023 16:20 — with GitHub Actions Inactive
@cubxxw cubxxw temporarily deployed to openim October 11, 2023 16:20 — with GitHub Actions Inactive
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 11, 2023
@openimbot openimbot added this pull request to the merge queue Oct 12, 2023
Merged via the queue into main with commit d8dbcbb Oct 12, 2023
19 checks passed
@openimbot openimbot deleted the fix/bug-ensure-bash branch October 12, 2023 02:45
@github-actions github-actions bot added this to the v3.1 milestone Oct 12, 2023
@openimsdk openimsdk locked and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Other]: make init scripts/../scripts/lib/color.sh: line 23: conditional binary operator expected
3 participants