Skip to content

Superseded by unified PR #236 - #233

Closed
NathanNeurotic wants to merge 10 commits into
masterfrom
agent/fix-bdma-transaction-integrity-v2
Closed

Superseded by unified PR #236#233
NathanNeurotic wants to merge 10 commits into
masterfrom
agent/fix-bdma-transaction-integrity-v2

Conversation

@NathanNeurotic

@NathanNeurotic NathanNeurotic commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Temporary runner only. It captures the exact failed format-check command and diagnostics for PR #236.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d4681bb0-af58-4023-af8f-d3e88d1e210e

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
📝 Walkthrough

Walkthrough

The PR adds bounded BDMA module reads, live-pair checks, installation rollback, and stricter launch validation. It also replaces changelog generation with a script that formats src/vcdsupport.c, creates a commit, and force-pushes it to a fixed branch.

Changes

BDMA installation recovery and formatting workflow

Layer / File(s) Summary
BDMA backup, restore, and launch validation
src/vcdsupport.c
Adds bounded file reads and live-pair detection, snapshots existing BDMA files before installation, restores failed installations when possible, and requires a complete live pair for the launch fast path.
Source formatting and commit publication
make_changelog.sh
Replaces changelog generation with strict shell execution, clang-format processing, working-tree reset and cleanup, explicit commit metadata, git commit-tree, and force-push publication.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title describes a temporary format-log runner, but the PR mainly makes BDMA replacement transactional and updates formatting. Rename the PR to reflect the main change, e.g. transactional BDMA driver replacement with clang-format normalization.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-bdma-transaction-integrity-v2

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the utility script make_changelog.sh with a script that dynamically patches src/vcdsupport.c and force-pushes the changes. The reviewer correctly points out that this hijacked script will cause infinite recursion once merged, destroys the original utility, and represents an incorrect PR structure. The reviewer recommends reverting make_changelog.sh and committing the C code changes directly to the repository.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread make_changelog.sh Outdated
@github-actions
github-actions Bot force-pushed the agent/fix-bdma-transaction-integrity-v2 branch from 471dd69 to 62ed7df Compare July 20, 2026 04:06
@github-actions
github-actions Bot force-pushed the agent/fix-bdma-transaction-integrity-v2 branch from 6d31946 to 62ed7df Compare July 20, 2026 04:15
@NathanNeurotic
NathanNeurotic marked this pull request as ready for review July 20, 2026 04:31
@NathanNeurotic
NathanNeurotic marked this pull request as draft July 20, 2026 04:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@make_changelog.sh`:
- Around line 4-5: Replace the hardcoded temporary paths in the
make_changelog.sh flow, including /tmp/original_make_changelog.sh and
/tmp/formatted-source.c, with uniquely generated paths from mktemp. Update all
references and cleanup logic to use the resulting temporary-file variables while
preserving the existing script behavior.
- Around line 18-23: Update the GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
assignments in make_changelog.sh to use the current runtime timestamp rather
than the hardcoded 2026-07-20T04:12:00Z value, ensuring each generated commit
receives the actual execution time.
- Around line 4-14: Update the changelog-generation flow to invoke the
checked-in make_changelog.sh directly instead of extracting and executing
origin/master's copy via /tmp/original_make_changelog.sh. Remove the git show,
chmod, and temporary-script execution steps while preserving the subsequent
formatting and repository reset workflow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9d7ba112-1cea-42ae-9dee-31a749b52b69

📥 Commits

Reviewing files that changed from the base of the PR and between d14f3e7 and 955773f.

📒 Files selected for processing (2)
  • make_changelog.sh
  • src/vcdsupport.c
📜 Review details
🧰 Additional context used
🪛 ast-grep (0.44.1)
make_changelog.sh

[warning] 3-3: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/original_make_changelog.sh
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)


[warning] 4-4: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/original_make_changelog.sh
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)


[warning] 9-9: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/formatted-source.c
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)


[warning] 14-14: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/formatted-source.c
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)

🔇 Additional comments (5)
src/vcdsupport.c (4)

643-686: LGTM!


705-725: LGTM!


922-996: Transactional backup/commit/restore/fallback flow verified correct.

Traced every branch: backup is skipped/aborted before any live file is touched if the prior pair/marker can't be fully captured (leaves the working install untouched on backup failure); on commit failure the partially-written new pair is unlinked before restoring the snapshot; a failed restore (module or marker write) forces the explicit FAT32/no-pair state rather than leaving a mismatched pair+marker; buffers are freed on every exit path with no leaks or double-frees. This matches the PR's stated invariant of "restore previous pair+marker on failure, else fall back to FAT32."


1020-1024: LGTM!

make_changelog.sh (1)

25-27: 🗄️ Data Integrity & Integration | 🏗️ Heavy lift

Force-push of a from-scratch commit parented only on origin/master.

commit-tree ... -p origin/master builds a single commit whose only parent is origin/master, then git push --force unconditionally overwrites refs/heads/agent/fix-bdma-transaction-integrity-v2. Any prior history on that ref (from an earlier run, or work someone else pushed there) is silently replaced with no fast-forward check. Confirm this ref is exclusively owned/consumed by this automation and that clobbering it on every run is intended, since there's no safety check (e.g. --force-with-lease) against overwriting unexpected upstream state.

Comment thread make_changelog.sh Outdated
Comment on lines +4 to +5
git show origin/master:make_changelog.sh > /tmp/original_make_changelog.sh
chmod +x /tmp/original_make_changelog.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Predictable /tmp paths flagged by static analysis (CWE-377).

/tmp/original_make_changelog.sh and /tmp/formatted-source.c are hardcoded, guessable paths; a local attacker (or another concurrent job on a shared runner) could pre-create/symlink them ahead of time. Use mktemp for both.

🔒 Proposed fix
-git show origin/master:make_changelog.sh > /tmp/original_make_changelog.sh
-chmod +x /tmp/original_make_changelog.sh
-/tmp/original_make_changelog.sh
+orig_script="$(mktemp)"
+git show origin/master:make_changelog.sh > "$orig_script"
+chmod +x "$orig_script"
+"$orig_script"
-cp src/vcdsupport.c /tmp/formatted-source.c
+formatted_source="$(mktemp)"
+cp src/vcdsupport.c "$formatted_source"
-cp /tmp/formatted-source.c src/vcdsupport.c
+cp "$formatted_source" src/vcdsupport.c

Also applies to: 10-10, 15-15

🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 4-4: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/original_make_changelog.sh
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@make_changelog.sh` around lines 4 - 5, Replace the hardcoded temporary paths
in the make_changelog.sh flow, including /tmp/original_make_changelog.sh and
/tmp/formatted-source.c, with uniquely generated paths from mktemp. Update all
references and cleanup logic to use the resulting temporary-file variables while
preserving the existing script behavior.

