Repository navigation
Restore the executable bit on the formatter hook - #10519
Conversation
#10512 rewrote scripts/run_ruff_format.py and the file came back 100644, so pre-commit.ci fails every run, on main and on every open PR, with "Executable scripts/run_ruff_format.py is not executable" before the hook does anything. Mode only, no content change.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a27ae62d2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| assert ( | ||
| len(specs) == 1 | ||
| ), f"{extra} must resolve exactly one xformers wheel on Windows, got {specs}" |
There was a problem hiding this comment.
Restore executable mode on the formatter hook
This commit only reformats tests; its tree still records scripts/run_ruff_format.py as mode 100644, identical to the parent. Because .pre-commit-config.yaml invokes that path directly as the ruff-format-with-kwargs entry, Linux/pre-commit runs still fail with Permission denied before formatting, so the CI failure described by this commit remains unresolved. Include the intended 100644 => 100755 mode change.
Useful? React with 👍 / 👎.
… formatter hook's executable bit The spacing pass rewrites through a mkstemp temp file and os.replace, and mkstemp creates that file 0600, so every file the pass touches loses its mode. scripts/run_ruff_format.py is the pre-commit hook's own entry point and is processed by the hook it runs; #10512 gave it kwarg spacing, so from then on every run stripped its executable bit, pre-commit.ci committed the flip (7c48499 here, and main's own push check is red the same way), and the next run failed before doing anything with "not executable". The writer now carries the original mode onto the temp file before the replace, pinned by a test that rewrites a 0755 script and a 0644 file, and the hook's entry script goes back to 100755. (cherry picked from commit db7df60daa97fb6191776a6d489c229c3877888f)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0deba57538
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def test_an_executable_script_keeps_its_bit_through_the_rewrite(tmp_path): | ||
| target = _rewrite(tmp_path, 0o755) | ||
| assert stat.S_IMODE(target.stat().st_mode) == 0o755 |
There was a problem hiding this comment.
Skip POSIX mode assertions on Windows
When this new test module is run on Windows, both tests fail even if the rewrite is correct: Windows does not represent POSIX executable/group mode bits, and os.chmod cannot round-trip 0o755 or 0o644 through st_mode. Gate these mode-preservation assertions to POSIX platforms, or assert only the read-only flag that Windows supports.
Useful? React with 👍 / 👎.
Summary
pre-commit.ci is red on main and on every open PR with:
Two things combine to produce it, and this PR fixes both.
scripts/enforce_kwargs_spacing.pyrewrites every file it touches through amkstemptemp file andos.replace.mkstempcreates the temp file 0600, so the rewrite drops the original's mode, executable bit included.scripts/run_ruff_format.pyis the hook's own entry point and is itself processed by the hook. Make the formatter refuse a ruff it is not pinned to, and re-format the four files that drifted #10512 gave it kwarg spacing, so from then on every run rewrote it, stripped its executable bit, and pre-commit.ci committed the flip as an autofix. The next run then could not execute it.Change
scripts/run_ruff_format.pygoes back to 100755.Verification
run_ruff_format.pyat 0600 and git reports a mode change; after it the whole-tree run passes and the tree is unchanged.