Skip to content

fix(tests): ignore inherited setgid when checking program-cache tmp mode - #3224

Open
mangeshraut712 wants to merge 2 commits into
NVIDIA:mainfrom
mangeshraut712:fix/program-cache-tmp-ignore-setgid
Open

mangeshraut712 wants to merge 2 commits into
NVIDIA:mainfrom
mangeshraut712:fix/program-cache-tmp-ignore-setgid

Conversation

@mangeshraut712

Copy link
Copy Markdown

Closes #3214.

Problem

test_program_cache_tmp_dir_created_owner_only compares stat.S_IMODE(...) to 0o700. On Linux, a setgid parent (TMPDIR mode 2770) makes mkdir(mode=0o700) inherit S_ISGID, so the observed mode is 0o2700 and the assertion fails even though access is still owner-only.

Change

Mask with & 0o777 before comparing in both places that assert tmp is owner-only. Setgid on a directory only affects the group of new entries; it does not grant access.

Test

mkdir -p /tmp/sg && chmod 2770 /tmp/sg
TMPDIR=/tmp/sg pytest cuda_core/tests/test_program_cache.py -k 'tmp_dir_created_owner_only or preexisting_shared_root'

A setgid TMPDIR parent makes Linux inherit S_ISGID onto mkdir(0o700)
tmp dirs. Compare only access bits so the owner-only check stays valid.
@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T13:47:39.640929Z 3ffeed0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 3ffeed0 and deb38c4.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a2fb804 and 3ffeed0.

Files selected for processing: 1
  • cuda_core/tests/test_program_cache.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Updated permission checks to focus on directory access permissions, avoiding unrelated mode bits affecting test results.

The permission tests now mask directory modes to access bits before checking for owner-only permissions. This prevents an inherited setgid bit from causing the assertions to fail.

Changes: Permission tests

Layer / File(s) Summary
Mask mode bits in permission assertions
cuda_core/tests/test_program_cache.py
The temporary-directory and shared-root checks mask directory modes with 0o777 before asserting owner-only access. The first test’s docstring notes that inherited setgid does not affect the check.

Assessment against linked issues

Objective Addressed Explanation
Check that the temporary directory is owner-only even when its parent has the setgid bit [#3214] ✅

Possibly related issues

Suggested labels: bug, test, cuda.core

Suggested reviewers: rparolin

Priority: Low

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · previous review 3ffee

This test-only change addresses the setgid-parent failure without altering production behavior.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: test_program_cache_tmp_dir_created_owner_only fails under a setgid parent directory

1 participant