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

path.d and YARP_DATA_DIRS conflict #336

Open
traversaro opened this issue Dec 19, 2014 · 12 comments
Open

path.d and YARP_DATA_DIRS conflict #336

traversaro opened this issue Dec 19, 2014 · 12 comments

Comments

@traversaro
Copy link
Member

traversaro commented Dec 19, 2014

If two different projects are "Extending the search path", as defined in http://www.yarp.it/git-master/yarp_data_dirs.html , and one is extending it using the path.d method and the other one is using the YARP_DATA_DIRS method, only the path.d one is working.
More detail will follow.

@traversaro traversaro changed the title path.d and YARP_DATA_DIRS path.d and YARP_DATA_DIRS conflict Dec 19, 2014
@paulfitz
Copy link
Member

Interesting :-). Looking forward to the details.

@jgvictores
Copy link
Member

For me it's the other way around...

If I set YARP_DATA_DIRS for one project, YARP stops finding the resources for a different project that is installed (even if it is cited in /usr/local/share/yarp/config/path.d).

My objective is to mainly use YARP_DATA_DIRS, but once and a while install to see that the installation (for other people) is performed correctly. Right now, if there is a lagged behind YARP_DATA_DIRS corresponding to a different project, my installed data is not found when I install. (Workaround: removing YARP_DATA_DIRS for all projects while testing installation on any specific project).

@paulfitz
Copy link
Member

@jgvictores when YARP_DATA_DIRS is not set by the user, it defaults to $XDG_DATA_DIRS + /yarp/ which is where /usr/local/share/yarp/ in the default search path comes from. If you want to keep that path rather than override it, you can do something like:

export YARP_DATA_DIRS=/my/new/path:/usr/local/share/yarp

Then yarp will try /my/new/path first, and fall back on /usr/local/share/yarp. A good way to debug this is with yarp resource:

$ yarp resource --verbose 1 --find foo.ini
...
||| checking [/usr/local/share/yarp/config/path.d] (robot path.d YARP_DATA_DIRS)
...

$ YARP_DATA_DIRS='/my/new/path' yarp resource --verbose 1 --find foo.ini
...
... /usr/local/share... is gone
...

$ YARP_DATA_DIRS='/my/new/path:/usr/local/share/yarp' yarp resource --verbose 1 --find foo.ini
...
||| checking [/usr/local/share/yarp/config/path.d] (robot path.d YARP_DATA_DIRS)
...

Does that help?

@paulfitz
Copy link
Member

the painful details http://wiki.icub.org/wiki/YARP_ResourceFinder

@paulfitz
Copy link
Member

btw very interested in hearing ways that the new config stuff breaks old workflows (and fixing that)

@jgvictores
Copy link
Member

export YARP_DATA_DIRS=/my/new/path:/usr/local/share/yarp

That is an elegant solution that works nicely. 👍

Not closing issue because it was started by @traversaro.

@lornat75
Copy link
Member

@jgvictores: given you are using these functionalities I would like to know if you find the "path.d" option useful. We added it to give users the possibility to extend YARP's search path in installed configurations, however I later thought it could be enough to give users the possibility to populate their own data files directly in the YARP installed tree (e.g. /usr/local/share/yarp).

@jgvictores
Copy link
Member

@lornat75: 1) I like extending YARP's search path in installed configurations. 2) Regarding installing an external package directly in YARP... personally, I prefer to keep YARP a bit cleaner.

  • In Linux, I find path.d very useful because, in its current state, it supports (1): since both YARP and the external package go to /usr/local/share/, /usr/local/share/yarp's path.d is nicely automatically set to point to the installed external package's resources.
  • In Windows, the current implementation forces (2). This is, either I force the external package resources to go in YARP's directory (since paths are a bit more ad-hoc, there's no /usr/local/share/ or XGD spec), or I will end up with no automatic setting of YARP's path.d to point to the installed external package's resources. While this could be solved by developing a separate windows installer that sets YARP_DATA_DIRS, in an ideal case, I would prefer something that automatically enables (1). What would your opinion be on enabling this, in terms of implementation and best practices?

@traversaro
Copy link
Member Author

More details. yarp and icub-main installed from sources and installed in their default installation directories.
iCub_SIM works fine if YARP_DATA_DIRS is not defined, see how it finds the Sim_joints.ini configuration file:

