From 19990b06e9ade272117aa1dede2985edf8d09829 Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Thu, 1 Nov 2018 10:08:29 +0530 Subject: [PATCH] vagrant: Use id -g for finding a user's group. On OSX, the user id and group id don't match. So while the previous code was always wrong, it produced incorrect output there. We can fix this by replacing `whoami` with `id -g` for finding the current user's group ID. --- Vagrantfile | 2 +- docs/development/setup-vagrant.md | 2 +- docs/testing/testing.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 72cfb90d8b..2a990a9b0a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -202,7 +202,7 @@ if [ ! -w /srv/zulip ]; then # sudo is required since our uid is not 1000 echo ' vagrant halt -f' echo ' rm -rf /PATH/TO/ZULIP/CLONE/.vagrant' - echo ' sudo chown -R 1000:$(whoami) /PATH/TO/ZULIP/CLONE' + echo ' sudo chown -R 1000:$(id -g) /PATH/TO/ZULIP/CLONE' echo "Replace /PATH/TO/ZULIP/CLONE with the path to where zulip code is cloned." echo "You can resume setting up your vagrant environment by running:" echo " vagrant up" diff --git a/docs/development/setup-vagrant.md b/docs/development/setup-vagrant.md index 003b49dbdc..ab7b32f7e7 100644 --- a/docs/development/setup-vagrant.md +++ b/docs/development/setup-vagrant.md @@ -889,7 +889,7 @@ It is okay to proceed and start the Zulip server. ##### Permissions errors When building the development environment using Vagrant and the LXC provider, -if you encounter permissions errors, you may need to `chown -R 1000:$(whoami) +if you encounter permissions errors, you may need to `chown -R 1000:$(id -g) /path/to/zulip` on the host before running `vagrant up` in order to ensure that the synced directory has the correct owner during provision. This issue will arise if you run `id username` on the host where `username` is the user running diff --git a/docs/testing/testing.md b/docs/testing/testing.md index e342e1f361..55e3a02e85 100644 --- a/docs/testing/testing.md +++ b/docs/testing/testing.md @@ -126,7 +126,7 @@ something valuable to helping keep Zulip bug-free. - When building the development environment using Vagrant and the LXC provider, if you encounter permissions errors, you may need to - `chown -R 1000:$(whoami) /path/to/zulip` on the host before running + `chown -R 1000:$(id -g) /path/to/zulip` on the host before running `vagrant up` in order to ensure that the synced directory has the correct owner during provision. This issue will arise if you run `id username` on the host where `username` is the user running Vagrant