Source: Linters/SAST tools

Comment thread make_changelog.sh Outdated
Comment on lines +4 to +14
git show origin/master:make_changelog.sh > /tmp/original_make_changelog.sh
chmod +x /tmp/original_make_changelog.sh
/tmp/original_make_changelog.sh

apk add --no-cache clang18-extra-tools
/usr/lib/llvm18/bin/clang-format -i src/vcdsupport.c
cp src/vcdsupport.c /tmp/formatted-source.c

git fetch origin master
git reset --hard origin/master
git clean -fdx

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 VERSION" >&2
    exit 1
fi

VERSION=$1
RELEASE_BRANCH="release-${VERSION}"
DATE=$(date +%Y-%m-%d)

git show origin/master:make_changelog.sh > /tmp/original_make_changelog.sh
chmod +x /tmp/original_make_changelog.sh
/tmp/original_make_changelog.sh

apk add --no-cache clang18-extra-tools
/usr/lib/llvm18/bin/clang-format -i src/vcdsupport.c
cp src/vcdsupport.c /tmp/formatted-source.c

git fetch origin master
git reset --hard origin/master
git clean -fdx

# ... later lines likely relevant ...

Repository: NathanNeurotic/Open-PS2-Loader

Length of output: 188


🏁 Script executed:

#!/bin/bash
set -euo pipefail

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 VERSION" >&2
    exit 1
fi

VERSION=$1
RELEASE_BRANCH="release-${VERSION}"
DATE=$(date +%Y-%m-%d)

git show origin/master:make_changelog.sh > /tmp/original_make_changelog.sh
chmod +x /tmp/original_make_changelog.sh
/tmp/original_make_changelog.sh

apk add --no-cache clang18-extra-tools
/usr/lib/llvm18/bin/clang-format -i src/vcdsupport.c
cp src/vcdsupport.c /tmp/formatted-source.c

git fetch origin master
git reset --hard origin/master
git clean -fdx

Repository: NathanNeurotic/Open-PS2-Loader

Length of output: 188


🏁 Script executed:

rg -n "DATE=|RELEASE_BRANCH|formatted-source|original_make_changelog|commit-tree|force-push|push" make_changelog.sh .

Repository: NathanNeurotic/Open-PS2-Loader

Length of output: 7270


🏁 Script executed:

python3 - <<'PY'
from pathlib import Path
p = Path('make_changelog.sh')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 1 <= i <= 120:
        print(f"{i}: {line}")
PY

Repository: NathanNeurotic/Open-PS2-Loader

