Repository navigation
[python] Handle platforms without getuid in ticket-cache lookup - #10827
Merged
JingsongLi merged 1 commit intoOct 27, 2026
Merged
Conversation
Contributor
|
+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
When
KRB5CCNAMEis unset,get_ticket_cache_path()callsos.getuid()to construct the Unix default cache path. On platforms without that function, including Windows, HDFS initialization can fail withAttributeErroreven when no Kerberos credentials are configured.Return
Nonewhenos.getuidis unavailable, after checking the explicit cache setting. This lets callers handle an unavailable cache through their existing branches. Keep explicit cache precedence,FILE:prefix handling, the Unix file-existence check, and error propagation from an availablegetuid. Keytab login without a discoverable cache still raisesRuntimeError.Add five regression tests and make the existing Unix-path mock work on platforms without
getuid. No public API, configuration, data format or dependency changes are required. This is a platform availability fix; it does not add Kerberos cache types or certify HDFS authentication on Windows. No feature documentation changes are needed.The existing Kerberos implementation and tests came from ChengHui Chen's #7716, merged as
81bc068. The shared helper and native backend came from chaoyang's #8031, merged asb839753. This change adds the availability guard and portability tests on top of that merged code.Tests
The same 35 cases were run before and after the production fix against
3f5e9fcf62548a9f5bd110d4729e091b705a19b4:There were no skipped tests or introduced failures. The two Linux failures without the guard simulate an unavailable
getuid; the other 33 cases continue to pass. All environments use the same test IDs and unchanged source inputs. Frompaimon-python, the selection is:Changed-file flake8, the project license-header check and Python 3.6 grammar checks passed. An additional probe using the real Windows
osmodule covered cache lookup, the publicFileIO.getentry and both backend wrappers' missing-cache errors after keytab login.HDFS clients and
kinitare mocked in these tests; local file operations use real temporary files. Native backend coverage is limited to the Python wrapper. Real KDC/HDFS authentication, HDFS cluster read/write and full upstream CI have not been run for this candidate; the available HDFS endpoint was unreachable.