Skip to content

Commit

Permalink
Fix unquoting of variables
Browse files Browse the repository at this point in the history
- Fix trimming of matching quote (no star after \1 reference)
- Only trim a single quote (turn any-match into optional match)
  • Loading branch information
das7pad committed Aug 20, 2024
1 parent d98e973 commit 5bc0e60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2024-08-20
### Fixed
- Fix unquoting of variables (e.g. `ALL_TEX_LIVE_DOCKER_IMAGES`)

## 2024-08-13
### Added
- Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.1.1`.
Expand Down
4 changes: 2 additions & 2 deletions lib/shared-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ function check_sharelatex_env_vars() {
function read_variable() {
local name=$1
grep -E "^$name=" "$TOOLKIT_ROOT/config/variables.env" \
| sed -r "s/^$name=([\"']*)(.+)\1*\$/\2/"
| sed -r "s/^$name=([\"']?)(.+)\1\$/\2/"
}

function read_configuration() {
local name=$1
grep -E "^$name=" "$TOOLKIT_ROOT/config/overleaf.rc" \
| sed -r "s/^$name=([\"']*)(.+)\1*\$/\2/"
| sed -r "s/^$name=([\"']?)(.+)\1\$/\2/"
}

3 comments on commit 5bc0e60

@secure12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks the config parsing completely. Try the up command from scratch and you'll see.

@das7pad
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @secure12,

Thanks for letting us know that you are having issues with the latest version of the Toolkit. I'm afraid I cannot reproduce any parsing issues with my existing setup or a fresh config. Can you open an issue on GitHub please and share the output of bin/doctor?

Greetings,
Jakob

$ cd `mktemp -d`
/tmp/tmp.QjcW6aEZ8g$ git clone https://github.com/overleaf/toolkit
Cloning into 'toolkit'...
remote: Enumerating objects: 2172, done.
remote: Counting objects: 100% (898/898), done.
remote: Compressing objects: 100% (218/218), done.
remote: Total 2172 (delta 761), reused 722 (delta 674), pack-reused 1274 (from 1)
Receiving objects: 100% (2172/2172), 811.55 KiB | 3.16 MiB/s, done.
Resolving deltas: 100% (1420/1420), done.
/tmp/tmp.QjcW6aEZ8g$ cd toolkit/
/tmp/tmp.QjcW6aEZ8g/toolkit$ bin/init 
Copying config files to 'config/'
/tmp/tmp.QjcW6aEZ8g/toolkit$ bin/up
Initiating Mongo replica set...
[+] Running 2/2
 ✔ Network overleaf_default  Created                                                               0.2s 
 ✔ Container mongo           Started                                                               0.4s 
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
Waiting for Mongo...
[+] Running 3/3
 ✔ Container redis       Created                                                                   0.2s 
 ✔ Container mongo       Running                                                                   0.0s 
 ✔ Container sharelatex  Created                                                                   0.1s 
Attaching to mongo, redis, sharelatex
redis       | 1:C 23 Aug 2024 09:30:52.265 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
...

$ curl -i 127.0.0.1/status
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Fri, 23 Aug 2024 09:31:33 GMT
...

web is alive (web)

@hpccpatest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@das7pad I think I might have found a fix and the possible cause of the issue: #293.
It's easy to reproduce this on macOS.

Please sign in to comment.