Bug #2420
Fix MANPATH on Mac OS X
Status: | Closed | Start date: | 03/26/2018 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 1.6.0 | |||
Duration: |
Description
Akira reported the following issue:
Hello Jürgen,
It looks that the MANPATH configuration in $CTOOLS/bin/ctools-setup and $GAMMALIB/bin/gammalib-setup ignore the default man search paths by overriding an empty MANPATH in my environment (macOS 10.13.3, zsh). I have not tested, but I think this issue does not happen on Linux machines.
#- Set MANPATH
- ==============
if [ “x$MANPATH” = x ]; then
manpath=${manpath:-}
MANPATH="$man_dir:${manpath}”
else
MANPATH=`echo ":$MANPATH:” | \
sed “s%:$man_dir:%:%g” | sed “s%::*$%%”`
MANPATH="$man_dir$MANPATH”
fi
According to “man man” when MANPATH is unset the search paths are taken from /private/etc/man.conf but if ctools or gammalibs sets their search path to MANPATH, the system default paths are not searched by the man command.
You can get the default MANPATH, which is actually empty first, by calling the manpath command. You can add your own man paths to it.
You can find an example from the ROOT configuration script.
if [ -z "${MANPATH}” ]; then
# Grab the default man path before setting the path to avoid duplicates
if `which manpath > /dev/null 2>&1` ; then
default_manpath=`manpath`
else
default_manpath=`man -w 2> /dev/null`
fi
fi
if [ -z "${MANPATH}” ]; then
MANPATH=$ROOTSYS/man:${default_manpath}; export MANPATH
else
MANPATH=$ROOTSYS/man:$MANPATH; export MANPATH
fi
Regards,
Recurrence
No recurrence.
Related issues
History
#1 Updated by Knödlseder Jürgen over 6 years ago
- Status changed from New to Pull request
- % Done changed from 0 to 100
I modified the initialisation scripts according to the suggestion.
#2 Updated by Knödlseder Jürgen over 6 years ago
- Status changed from Pull request to Closed
Merged into bugfix-1.5.1
and devel
.
#3 Updated by Okumura Akira over 6 years ago
It also removes my own LD_LIBRARY_PATH setting.
Here is a snippet of my ~/.zshrc
.
echo "LD_LIBRARY_PATH (before)" echo $LD_LIBRARY_PATH # GammaLib and ctools # http://cta.irap.omp.eu/ctools/users/tutorials/1dc/getting_tools.html export GAMMALIB=/usr/local/gamma source $GAMMALIB/bin/gammalib-init.sh export CTOOLS=/usr/local/gamma source $CTOOLS/bin/ctools-init.sh export DIR1DC=$HOME/CTA_AGIS/1DC export CTADATA=$DIR1DC/1dc export CALDB=$CTADATA/caldb echo "LD_LIBRARY_PATH (after)" echo $LD_LIBRARY_PATH
and its output.
LD_LIBRARY_PATH (before) /Users/oxon/Documents/workspace/RootAstroLib:/usr/local/root/lib:/Users/oxon/CTA_AGIS/GCT-SoftwareWorkshop/TargetCalib/install/lib:/Users/oxon/CTA_AGIS/GCT-SoftwareWorkshop/TargetDriver/install/lib:/Users/oxon/CTA_AGIS/GCT-SoftwareWorkshop/TargetIO/install/lib:/usr/local/heasoft-6.20/x86_64-apple-darwin15.6.0/lib LD_LIBRARY_PATH (after) /usr/local/gamma/lib
#4 Updated by Knödlseder Jürgen over 6 years ago
- Status changed from Closed to In Progress
- Target version changed from 1.5.1 to 1.6.0
Re-opened due to problem reported by Akira.
#5 Updated by Knödlseder Jürgen over 6 years ago
Okumura Akira wrote:
It also removes my own LD_LIBRARY_PATH setting.
Here is a snippet of my
~/.zshrc
.
[...]and its output.
[...]
Do you have this problem on Mac OS X? I’m asking since on Mac OS X it should use DYLD_LIBRARY_PATH
instead.
#6 Updated by Okumura Akira over 6 years ago
Yes, macOS 10.13.4.
$ man dlopen ... dlopen() searches the following until it finds a compatible Mach-O file: $LD_LIBRARY_PATH, $DYLD_LIBRARY_PATH, current working directory, $DYLD_FALL- BACK_LIBRARY_PATH.
#7 Updated by Knödlseder Jürgen over 6 years ago
It looks like the first line in the setup script poses problems on Mac OS X:
#! /bin/shDue to security reasons Mac OS X unsets the
DYLD_LIBRARY_PATH
environment variable under sh
, hence the script thinks that nothing was set before, and consequently drops the older setting.
I removed the first line and things seem to work now.
#8 Updated by Okumura Akira over 6 years ago
Ah, thanks SIP! I read the script before submitting the issue, but could not find why XX_LIBRARY_PATH were dropped. I almost forgot about this Sierra and High Sierra limitation.
#9 Updated by Okumura Akira over 6 years ago
BTW, I do not find a strong reason to use DYLD as long as library file names are given.
https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html
It’s been my understanding in the last ~15 years.
#10 Updated by Knödlseder Jürgen over 6 years ago
- Status changed from In Progress to Closed
Correction merged into devel
.
#11 Updated by Specovius Andreas about 6 years ago
- Related to Bug #2724: Error in csh when sourcing gammalib-init.csh and ctools-init.csh added