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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_image_version assigns only a single sigit for the patch version #303

Open
SimoSera opened this issue Oct 29, 2024 · 0 comments
Open

Comments

@SimoSera
Copy link

Steps to Reproduce

  1. Have installed an overleaf image with patch version greater then 9 (ex. 3.5.13)
  2. Use a script to run the function read_image_version from lib/shared-functions.sh
  3. Read the $IMAGE_VERSION_PATCH variable
    Example code : (the file must be in the toolkit root to work)
#!/bin/bash       
TOOLKIT_ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
source lib/shared-functions.sh      
sudo echo 3.5.13 | sudo tee config/version
read_image_version
echo "$IMAGE_VERSION_MAJOR.$IMAGE_VERSION_MINOR.$IMAGE_VERSION_PATCH"

Expected Behaviour

The variable IMAGE_VERSION_PATCH should be the whole number (ex. 13) and not only the last digit (ex. 3)

Observed Behaviour

The variable $IMAGE_VERSION_PATCH contains only the last digit (ex.3)

Context

I was creating a script to automate my upgrade from overleaf version 3.0.1 to the latest (5.2.1).
While doing that i used shared-functions.sh to access it's functions and i needed to check the image version before upgrading to version 4.0.1 (needs image version > 3.5.10)

Technical Info

This is using the latest version of the toolkit

  • Operating System and version (desktop or mobile): Ubuntu server 20.04
  • Project and/or file: lib/shared-functions.sh

Analysis:

The problem is that the regex used in read_image_version is wrong.
Current regex: ^([0-9]+)\.([0-9]+)\.([0-9])+(-RC[0-9]*)?(-with-texlive-full)?$
Right regex: ^([0-9]+)\.([0-9]+)\.([0-9]+)+(-RC[0-9]*)?(-with-texlive-full)?$
The only difference is the + after the third number's regex.
You can test the regex only using websites like: https://regex101.com/

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

No branches or pull requests

1 participant