Amichai Rothman created CASSANDRA-5340:
------------------------------------------

             Summary: use getopts instead of getopt in shell script
                 Key: CASSANDRA-5340
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5340
             Project: Cassandra
          Issue Type: Bug
    Affects Versions: 1.2.2
         Environment: Windows XP msysgit GNU bash 3.1.0
            Reporter: Amichai Rothman
            Priority: Minor


I don't know what the officially supported platforms are or what versions of sh 
they support... however I do know that the cassandra startup script fails on at 
least one platform (Windows XP/msysgit) since it uses the external utility 
getopt which is not available there. Using the shell built-in getopts command 
instead, or parsing the command line manually, would fix the problem.

I'm no shell expert, but a little searching came up with the fact that the 
getopt utility is not required by POSIX (which a script comment claims needs to 
be adhered to) whereas getopts is standard and more portable. Some claim getopt 
is better when long option names need to be supported, however cassandra 
doesn't use those anyway.

Unless someone knows of a supported platform that doesn't support getopts, the 
script should be changed to use it instead of getopt. If such a platform 
exists, perhaps using neither (manually parsing args) should be considered - 
it's not too much work, and there are plenty of existing templates for doing 
this to build on, and that would provide the best portability across platforms.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to