overleaf / overleaf/toolkit

upgrade fails due invalid mongo version parsing

Open
#282 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
1.3k
Forks
310
Avg merge
3d 12h
Merged PRs (30d)
1

Description

Steps to Reproduce

  1. run ./bin/upgrade
  2. modify /config/overleaf.rc to new split mongo
MONGO_ENABLED=true
MONGO_DATA_PATH=data/mongo
MONGO_IMAGE=mongo
MONGO_VERSION=5.0
  1. run ./bin/upgrade

Expected Behaviour

  • should upgrade

Observed Behaviour

error message

---------------------  ERROR  -----------------------
  Invalid MONGO_VERSION: MONGO_VERSION=5.0

  MONGO_VERSION must start with the actual major version of mongo, followed by a dot.
  Example: MONGO_IMAGE=my.dockerhub.com/custom-mongo
           MONGO_VERSION=6.0-custom
---------------------  ERROR  -----------------------

Analysis

a set -x in lib/shared-functions.sh looks (for me) that some variable name/value splitting is not done correctly

overleaf:~/overleaf-toolkit# ./bin/upgrade 
Checking for code update...
No code update available for download
New docker image version available (5.1.1)
Current image version is '5.0.6' (from config/version)
Upgrade image? [y/n] y
Upgrading config/version from 5.0.6 to 5.1.1
++ read_configuration MONGO_IMAGE
++ local name=MONGO_IMAGE
++ grep -E '^MONGO_IMAGE=' /root/overleaf-toolkit/config/overleaf.rc
++ sed -r 's/^MONGO_IMAGE=(["'\'']?)(.+)\1$/\2/'
+ local mongo_image=MONGO_IMAGE=mongo
++ read_configuration MONGO_VERSION
++ local name=MONGO_VERSION
++ grep -E '^MONGO_VERSION=' /root/overleaf-toolkit/config/overleaf.rc
++ sed -r 's/^MONGO_VERSION=(["'\'']?)(.+)\1$/\2/'
+ local mongo_version=MONGO_VERSION=5.0
+ '[' -z MONGO_VERSION=5.0 ']'
+ [[ ! MONGO_VERSION=5.0 =~ ^([0-9]+)\.(.+)$ ]]
+ echo '---------------------  ERROR  -----------------------'
+ echo '  Invalid MONGO_VERSION: MONGO_VERSION=5.0'
+ echo ''
+ echo '  MONGO_VERSION must start with the actual major version of mongo, followed by a dot.'
+ echo '  Example: MONGO_IMAGE=my.dockerhub.com/custom-mongo'
+ echo '           MONGO_VERSION=6.0-custom'
+ echo '---------------------  ERROR  -----------------------'
+ exit 1

I think mongo_version should be 5.0 and not MONGO_VERSION=5.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bin/upgrade and the read_configuration function in lib/shared-functions.sh, then reproduce the failure using the MONGO_IMAGE and MONGO_VERSION values shown in the issue. Verify that the parsed version is 5.0 rather than including its variable name, and rerun ./bin/upgrade to confirm the upgrade proceeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.