Conversation
|
This PR is ready to merge when CI checks are complete. |
|
While Windows and MinGW errors are unrelated to this PR (I'll fix them separately), however this one looks strange: @CharlieFenton, could you please take a look? |
|
@CharlieFenton, still failing: |
…Xcode race condition
|
@AenBleidd It should fixed now. I had tested only building using the Xcode GUI, but apparently building from the command line using xcodebuild works differently, so I also had to modify the BuildMacBOINC.sh script. |
|
Please wait before merging. I want to look at one more thing. |
…Xcode race condition
|
@AenBleidd Thank you. I am done now, pending final CI checks succeeding. Please merge. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a race condition in the macOS build process by moving the execution of the SetVersion helper app earlier in the build process, and corrects a compiler warning in lib/hostinfo.cpp.
- Moves SetVersion execution from individual target dependencies to pre-build actions in Xcode schemes
- Removes redundant SetVersion dependencies from multiple targets in the Xcode project
- Adds a new script
Update_Info_Plists.shto handle SetVersion execution during pre-build actions
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| mac_build/boinc.xcodeproj/xcshareddata/xcschemes/*.xcscheme | Adds pre-build actions to execute Update_Info_Plists.sh script |
| mac_build/boinc.xcodeproj/project.pbxproj | Removes SetVersion target dependencies and updates build configurations |
| mac_build/Update_Info_Plists.sh | New script to build and execute SetVersion during pre-build phase |
| mac_build/BuildMacBOINC.sh | Explicitly calls Update_Info_Plists.sh since xcodebuild ignores pre-actions |
| lib/hostinfo.cpp | Removes unnecessary escape characters from Podman directory path |
| clientgui/mac/SetVersion.cpp | Adds chdir to SRCROOT environment variable |
| # | ||
|
|
||
| ## Called from pre-actions in BOINC Xcode project when compiling BOINC. | ||
| ## Note that Xcode runs build pre-actions pnly for the currently selected |
There was a problem hiding this comment.
Typo in comment: 'pnly' should be 'only'
| ## Note that Xcode runs build pre-actions pnly for the currently selected | |
| ## Note that Xcode runs build pre-actions only for the currently selected |
| ## Note that Xcode runs build pre-actions pnly for the currently selected | ||
| ## build target, not for any dependent targets that may also be built along | ||
| ## with the selected target. So this script is called only once for any | ||
| ## build operation, even the build_all target. The ovehead of running this |
There was a problem hiding this comment.
Typo in comment: 'ovehead' should be 'overhead'
| ## build operation, even the build_all target. The ovehead of running this | |
| ## build operation, even the build_all target. The overhead of running this |
| printf("%s\n", myPath); // For debugging | ||
| #endif | ||
|
|
||
| chdir(getenv("SRCROOT")); |
There was a problem hiding this comment.
The chdir call does not check if getenv("SRCROOT") returns NULL, which would cause undefined behavior. Add a null check before calling chdir.
| chdir(getenv("SRCROOT")); | |
| const char* srcroot = getenv("SRCROOT"); | |
| if (srcroot == NULL) { | |
| fprintf(stderr, "Error: SRCROOT environment variable is not set.\n"); | |
| return 1; | |
| } | |
| chdir(srcroot); |
| printf("%s\n", myPath); // For debugging | ||
| #endif | ||
|
|
||
| chdir(getenv("SRCROOT")); |
There was a problem hiding this comment.
The chdir call does not check for failure. If the directory change fails, the program may not work correctly. Consider checking the return value and handling errors appropriately.
| chdir(getenv("SRCROOT")); | |
| if (chdir(getenv("SRCROOT")) == -1) { | |
| perror("Error changing directory to SRCROOT"); | |
| return 1; | |
| } |
|
I'm not worried about the suggestion Copilot made about error checking. If that call fails (which is extremely unlikely, since Xcode always sets that environment variable before running any script, including the one which runs SetVersion), there's nothing we can do about it and the build will fail anyway. |
Many of the applications that are part of BOINC for Macintosh include an info.plist file, and several also include an infoplist.strings file, all of which contain the version number of BOINC. MacOS uses the information from these plist files to dsplay the version strings and related information to the user.
The Xcode project builds a helper app setversion which copies the templates of the various info.plist files from clientgui/mac/templates/ and updates the version information in each. The setversion app also generates the infoplist.strings files.
Each info.plist and infoplist.strings file must be created before the corresponding application is built by Xcode or the build of that application will fail. It has always been a challenge to ensure that happens, especially for simpler applications which take very little time to build. This sometimes created a race condition during the Xcode build process, causing builds to fail.
This PR builds and invokes the setversion helper app earlier in the build process, eliminating the race condition to make the build process more reliable.
In addition, this PR has a small change to the file lib/hostinfo.cpp to fix a compiler warning due to a change introduced in PR #6425, under the mistaken belief that the space characters must be escaped in the Podman data directory path string. As it turned out, the backslash characters added in that PR were ignored by the Xcode compiler and generated a warning "Unknown escape sequence."
The issue with Podman on the Mac was actually due to the Podman executable not being in the standard search path. BOINC does not inherit all default paths from the user's environment, so it must specify the full path to the Podman app:
/opt/podman/bin/podman. This had already been fixed in PR #6396, after the release of BOINC 8.2.4.