yocontra opened a new pull request, #149:
URL: https://github.com/apache/cordova-node-xcode/pull/149

   ## Summary
   
   Some runtimes (notably Bun) and filesystems (APFS) can produce files with 
trailing null byte padding after `fs.writeFileSync`. When the `xcode` library 
reads a `.pbxproj` file that has been written this way, the PEG parser fails 
with:
   
   ```
   SyntaxError: Expected end of input but "\0" found.
   ```
   
   The actual pbxproj content is valid — only trailing `\0` bytes cause the 
parse failure.
   
   ## Changes
   
   - `lib/pbxProject.js` (`parseSync`): Strip trailing null bytes before 
passing to parser
   - `lib/parseJob.js` (async `parse`): Same fix for the forked worker path
   
   The fix is a single `.replace(/\0+$/, '')` on the file contents string, 
applied after `readFileSync` and before `parser.parse()`.
   
   ## Reproduction
   
   1. Use Bun to run Expo prebuild (`bun expo prebuild --platform ios --clean`)
   2. A config plugin calls `withXcodeProject` which triggers `parseSync`
   3. The generated `project.pbxproj` has ~16KB of trailing null bytes
   4. Parser throws `SyntaxError: Expected end of input but "\0" found`
   
   ## Test plan
   
   - Existing tests continue to pass (no null bytes = no-op regex replace)
   - Files with trailing null bytes now parse successfully


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to