[jira] [Commented] (CASSANDRA-1443) shell scripts are not posix compliant

2019-01-24 Thread Murukesh Mohanan (JIRA)


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

Murukesh Mohanan commented on CASSANDRA-1443:
-

The syntax itself seems to be POSIX-compliant, but at least one tool used 
isn't: {{which}}. {{which}} isn't POSIX; the POSIX way to look up the path of a 
command seems to be {{command -v}} (see [this comprehensive post on Unix & 
Linux|https://unix.stackexchange.com/a/85250/70524] for details).

Most uses of {{which}} were eliminated by [this patch for making C8 work with 
Java 8 and 
11|https://github.com/apache/cassandra/commit/6ba2fb9395226491872b41312d978a169f36fcdb];
 there are still a few left:

{code}
$ grep 'which.*>' bin tools/bin/ -R
bin/cqlsh.py:which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" 
"$@"
bin/cassandra:if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS 
ls / >/dev/null 2>/dev/null
bin/cassandra:which ldconfig > /dev/null 2>&1
bin/cqlsh:which python$pyver > /dev/null 2>&1 && exec python$pyver 
"`python$pyver -c "import 
os;print(os.path.dirname(os.path.realpath('$0')))"`/cqlsh.py" "$@"
{code}

It might be worthwhile to eliminate those as well.

---

Before that patch, many C* utilities used this check:

{code}
# Use JAVA_HOME if set, otherwise look for java in PATH
if [ -x "$JAVA_HOME/bin/java" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA="`which java`"
fi
{code}

I noticed this when checking out ScyllaDB; their Docker images don't include 
{{which}} and use an older version of various C* tools. Their solution was to 
create a {{/bin/java}} symlink since the first check will then succeed (with 
{{JAVA_HOME}} unset, that becomes {{/bin/java}}).

> shell scripts are not posix compliant
> -
>
> Key: CASSANDRA-1443
> URL: https://issues.apache.org/jira/browse/CASSANDRA-1443
> Project: Cassandra
>  Issue Type: Bug
>Affects Versions: 0.6
>Reporter: Brandon Williams
>Assignee: Brandon Williams
>Priority: Minor
> Fix For: 0.6.6
>
> Attachments: 1443.txt
>
>
> Our shells scripts currently require bash, but invoke /bin/sh which may or 
> may not be bash.  Instead, we should make these scripts POSIX compliant so 
> they work under any shell.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] Commented: (CASSANDRA-1443) shell scripts are not posix compliant

2010-09-16 Thread Peter Schuller (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-1443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12910033#action_12910033
 ] 

Peter Schuller commented on CASSANDRA-1443:
---

Sorry - no, nothing to add. 1507/1508 was the ones I knew of off hand. Should I 
discover anything else I'll submit more.

(Though on the /bin/bash issue of this ticket I'd preemptively suggest using 
/usr/bin/env bash, since bash is often not /bin/bash on many BSD:s.)

 shell scripts are not posix compliant
 -

 Key: CASSANDRA-1443
 URL: https://issues.apache.org/jira/browse/CASSANDRA-1443
 Project: Cassandra
  Issue Type: Bug
Affects Versions: 0.6
Reporter: Brandon Williams
Assignee: Brandon Williams
Priority: Minor
 Fix For: 0.6.6

 Attachments: 1443.txt


 Our shells scripts currently require bash, but invoke /bin/sh which may or 
 may not be bash.  Instead, we should make these scripts POSIX compliant so 
 they work under any shell.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (CASSANDRA-1443) shell scripts are not posix compliant

2010-09-15 Thread Peter Schuller (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-1443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12909829#action_12909829
 ] 

Peter Schuller commented on CASSANDRA-1443:
---

There are also a couple of Linux specific things in there. Since I'm on FreeBSD 
I hit them. Would you be open to patches that try to work around that, or is 
that beyond reasonable portability goals?


 shell scripts are not posix compliant
 -

 Key: CASSANDRA-1443
 URL: https://issues.apache.org/jira/browse/CASSANDRA-1443
 Project: Cassandra
  Issue Type: Bug
Affects Versions: 0.6
Reporter: Brandon Williams
Assignee: Brandon Williams
Priority: Minor
 Fix For: 0.6.6

 Attachments: 1443.txt


 Our shells scripts currently require bash, but invoke /bin/sh which may or 
 may not be bash.  Instead, we should make these scripts POSIX compliant so 
 they work under any shell.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (CASSANDRA-1443) shell scripts are not posix compliant

2010-09-15 Thread Brandon Williams (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-1443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12909831#action_12909831
 ] 

Brandon Williams commented on CASSANDRA-1443:
-

I would gladly accept patches for that.  I wasn't aware we had any linuxisms in 
there.

 shell scripts are not posix compliant
 -

 Key: CASSANDRA-1443
 URL: https://issues.apache.org/jira/browse/CASSANDRA-1443
 Project: Cassandra
  Issue Type: Bug
Affects Versions: 0.6
Reporter: Brandon Williams
Assignee: Brandon Williams
Priority: Minor
 Fix For: 0.6.6

 Attachments: 1443.txt


 Our shells scripts currently require bash, but invoke /bin/sh which may or 
 may not be bash.  Instead, we should make these scripts POSIX compliant so 
 they work under any shell.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.