Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clientgui/mac/SetVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ int main(int argc, char** argv) {
printf("%s\n", myPath); // For debugging
#endif

chdir(getenv("SRCROOT"));
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

The chdir call does not check if getenv("SRCROOT") returns NULL, which would cause undefined behavior. Add a null check before calling chdir.

Suggested change
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);

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
chdir(getenv("SRCROOT"));
if (chdir(getenv("SRCROOT")) == -1) {
perror("Error changing directory to SRCROOT");
return 1;
}

Copilot uses AI. Check for mistakes.

if (!file_exists("./English.lproj")) {
retval = mkdir("./English.lproj", 0755);
if (retval) {
Expand Down
2 changes: 1 addition & 1 deletion lib/hostinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ const char* docker_type_str(DOCKER_TYPE type) {
const char* docker_cmd_prefix(DOCKER_TYPE type) {
static char buf[256];
if (type == PODMAN) {
const char* dir = "/Library/Application\ Support/BOINC\ Data/podman";
const char* dir = "/Library/Application Support/BOINC Data/podman";
// must end w/ space
snprintf(buf, sizeof(buf),
"env XDG_CONFIG_HOME=\"%s\" XDG_DATA_HOME=\"%s\" ",
Expand Down
13 changes: 11 additions & 2 deletions mac_build/BuildMacBOINC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,18 @@ done
## That is why all the other xcodebuild calls are invoked this way.

if [ "${buildall}" = "1" ] || [ "${buildlibs}" = "1" ] || [ "${buildclient}" = "1" ] || [ "x${targets}" != "x" ]; then
# build all or specified targets from the boinc.xcodeproj project for -all, -libs, -client, or -target
eval "xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"

echo ""
## Apparently xcodebuild ignores build pre-actions, so we do this explicitly
source "./Update_Info_Plists.sh"
result=$?
echo ""

if [ $result -eq 0 ]; then
# build all or specified targets from the boinc.xcodeproj project for -all, -libs, -client, or -target
eval "xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk \"${SDKPATH}\" ${doclean} build ${uselibcplusplus} ${theSettings}"
result=$?
fi
fi

if [ $result -eq 0 ]; then
Expand Down
65 changes: 65 additions & 0 deletions mac_build/Update_Info_Plists.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# This file is part of BOINC.
# http://boinc.berkeley.edu
# Copyright (C) 2025 University of California
#
# BOINC is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# BOINC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#
#
# Update_Info_Plists.sh
# by Charlie Fenton 7/11/25
#

## Called from pre-actions in BOINC Xcode project when compiling BOINC.
## Note that Xcode runs build pre-actions pnly for the currently selected
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

Typo in comment: 'pnly' should be 'only'

Suggested change
## Note that Xcode runs build pre-actions pnly for the currently selected
## Note that Xcode runs build pre-actions only for the currently selected

Copilot uses AI. Check for mistakes.
## 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
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

Typo in comment: 'ovehead' should be 'overhead'

Suggested change
## build operation, even the build_all target. The ovehead of running this
## build operation, even the build_all target. The overhead of running this

Copilot uses AI. Check for mistakes.
## script is minimal, so rather than comparing all the Info.plist file's
## modification dates to that of version.h, we just run this script for
## every build operation.
##
## Usage:
## export WORKSPACE_PATH=
## source {path}/mac_build/Update_Info_Plists.sh
## Called from pre-actions as:
## source "$WORKSPACE_PATH/../../Update_Info_Plists.sh"
##
##
originalDir=`pwd`
directory=$(dirname "$WORKSPACE_PATH")
directory=$(dirname "$directory")
echo "Directory is " "$directory"
cd "$directory"
echo "About to check for " "$directory/build/Development/SetVersion"
echo "compared to " "$directory/../clientgui/mac/Setversion.cpp"
if [ ! -e "$directory/build/Development/SetVersion" ] || [ "$directory/../clientgui/mac/Setversion.cpp" -nt "$directory/build/Development/SetVersion" ]; then
echo "About to run xcodebuild"
xcodebuild -project boinc.xcodeproj -target SetVersion -configuration Development
if [ $? -ne 0 ]; then
echo "ERROR: xcodebuild failed"
cd "${originalDir}"
return 1
fi
echo "After xcodebuild, about to check for " "$directory/build/Development/SetVersion"
if [ ! -e "$directory/build/Development/SetVersion" ]; then
return 1
fi
fi
###$directory="$directory/build/Development"
echo "Running SetVersion"
"$directory/build/Development/SetVersion"
cd "${originalDir}"
return 0
Loading
Loading