Skip to content

AMBARI-26622 Fix missing mode in sudo.makedir when Ambari is running as root - #4163

Merged
JiaLiangC merged 1 commit into
apache:trunkfrom
JeffreySmith:AMBARI-26622
Aug 10, 2026
Merged

AMBARI-26622 Fix missing mode in sudo.makedir when Ambari is running as root#4163
JiaLiangC merged 1 commit into
apache:trunkfrom
JeffreySmith:AMBARI-26622

Conversation

@JeffreySmith

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This fixes an inconsistent behaviour between the root and non-root branches of makedir in sudo.py.

In the root path, the mode option is silently dropped, while it is respected in the non-root path. Since mode is not passed, it will default to 0o777, which is unexpected behaviour when passing some other mode to the function.

This is the non-root path:

def makedir(path, mode):
    shell.checked_call(["mkdir", path], sudo=True)
    chmod(path, mode)

In this path, mode is honoured and set as expected.

How was this patch tested?

No testing was performed - this just adds the mode parameter to os.mkdir that was previously silently ignored, but still required.

@JiaLiangC
JiaLiangC merged commit 772caed into apache:trunk Aug 10, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants