Avoid CQLSH throwing an exception loading .cqlshrc on non-supported platforms

While we do not support Windows as such (at least on server), reviewers evaluated that this might be fixed
as the gains (Windows users using CQLSH to connect to Cassandra running on supported platforms) are justified.

patch by Brad Schoening; reviewed by Brandon Williams, Josh McKenzie for CASSANDRA-20478
This commit is contained in:
Brad Schoening 2025-04-09 17:28:14 -04:00 committed by Stefan Miklosovic
parent ac05c94e6a
commit 49c8122d8f
No known key found for this signature in database
GPG Key ID: 32F35CB2F546D93E
2 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,5 @@
5.0.5
* Avoid CQLSH throwing an exception loading .cqlshrc on non-supported platforms (CASSANDRA-20478)
* Relax validation of snapshot name as a part of SSTable files path validation (CASSANDRA-20649)
* Optimize initial skipping logic for SAI queries on large partitions (CASSANDRA-20191)
* Fix reading mmapped trie-index exceeding 2GiB (CASSANDRA-20351)

View File

@ -117,12 +117,15 @@ def trim_if_present(s, prefix):
def is_file_secure(filename):
try:
st = os.stat(filename)
uid = os.getuid()
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()
except AttributeError as e:
# not-Unix os
return True
# Skip enforcing the file owner and UID matching for the root user (uid == 0).
# This is to allow "sudo cqlsh" to work with user owned credentials file.