Skip to content

openemr.sh arithmetic context confusion with invalid credentials #535

@kojiromike

Description

@kojiromike

openemr developer environments are failing to start up with

openemr-1  | trying raw github composer token
openemr-1  |   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
openemr-1  |                                  Dload  Upload   Total   Spent    Left  Speed
100   112    0   112    0     0    263      0 --:--:-- --:--:-- --:--:--   262
openemr-1  | Number of github api requests remaining is null
openemr-1  | Message received from api request is ""Bad credentials""
openemr-1  | ./openemr.sh: line 561: null: unbound variable

This is due to a combination of events around

if [[ "${githubTokenRateLimit}" -gt 100 ]]; then
.

  1. The token in docker-compose.yml is no longer valid. That results in 'Bad credentials'.
  2. githubTokenRateLimit gets set to the string 'null'.
  3. Because [[ "${githubTokenRateLimit}" -gt 100 ]] occurs in arithmetic context, bash see it as (( $null > 100 )).
  4. $null is not defined, so we get an unbound variable error.

So we need to fix the token, but before we do that we need to ensure that we check if githubTokenRateLimit is numeric at all before doing arithmetic on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions