Fix xcodemake log path generation#467
Conversation
Patch downloaded xcodemake to use sanitized hashed log names so absolute derived data paths do not create invalid filenames. Also escape Swift source dependency paths with spaces and align the log existence check with the patched naming. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5c0baf1. Configure here.
| log('debug', `Checking for Makefile log: ${logFileName} in directory: ${projectDir}`); | ||
|
|
||
| const files = readdirSync('.'); | ||
| const files = readdirSync(projectDir); |
There was a problem hiding this comment.
PATH xcodemake log name mismatch
Medium Severity
doesMakeLogFileExist now looks only for hashed, sanitized log filenames, but isXcodemakeAvailable still treats a PATH xcodemake from which as valid without applying patchXcodemakeScript. That binary keeps writing legacy log names, so the existence check stays false even when a Makefile and log are already present, and incremental make is skipped on every build.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 5c0baf1. Configure here.
| `dollarEscape($make_dep_source); | ||
| unescape("'", $make_dep_source); | ||
| escape(" ", $make_dep_source);`, | ||
| ); |
There was a problem hiding this comment.
Fragile patch leaves script unchanged
Medium Severity
patchXcodemakeScript relies on exact substring replacements with no check that they succeeded. If upstream xcodemake changes whitespace or wording, the written script may still use legacy log naming or omit Digest::MD5 while the patched block calls md5_hex, so log checks and xcodemake runs can fail silently or at runtime after download.
Reviewed by Cursor Bugbot for commit 5c0baf1. Configure here.
| .replace(/[/:]+/g, '_') | ||
| .replace(/[^\p{L}\p{N}._+=,@ -]+/gu, '_') |
There was a problem hiding this comment.
Bug: The TypeScript code uses a Unicode-aware regex to sanitize log file names, while the patched Perl script uses [:alnum:], which may not handle Unicode correctly without explicit UTF-8 mode, causing a mismatch.
Severity: LOW
Suggested Fix
To ensure consistent behavior across different environments, add use utf8; or use feature 'unicode_strings'; to the beginning of the patched Perl script. This will guarantee that the [:alnum:] character class correctly handles Unicode characters, aligning its behavior with the TypeScript implementation.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/utils/xcodemake.ts#L132-L133
Potential issue: The `sanitizeXcodemakeLogTag` function in TypeScript uses a
Unicode-aware regular expression (`/[^\p{L}\p{N}._+=,@ -]+/gu`) to sanitize arguments
for a log file name. However, the corresponding logic in the patched Perl script uses a
POSIX character class (`[^[:alnum:]._+=,@ -]`). The Perl script does not explicitly
enable UTF-8 mode (e.g., with `use utf8;`), so its handling of non-ASCII characters is
dependent on the system's locale. This discrepancy can cause the log file name generated
by the Perl script to differ from the one expected by the TypeScript code, leading
`doesMakeLogFileExist` to incorrectly return `false` and trigger unnecessary rebuilds.
Also affects:
src/utils/xcodemake.ts:160~161
Did we get this right? 👍 / 👎 to inform future reviews.


Patch downloaded xcodemake to use sanitized hashed log names so absolute derived data paths do not create invalid filenames. Also escape Swift source dependency paths with spaces and align the log existence check with the patched naming.
Closes #466