[ https://issues.apache.org/jira/browse/ZOOKEEPER-2377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15174732#comment-15174732 ]
Edward Ribeiro commented on ZOOKEEPER-2377: ------------------------------------------- Hey, [~rgs], thanks for inviting me to check. :) LGTM. One annoyance is that MacOS doesn't recognize the "-e" switch, so I had to remove it to make the patch to run on my box, as below: {code} - ZOOBIN=$(readlink -e "$ZOOBIN" 2>/dev/null) + ZOOBIN=$(readlink "$ZOOBIN" 2>/dev/null) {code} As far as I could grasp, the "-e" resolves all the symbolic links recursively until the target, but this option is not available on OSX, because it includes the BSD version of readlink while Linux includes the GNU version. Following this logic, this would make this patch fail on BSD-like systems too (that I don't have installed here, yet). The man pages are below: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/readlink.1.html http://linux.die.net/man/1/readlink [~sdh], IMO, we can either remove this switch (if it's safe to assume that ZK dir will be only one level deep into symlinks) or use the "-e" switch only on Linux systems. If you choose the latter then it would require to use some code snippet as below to identify the OS (or the use of "$OSTYPE" env variable) and maybe some "hack" as the link below (see the "rreadlink" function): {code} uname -a | awk '{print $1}' {code} https://sourceware.org/ml/crossgcc/2009-11/msg00108.html Raul, Siddhartha and Chris, wdyt? > zkServer.sh should resolve canonical path from symlinks > ------------------------------------------------------- > > Key: ZOOKEEPER-2377 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2377 > Project: ZooKeeper > Issue Type: Improvement > Components: scripts > Affects Versions: 3.4.8 > Environment: Centos 6 > Reporter: Siddhartha > Priority: Minor > Attachments: ZOOKEEPER-2377.patch > > > If zkServer.sh is started from a symlink, it is not able to correctly source > the other scripts because it looks in the wrong path. > Attached patch fixes this by first resolving absolute path to the script. -- This message was sent by Atlassian JIRA (v6.3.4#6332)