cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Shuler (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-13211) cassandra shell script uses bad approach to write "Unable to find java" error to stderr, causing real issue to be masked by a permission error if user has changed user since logging in
Date Mon, 13 Feb 2017 18:36:41 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-13211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15864167#comment-15864167
] 

Michael Shuler edited comment on CASSANDRA-13211 at 2/13/17 6:36 PM:
---------------------------------------------------------------------

I think this change to {{echo ... >&2}} would be fine and accomplishes the same. (When
I move my /usr/bin/java out of the way, I get trapped earlier in the version check in cassandra-env.sh,
since no java can be found)


was (Author: mshuler):
I think this change to {{ echo ... >&2}} would be fine and accomplishes the same. (When
I move my /usr/bin/java out of the way, I get trapped earlier in the version check in cassandra-env.sh,
since no java can be found)

> cassandra shell script uses bad approach to write "Unable to find java" error to stderr,
causing real issue to be masked by a permission error if user has changed user since logging
in
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-13211
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13211
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Max Bowsher
>
> The cassandra startup shell script contains this line:
>     echo Unable to find java executable. Check JAVA_HOME and PATH environment variables.
> /dev/stderr
> The problem here is the construct "> /dev/stderr". If the user invoking Cassandra
has changed user (for example, by SSHing in as a personal user, and then sudo-ing to an application
user responsible for executing the Cassandra daemon), then the attempt to open /dev/stderr
will fail, because it will point to a PTY node under /dev/pts/ owned by the original user.
> Ultimately this leads to the real problem being masked by the confusing error message
"bash: /dev/stderr: Permission denied".
> The correct technique is to replace "> /dev/stderr" with ">&2" which will write
to the already open stderr file descriptor, instead of resolving the chain of symlinks starting
at /dev/stderr, and attempting to reopen the target by name.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message