Problem running command from symbolic link
I have a strange problem with running a command from a symbolic link. The command is installed like this:
# ls -alZ /opt/elasticsearch-curator/
drwxr-xr-x. root root system_u:object_r:usr_t:s0 .
drwxr-xr-x. root root system_u:object_r:usr_t:s0 ..
-rw-rw-r--. root root system_u:object_r:usr_t:s0 cacert.pem
-rwxrwxr-x. root root system_u:object_r:usr_t:s0 curator
-rwxrwxr-x. root root system_u:object_r:usr_t:s0 curator_cli
-rwxrwxr-x. root root system_u:object_r:usr_t:s0 es_repo_mgr
drwxr-xr-x. root root system_u:object_r:lib_t:s0 lib
Running the commands in that directory directly works fine:
# /opt/elasticsearch-curator/curator
Usage: curator [OPTIONS] ACTION_FILE
[...]
# /opt/elasticsearch-curator/curator_cli
Usage: curator_cli [OPTIONS] COMMAND [ARGS]...
[...]
However running from a symbolic link, one of the commands fails:
# ln -s /opt/elasticsearch-curator/curator /tmp/curator
# /tmp/curator
Fatal error: unable to stat executable
# ln -s /opt/elasticsearch-curator/curator_cli /tmp/curator_cli
# /tmp/curator_cli
Usage: curator_cli [OPTIONS] COMMAND [ARGS]...
[...]
Traces:
lstat("/tmp/curator", {st_mode=S_IFLNK|0777, st_size=34, ...}) = 0
readlink("/tmp/curator", "/opt/elasticsearch-curator/curator", 4097) = 34
lstat("/opt/elasticsearch-curator/curator\341\352\244\177", 0x7ffcac929ee0) = -1 ENOENT (No such file or directory)
lstat("/tmp/curator_cli", {st_mode=S_IFLNK|0777, st_size=38, ...}) = 0
readlink("/tmp/curator_cli", "/opt/elasticsearch-curator/curator_cli", 4097) = 38
lstat("/opt/elasticsearch-curator/curator_cli", {st_mode=S_IFREG|0775, st_size=2633352, ...}) = 0
4 bytes (which seems random every time) are added to the filename in the lstat call on the binary which fails. Do anyone have an explanation on what is happening here?
Red Hat Enterprise Linux Server release 6.9 (Santiago)
Linux xxx 2.6.32-696.6.3.el6.x86_64 #1 SMP Fri Jun 30 13:24:18 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
glibc-2.12-1.209.el6_9.2.x86_64