Skip to content

Fix xcodemake log path generation#467

Open
reallyseth wants to merge 1 commit into
getsentry:mainfrom
reallyseth:bugfix/fix-xcodemake-log-path
Open

Fix xcodemake log path generation#467
reallyseth wants to merge 1 commit into
getsentry:mainfrom
reallyseth:bugfix/fix-xcodemake-log-path

Conversation

@reallyseth

Copy link
Copy Markdown

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

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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread src/utils/xcodemake.ts
log('debug', `Checking for Makefile log: ${logFileName} in directory: ${projectDir}`);

const files = readdirSync('.');
const files = readdirSync(projectDir);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5c0baf1. Configure here.

Comment thread src/utils/xcodemake.ts
`dollarEscape($make_dep_source);
unescape("'", $make_dep_source);
escape(" ", $make_dep_source);`,
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5c0baf1. Configure here.

Comment thread src/utils/xcodemake.ts
Comment on lines +132 to +133
.replace(/[/:]+/g, '_')
.replace(/[^\p{L}\p{N}._+=,@ -]+/gu, '_')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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.

[Bug]:  xcodemake incremental builds fails

1 participant