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

Brad Schoening commented on CASSANDRA-20478:
--------------------------------------------

[Brandon 
Williams|https://issues.apache.org/jira/secure/ViewProfile.jspa?name=brandon.williams]
 [Josh 
McKenzie|https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jmckenzie] 
[~johnny15676] I reviewed the history here, and yes, it seems the intent to 
drop Windows support included CQLSH. The lack of a CI environment for CQLSH 
with Windows was a important part of that discussion.

As a practical matter, CQLSH works great on Windows.  We have hundreds of users 
running CQLSH on Windows and [AxonOps 
Workbench|https://github.com/axonops/axonops-workbench] includes a binary CQLSH 
for Windows.

This small issue can be fixed in a platform agnostic way by just including 
os.getuid() within the exception handler block:
{quote}def is_file_secure(filename):
    try:
        st = os.stat(filename)
    except OSError as e:
        if e.errno != errno.ENOENT:
            raise
        # the file doesn't exist, the security of it is irrelevant
        return True
    uid = os.getuid()     {color:#4c9aff}<--- add to try-except block{color}
{quote}
Adding official Windows support for CQLSH would require a CI environment. I've 
got some thoughts on that, but that's a much bigger issue.  Any objections to 
resolving this so it doesn't break on Windows but in a platform agnostic way?

I created a provisional PR with a two-line change:

https://github.com/apache/cassandra/pull/4076

> CQLSH throws an exception loading .cqlshrc on Windows
> -----------------------------------------------------
>
>                 Key: CASSANDRA-20478
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20478
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: Brad Schoening
>            Priority: Low
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {quote}  File 
> "C:\JPMC\DEV\TMP\ds\tools\python3.11\latest\Lib\site-packages\cqlshlib\util.py",
>  line 125, in is_file_secure
>     uid = os.getuid()
>           ^^^^^^^^^
> AttributeError: module 'os' has no attribute 'getuid'. Did you mean: 'getpid'?
> {quote}
> The utility function is_file_secure() calls the function os.getuid() which is 
> only implemented on Unix/Linux.  See 
> [https://docs.python.org/3/library/os.html#os.getuid].
> This can be reproduced by:
>  * First, create an empty file on Windows 'foo'
> {quote}python
> >>> from cqlshlib.util import is_file_secure
> >>> is_file_secure('foo')
> {quote}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to