| Summary: | starttde: /usr/local/share is ignored in XDG_DATA_DIRS | ||
|---|---|---|---|
| Product: | TDE | Reporter: | Darrell <darrella> |
| Component: | tdebase | Assignee: | Michele Calgaro <michele.calgaro> |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | bugwatch, darrella, michele.calgaro, slavek.banko |
| Priority: | P5 | ||
| Version: | R14.0.0 [Trinity] | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Compiler Version: | TDE Version String: | ||
| Application Version: | Application Name: | ||
| Bug Depends on: | |||
| Bug Blocks: | 2014 | ||
| Attachments: | Patch to add /usr/local/share to XDG_DATA_DIRS in starttde | ||
Added to v14.0.0 bug list. The patch needs a slight rework, nothing major though. Slightly reworked and pushed in commit 4eac9af. Thanks! (In reply to Michele Calgaro from comment #2) > Slightly reworked and pushed in commit 4eac9af. Thanks! It is a good idea remove paths /usr/share and /usr/local/share and re-add it? This cancels the order that could be consciously set by the user. Would not it be better to test the existence and supplement as needed? For example: # If '/usr/share' is not already here, we include it at the last position. if ! is_in_path XDG_DATA_DIRS "/usr/share"; then XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share fi if ! is_in_path XDG_DATA_DIRS "/usr/local/share"; then place_before_in_path XDG_DATA_DIRS "/usr/local/share" "/usr/share" fi # Ensure that $TDEDIR/share is always before '/usr/local/share'. remove_from_path XDG_DATA_DIRS $TDEDIR/share place_before_in_path XDG_DATA_DIRS "$TDEDIR/share" "/usr/local/share" > It is a good idea remove paths /usr/share and /usr/local/share and re-add it? > This cancels the order that could be consciously set by the user. Would not it > be better to test the existence and supplement as needed?
Good point Slavek. Anyhow even placing "$TDEDIR/share" in front of "/usr/local/share" may introduce problems in case a user has consciously set the order in XDG_DATA_DIRS. For example if the user set:
XDG_DATA_DIRS=/usr/share:/usr/local/share
then "$TDEDIR/share" would end up between /usr/share and /usr/local/share
A possible solution may be to place $TDEDIR/share always in front of everything, as follow:
# If '/usr/share' is not already here, we include it at the last position.
if ! is_in_path XDG_DATA_DIRS "/usr/share"; then
XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share
fi
if ! is_in_path XDG_DATA_DIRS "/usr/local/share"; then
place_before_in_path XDG_DATA_DIRS "/usr/local/share" "/usr/share"
fi
# Ensure that $TDEDIR/share is always before '/usr/local/share' and '/usr/share'.
remove_from_path XDG_DATA_DIRS $TDEDIR/share
XDG_DATA_DIRS=$TDEDIR/share:$XDG_DATA_DIRS
If it is ok, I will push tomorrow.
The root problem to this mess is reported in bug 1934 --- the simple fact that Trinity is forced to live in like a black sheep /opt rather than /usr. If Trinity lived in /usr then zero adjustments would be needed to support the environment variables. Regarding placement, because Trinity lives in /opt, and is not a standard desktop on any distro, users who install Trinity want to use Trinity. Trinity is always installed ex post facto in all distros. To presume such users prefer some funky order to XDG_DATA_DIRS is a fringe case presumption not worth supporting. If /opt/trinity/share is not placed before /usr/local/share and /usr/share then Trinity will fail to function, as inferred in bug 1934. The focus of this bug report is /usr/local/share was being ignored completely in the Trinity configurations. That bug needs to be fixed. :) I tried to remember if we ever recorded a problem when Trinity folders are always first in the XDG. But no such reports I can remember. Indeed, a few lines below are TDEDIRS included just by this way - always at the beginning. So I guess it's OK also for $TDEDIR/share. This morning with fresh mind I immediately thought at a better solution, which does not require to put $TDEDIR/share at the front of XDG_DATA_DIRS. I have implemented a solution that uses associative arrays, but it may not work in shells different from bash. I have already worked out another way to do it, which would work in sh as well, but won't be able to do it today. The idea is simple: we check which one of '/usr/local/share' and '/usr/share' comes first and then we place $TDEDIR/share before such folder. I should have enough time tomorrow to do that. New version pushed in commit c75218c. This places $TDEDIR/share before '/usr/local/share' and '/usr/share' (whatever comes first) and avoids the problem highlighted by Slavek in comment 3 I made one more improvement in commit 5bf2f627. The variable is affected only if it does not contain $TDEDIR/share or is placed differently than is necessary. > I made one more improvement in commit 5bf2f627
It's a good one. Thanks!
|
Created attachment 2079 [details] Patch to add /usr/local/share to XDG_DATA_DIRS in starttde In other desktops, which all normally install to /usr, /usr/local/share is standard in the XDG_DATA_DIRS search path. As Trinity typically is installed in /opt, a non-standard location, the Trinity starttde script provides a mechanism to configure XDG_DATA_DIRS when Trinity is not installed in /usr. The current method does not include /usr/local/share. A proposed patch is attached. I have tested only nominally. Further testing on other distros is requested. The patch, in whatever final form, should be added to the R14 release.