pegua@pareto:~$ yarp resource --context simConfig --find Sim_joints.ini
||| configuring
||| no policy found
||| added context simConfig
||| finding file [Sim_joints.ini]
||| checking [/home/pegua/Sim_joints.ini] (pwd)
||| checking [/home/pegua/.config/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_HOME)
||| checking [/home/pegua/.local/share/yarp/robots/icubGazeboSim] (robot YARP_DATA_HOME)
||| checking [/etc/xdg/xdg-xubuntu/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_DIRS)
||| checking [/usr/share/upstart/xdg/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_DIRS)
||| checking [/etc/xdg/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_DIRS)
||| checking [/usr/share/xubuntu/yarp/robots/icubGazeboSim] (robot YARP_DATA_DIRS)
||| checking [/usr/share/xfce4/yarp/robots/icubGazeboSim] (robot YARP_DATA_DIRS)
||| checking [/usr/local/share/yarp/robots/icubGazeboSim] (robot YARP_DATA_DIRS)
||| checking [/usr/share/yarp/robots/icubGazeboSim] (robot YARP_DATA_DIRS)
||| checking [/usr/share/xubuntu/yarp/config/path.d] (robot path.d YARP_DATA_DIRS)
||| checking [/usr/share/xfce4/yarp/config/path.d] (robot path.d YARP_DATA_DIRS)
||| checking [/usr/local/share/yarp/config/path.d] (robot path.d YARP_DATA_DIRS)
||| found /usr/local/share/yarp/config/path.d
||| checking [/usr/local/share/iCub/robots/icubGazeboSim] (robot yarp.d)
||| checking [/home/pegua/.config/yarp/contexts/simConfig] (context YARP_CONFIG_HOME)
||| checking [/home/pegua/.local/share/yarp/contexts/simConfig] (context YARP_DATA_HOME)
||| found /home/pegua/.local/share/yarp/contexts/simConfig
||| checking [/etc/xdg/xdg-xubuntu/yarp/contexts/simConfig] (context YARP_CONFIG_DIRS)
||| checking [/usr/share/upstart/xdg/yarp/contexts/simConfig] (context YARP_CONFIG_DIRS)
||| checking [/etc/xdg/yarp/contexts/simConfig] (context YARP_CONFIG_DIRS)
||| checking [/usr/share/xubuntu/yarp/contexts/simConfig] (context YARP_DATA_DIRS)
||| checking [/usr/share/xfce4/yarp/contexts/simConfig] (context YARP_DATA_DIRS)
||| checking [/usr/local/share/yarp/contexts/simConfig] (context YARP_DATA_DIRS)
||| checking [/usr/share/yarp/contexts/simConfig] (context YARP_DATA_DIRS)
||| checking [/usr/local/share/iCub/contexts/simConfig] (context yarp.d)
||| found /usr/local/share/iCub/contexts/simConfig
||| checking [/home/pegua/.local/share/yarp/contexts/simConfig/Sim_joints.ini] (context)
||| checking [/usr/local/share/iCub/contexts/simConfig/Sim_joints.ini] (context)
||| found /usr/local/share/iCub/contexts/simConfig/Sim_joints.ini
"/usr/local/share/iCub/contexts/simConfig/Sim_joints.ini"

As soon as the YARP_DATA_DIRS environmental variable is defined, Sim_joints.ini is not found anymore:

pegua@pareto:~$ YARP_DATA_DIRS="" yarp resource --context simConfig --find Sim_joints.ini
||| configuring
||| no policy found
||| added context simConfig
||| finding file [Sim_joints.ini]
||| checking [/home/pegua/Sim_joints.ini] (pwd)
||| checking [/home/pegua/.config/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_HOME)
||| checking [/home/pegua/.local/share/yarp/robots/icubGazeboSim] (robot YARP_DATA_HOME)
||| checking [/etc/xdg/xdg-xubuntu/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_DIRS)
||| checking [/usr/share/upstart/xdg/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_DIRS)
||| checking [/etc/xdg/yarp/robots/icubGazeboSim] (robot YARP_CONFIG_DIRS)
||| checking [/home/pegua/.config/yarp/contexts/simConfig] (context YARP_CONFIG_HOME)
||| checking [/home/pegua/.local/share/yarp/contexts/simConfig] (context YARP_DATA_HOME)
||| found /home/pegua/.local/share/yarp/contexts/simConfig
||| checking [/etc/xdg/xdg-xubuntu/yarp/contexts/simConfig] (context YARP_CONFIG_DIRS)
||| checking [/usr/share/upstart/xdg/yarp/contexts/simConfig] (context YARP_CONFIG_DIRS)
||| checking [/etc/xdg/yarp/contexts/simConfig] (context YARP_CONFIG_DIRS)
||| checking [/home/pegua/.local/share/yarp/contexts/simConfig/Sim_joints.ini] (context)
||| checking [/home/pegua/.config/yarp/Sim_joints.ini] (YARP_CONFIG_HOME)
||| checking [/home/pegua/.local/share/yarp/Sim_joints.ini] (YARP_DATA_HOME)
||| checking [/etc/xdg/xdg-xubuntu/yarp/Sim_joints.ini] (YARP_CONFIG_DIRS)
||| checking [/usr/share/upstart/xdg/yarp/Sim_joints.ini] (YARP_CONFIG_DIRS)
||| checking [/etc/xdg/yarp/Sim_joints.ini] (YARP_CONFIG_DIRS)
||| did not find Sim_joints.ini
""

@traversaro
Copy link
Member Author

The point is in the ResourceFinder::getDataDirs() method.

If YARP_DATA_DIRS is set, the default paths used for searching configuration file (including configuration files for extending the search path using the path.d directory!) are not considered at all.

This seems to be directly contradicting the documentation, in which YARP_DATA_DIRS is described as a method to extend the search path [1], not to redefine it.

There are then two possible solutions:

  • Fix the code to match the documentation
  • Fix the documentation to match the code

I would prefer the first solution (fixing the code) to reduce the complexity in documenting the installation process of downstream projects such as the codyco-superbuild. Otherwise It will be needed to explicitly explain in the installation instructions of downstream projects that YARP_DATA_DIRS should manually contain the default dirs used by yarp (that thus need to be documented), to avoid problems such as robotology/icub-main#262 .

cc @drdanz

[1] : http://www.yarp.it/yarp_data_dirs.html#datafiles_extendsearch

@lornat75
Copy link
Member

lornat75 commented Jan 5, 2016

If we decide to support path.d as a way to extend yarp's search path for resources maybe it makes sense for YARP_DATA_DIRS to redefine it.

However, I do not have strong opinions your observations look reasonable too.

@traversaro
Copy link
Member Author

@diegoferigo was recently affected by this.

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

4 participants