Length of output: 2977


🏁 Script executed:

sed -n '1,220p' make_changelog.sh | cat -n

Repository: NathanNeurotic/Open-PS2-Loader

Length of output: 3214


Avoid running a temp copy from origin/master
git show origin/master:make_changelog.sh > /tmp/original_make_changelog.sh + chmod +x + execution makes this path depend on a moving branch snapshot, and the later git reset --hard/git clean -fdx discards whatever that invocation changed locally. Call the checked-in script directly or inline the needed steps instead.

🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 4-4: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/original_make_changelog.sh
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)


[warning] 9-9: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/formatted-source.c
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)


[warning] 14-14: Writing to or reading from a hardcoded, predictable path under /tmp is vulnerable to symlink and TOCTOU attacks: a local attacker can pre-create the file (or a symlink pointing elsewhere) and hijack or corrupt the contents. Generate a unique, unpredictable temporary file with mktemp instead, e.g. tmpfile="$(mktemp)" (or mktemp -d for directories) and reference "$tmpfile".
Context: /tmp/formatted-source.c
Note: [CWE-377] Insecure Temporary File.

(predictable-tmp-file-bash)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@make_changelog.sh` around lines 4 - 14, Update the changelog-generation flow
to invoke the checked-in make_changelog.sh directly instead of extracting and
executing origin/master's copy via /tmp/original_make_changelog.sh. Remove the
git show, chmod, and temporary-script execution steps while preserving the
subsequent formatting and repository reset workflow.

Comment thread make_changelog.sh Outdated
Comment on lines +18 to +23
export GIT_AUTHOR_NAME="ChatGPT"
export GIT_AUTHOR_EMAIL="noreply@openai.com"
export GIT_COMMITTER_NAME="ChatGPT"
export GIT_COMMITTER_EMAIL="noreply@openai.com"
export GIT_AUTHOR_DATE="2026-07-20T04:12:00Z"
export GIT_COMMITTER_DATE="2026-07-20T04:12:00Z"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Hardcoded literal commit timestamp.

GIT_AUTHOR_DATE/GIT_COMMITTER_DATE are fixed to a single literal instant. Every future run of this script will stamp its commit with that same stale timestamp instead of the actual commit time.

🐛 Proposed fix
-export GIT_AUTHOR_DATE="2026-07-20T04:12:00Z"
-export GIT_COMMITTER_DATE="2026-07-20T04:12:00Z"
+export GIT_AUTHOR_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
+export GIT_COMMITTER_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export GIT_AUTHOR_NAME="ChatGPT"
export GIT_AUTHOR_EMAIL="noreply@openai.com"
export GIT_COMMITTER_NAME="ChatGPT"
export GIT_COMMITTER_EMAIL="noreply@openai.com"
export GIT_AUTHOR_DATE="2026-07-20T04:12:00Z"
export GIT_COMMITTER_DATE="2026-07-20T04:12:00Z"
export GIT_AUTHOR_NAME="ChatGPT"
export GIT_AUTHOR_EMAIL="noreply@openai.com"
export GIT_COMMITTER_NAME="ChatGPT"
export GIT_COMMITTER_EMAIL="noreply@openai.com"
export GIT_AUTHOR_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
export GIT_COMMITTER_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@make_changelog.sh` around lines 18 - 23, Update the GIT_AUTHOR_DATE and
GIT_COMMITTER_DATE assignments in make_changelog.sh to use the current runtime
timestamp rather than the hardcoded 2026-07-20T04:12:00Z value, ensuring each
generated commit receives the actual execution time.

@github-actions
github-actions Bot force-pushed the agent/fix-bdma-transaction-integrity-v2 branch 5 times, most recently from 6a074ca to 565c771 Compare July 20, 2026 04:58
@NathanNeurotic NathanNeurotic changed the title Make BDMA driver replacement transactional Staging runner: publish corrected transactional BDMA branch Jul 20, 2026
@NathanNeurotic NathanNeurotic changed the title Staging runner: publish corrected transactional BDMA branch Superseded by unified PR #236 Jul 20, 2026
@NathanNeurotic NathanNeurotic changed the title Superseded by unified PR #236 Temporary runner for validated PR #236 review fix Jul 20, 2026
@NathanNeurotic NathanNeurotic changed the title Temporary runner for validated PR #236 review fix Superseded by unified PR #236 Jul 20, 2026
@NathanNeurotic NathanNeurotic changed the title Superseded by unified PR #236 Temporary exact-format runner for PR #236 Jul 20, 2026
@NathanNeurotic NathanNeurotic changed the title Temporary exact-format runner for PR #236 Temporary format-log inspection runner Jul 20, 2026
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