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

Ignition Gazebo read and write the user home directory #31

Open
traversaro opened this issue Oct 27, 2021 · 7 comments
Open

Ignition Gazebo read and write the user home directory #31

traversaro opened this issue Oct 27, 2021 · 7 comments

Comments

@traversaro
Copy link
Contributor

See #27 (comment) . I have the feeling that this breaks for most users principle_of_least_astonishment, as I guess most users would expect that what happens in one conda environments remains in that conda environment.

@traversaro traversaro changed the title Ignition Gazebo read and write the user home Ignition Gazebo read and write the user home directory Oct 27, 2021
@traversaro
Copy link
Contributor Author

In particular, this means that if via a conda gazebo the configuration file or anything else that is saved in the user home is changed, this influence the apt installed version of gazebo.

@traversaro
Copy link
Contributor Author

A possible strategy to solve this is to re-define HOME env variable in *nix and USERPROFILE on Windows (see https://github.com/ignitionrobotics/ign-common/blob/8ba9b71526b63193159adc577976949e83a089ee/include/ignition/common/Util.hh#L37 and gazebosim/gz-common#127) to point to a directory inside the environment, but I am not sure if this is even possible/desireable. Furthermore, I guess this needs to be discussed at conda-forge level.

@diegoferigo
Copy link

I fully agree on your comments. Maybe what we can do in the conda distribution is changing IGN_HOMEDIR to point to a custom environment variable, that can be defined per-conda-environment in the activation / deactivation scripts.

@traversaro
Copy link
Contributor Author

A less invasive change is probably to patch ign-common to point to use a ignition-specific env variable, and just define that one to point to a directory in the conda environment.

@traversaro
Copy link
Contributor Author

To check

I fully agree on your comments. Maybe what we can do in the conda distribution is changing IGN_HOMEDIR to point to a custom environment variable, that can be defined per-conda-environment in the activation / deactivation scripts.

* https://github.com/ignitionrobotics/ign-common/blob/ee5ba8e596e86e41dcec61847c3b6bdf0fa8c04a/include/ignition/common/Util.hh#L36-L40

* https://github.com/search?q=org%3Aignitionrobotics+IGN_HOMEDIR&type=code

It seems we had the same idea indipendently. Even if Gazebo does not follow XDG specs, I searched for the XDG env variables (see https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) in conda-forge organization to check if this was already discussed, but I could not find anything.

@diegoferigo
Copy link

It seems we had the same idea indipendently.

Yep, here below some more details :)

A less invasive change is probably to patch ign-common to point to use a ignition-specific env variable, and just define that one to point to a directory in the conda environment.

Yep, what I was proposing is something similar, but also giving the possibility to users to point to another folder (that could also be the original one in $HOME by re-exporting the environment variable.

In short:

  1. Change the macro defining #define IGN_HOMEDIR "IGN_HOME_DIR"
  2. Export an env var from activate sh/bat export IGN_HOME_DIR=${CONDA_PREFIX}/etc/ignition (or similar) so that there is a default behavior well defined
  3. If a user wants to roll back to the default behavior sharing the folder among conda envs, they can export after the env creation with conda env the variable IGN_HOME_DIR=$HOME

@traversaro
Copy link
Contributor Author

I opened conda-forge/conda-forge.github.io#1539 to collect feedback from conda-forge. Given that apparently conda environments can also be shared across users (see conda/conda#1329) and $CONDA_PREFIX is kind of replicating a normal FHS structure, I wonder if IGN_HOME_DIR in conda context should simply point to $CONDA_PREFIX/home/$USER

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

2 participants