totara / totara-docker-dev

A docker setup to create a development environment for Totara Learn
MIT License
49 stars 32 forks source link

Cannot call tbash/tzsh from outside a Totara project directory #193

Closed codyfinegan closed 1 year ago

codyfinegan commented 3 years ago

Describe the bug Can no longer run tbash or tzsh from any directory. If you're not in the REMOTE_SRC or a child of it, you'll run into the following:

OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: chdir to cwd ("/var/www/totara/src//home/cody/Projects") set in config.json failed: no such file or directory: unknown

To Reproduce Steps to reproduce the behavior:

  1. Open a terminal
  2. CD into a non-Totara folder
  3. Try running tzsh php-7.3

Expected behavior Expected to connect to the PHP container via zsh, defaulting to the "/var/www/totara/src" folder

Additional context Seems to be introduced in 52b5ae77d2c3706ec56b9799c6ce88991fd8f32e

sub_path="${PWD//$LOCAL_SRC/}"
remote_path="$REMOTE_SRC/$sub_path"

if $PWD isn't a child of $LOCAL_SRC, you'll end up with a malformed path such as /var/www/totara/src//home/cody/Projects There used to be a further check that caught it, but that's been removed:

if [ ! -f "$local_path/version.php" ]; then
    remote_path="$REMOTE_SRC"
fi
derschatta commented 1 year ago

fixed with #249 which will be part of next release