You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksandr (Jira)" <ji...@apache.org> on 2022/11/23 12:42:00 UTC

[jira] [Created] (IGNITE-18238) Do not use readlink on start script

Aleksandr created IGNITE-18238:
----------------------------------

             Summary: Do not use readlink on start script
                 Key: IGNITE-18238
                 URL: https://issues.apache.org/jira/browse/IGNITE-18238
             Project: Ignite
          Issue Type: Bug
          Components: build
            Reporter: Aleksandr


Some mac users could see this message on ./bin/ignite3db start 

readlink: illegal option -- f
usage: readlink [-n] [file ...]

which leads to the wrong IGNITE_HOME set. The reason is that the readlink on mac does not have a flag -f, it differs from vanilla readlink implementation. 

I propose not to use readlink at all and do something like:


{code:java}
#!/bin/sh

TARGET_FILE=$1

cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`

# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
    TARGET_FILE=`readlink $TARGET_FILE`
    cd `dirname $TARGET_FILE`
    TARGET_FILE=`basename $TARGET_FILE`
done

# Compute the canonicalized name by finding the physical path 
# for the directory we're in and appending the target file.
PHYS_DIR=`pwd -P`
RESULT=$PHYS_DIR/$TARGET_FILE
echo $RESULT
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)