Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion samza-shell/src/main/bash/run-class.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ CLASSPATH=""
# all the jars need to be appended on newlines to ensure line argument length of 72 bytes is not violated
for file in $BASE_LIB_DIR/*.[jw]ar;
do
CLASSPATH=$CLASSPATH" $file \n"
# Symlinks need to be resolved here, otherwise, the jars listed in the
# manifest below will point at the first container launched instead of
# the jars at the application level.
resolved_file=$( cd $(dirname $(readlink `[[ $OSTYPE == linux* ]] && echo "-f"` "$file")) ; pwd -P)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-f options also works on Mac, why linux only?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

man readlink on linux:

READLINK(1)                                                                                                User Commands                                                                                                READLINK(1)

NAME
       readlink - print resolved symbolic links or canonical file names

SYNOPSIS
       readlink [OPTION]... FILE...

DESCRIPTION
       Print value of a symbolic link or canonical file name

       -f, --canonicalize
              canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist

man readlink on OS X:

STAT(1)                                                                                                 General Commands Manual                                                                                                 STAT(1)

NAME
     stat, readlink – display file status

SYNOPSIS
     stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
     readlink [-fn] [file ...]

DESCRIPTION
     The stat utility displays information about the file pointed to by file.  Read, write, or execute permissions of the named file are not required, but all directories listed in the pathname leading to the file must be
     searchable.  If no argument is given, stat displays information about the file descriptor for standard input.

     When invoked as readlink, only the target of the symbolic link is printed.  If the given argument is not a symbolic link and the -f option is not specified, readlink will print nothing and exit with an error.  If the -f option
     is specified, the output is canonicalized by following every symlink in every component of the given path recursively.  readlink will resolve both absolute and relative paths, and return the absolute pathname corresponding to
     file.  In this case, the argument does not need to be a symbolic link.

     The information displayed is obtained by calling lstat(2) with the given argument and evaluating the returned structure.  The default format displays the st_dev, st_ino, st_mode, st_nlink, st_uid, st_gid, st_rdev, st_size,
     st_atime, st_mtime, st_ctime, st_birthtime, st_blksize, st_blocks, and st_flags fields, in that order.

     The options are as follows:

     -F      As in ls(1), display a slash (‘/’) immediately after each pathname that is a directory, an asterisk (‘*’) after each that is executable, an at sign (‘@’) after each symbolic link, a percent sign (‘%’) after each
             whiteout, an equal sign (‘=’) after each socket, and a vertical bar (‘|’) after each that is a FIFO.  The use of -F implies -l.

     -L      Use stat(2) instead of lstat(2).  The information reported by stat will refer to the target of file, if file is a symbolic link, and not to file itself.  If the link is broken or the target does not exist, fall back on
             lstat(2) and report information about the link.

     -f format
             Display information using the specified format.  See the Formats section for a description of valid formats.

So readlink exists on both, but the meaning of -f is different.

CLASSPATH=$CLASSPATH" $resolved_file \n"
done
echo generated from BASE_LIB_DIR CLASSPATH=$CLASSPATH

Expand Down