jvm-profiling-tools / perf-map-agent

A java agent to generate method mappings to use with the linux `perf` tool
GNU General Public License v2.0
1.64k stars 260 forks source link

MacOS problem with bin/create-links-in #58

Open mslinn opened 6 years ago

mslinn commented 6 years ago

My old version of MacOS does not support the readlink -f option. I do not know if newer versions of MacOS support this option.

$ bash -xv bin/create-links-in /usr/local/bin
#!/bin/sh
set -e
+ set -e
#set -x

TARGET_DIR=$1
+ TARGET_DIR=/usr/local/bin
BIN_DIR=`dirname $0`
dirname $0
++ dirname bin/create-links-in
+ BIN_DIR=bin

if [ -z "$TARGET_DIR" ]; then
  echo "Please specify a target directory."
  exit
fi
+ '[' -z /usr/local/bin ']'

ln -s $(readlink -f $BIN_DIR/perf-java-top) $TARGET_DIR
readlink -f $BIN_DIR/perf-java-top
++ readlink -f bin/perf-java-top
readlink: illegal option -- f
usage: readlink [-n] [file ...]
+ ln -s /usr/local/bin
ln: ./bin: File exists
knalli commented 6 years ago

I've been faced with this also just at the same time ;)

First: No idea which version you are using exactly, but the current version of macOS (10.12) includes a readlink which also cannot handle -f. So not only issue for older systems, so far.

Second: Although the pr #59 would fix this here, there are several other places which are using readlink -f (https://github.com/jvm-profiling-tools/perf-map-agent/search?utf8=%E2%9C%93&q=readlink+-f&type=)

mslinn commented 6 years ago

If the fix works for everyone, great, I hope my PR gets adopted. I expect my approach could be used to fix all the other readlink problems you have encountered. I'm not going to take that on, however.