Update main.cpp - #7217
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="client/main.cpp">
<violation number="1" location="client/main.cpp:194">
P2: Behavior regression in `--dir` error handling. The previous `-dir` branch in `parse_cmdline` did `if (chdir(argv[++i])) { perror("chdir"); exit(1); }`, so a bad directory terminated the client. The new code only logs an error and continues, and it sets `dir_specified = true` even when the chdir failed. As a result, on Windows the `chdir_to_data_dir()` fallback is also skipped (because `dir_specified` is true), and the client runs on with an unexpected working directory instead of failing fast as before.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| argv[j] = argv[j+2]; | ||
| } | ||
| argc -= 2; | ||
| if (boinc_chdir(dir_path)) { |
There was a problem hiding this comment.
P2: Behavior regression in --dir error handling. The previous -dir branch in parse_cmdline did if (chdir(argv[++i])) { perror("chdir"); exit(1); }, so a bad directory terminated the client. The new code only logs an error and continues, and it sets dir_specified = true even when the chdir failed. As a result, on Windows the chdir_to_data_dir() fallback is also skipped (because dir_specified is true), and the client runs on with an unexpected working directory instead of failing fast as before.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/main.cpp, line 194:
<comment>Behavior regression in `--dir` error handling. The previous `-dir` branch in `parse_cmdline` did `if (chdir(argv[++i])) { perror("chdir"); exit(1); }`, so a bad directory terminated the client. The new code only logs an error and continues, and it sets `dir_specified = true` even when the chdir failed. As a result, on Windows the `chdir_to_data_dir()` fallback is also skipped (because `dir_specified` is true), and the client runs on with an unexpected working directory instead of failing fast as before.</comment>
<file context>
@@ -180,17 +180,46 @@ static void init_core_client(int argc, char** argv) {
+ argv[j] = argv[j+2];
+ }
+ argc -= 2;
+ if (boinc_chdir(dir_path)) {
+ log_message_error("Failed to chdir to specified directory");
+ }
</file context>
|
The BOINC docs don't specify the priority of
So I suggest that we leave things the way they are. |
|
We need to specify this somewhere to avoid misunderstandings. |
|
@davidpanderson, I did a little research on this topic.
I think we should document this and fix it whenever possible to follow this priorities list. |
Fixes #1544
Description of the Change
Reorder the initialization sequence in init_core_client() to ensure that command-line arguments correctly override settings from cc_config.xml.
Before: command-line parsing happened before reading the config file, so XML values unconditionally overwrote the earlier command-line settings.
After:
This change also updates do_gpu_detection() to follow the same pattern (read config first, then parse command line), keeping behaviour consistent.
Assisted-by: (not using an agent): DeepSeek-V4
Alternate Designs
Two other approaches were considered:
The chosen design is the simplest and least intrusive: it uses the existing parsing mechanism twice, requiring no changes to parse_options_client() or CC_CONFIG structure, and correctly handles directory changes.
Release Notes
Fix command-line options being overridden by
cc_config.xml; command‑line arguments now take precedence over the configuration file.Summary by cubic
Command-line arguments now correctly override cc_config.xml across platforms. init_core_client(): extract and apply
--dirbefore first parse, switch to the data dir (or default on Windows), read config, then re-parse CLI to override; do_gpu_detection(): read config before CLI parse and remove the late read so diagnostics honor flags.Written for commit 5d583a4. Summary will update on new commits.