Skip to content

[Feature] Provide limit checks when reading global_prefs_override #4916

@Vulpine05

Description

@Vulpine05

Describe the problem
Preferences can be modified in three ways:

  1. Web preferences
  2. Locally, via the Manger
  3. Locally, by editing the global_prefs_override.xml file directly

When changing preferences via the project website or the Manager, those values are validated to be in the correct range. However, when BOINC is started, it will read the global_prefs_override file (if it exists), and store those values. Some of those preferences are currently validated, but not all. The example below shows the percentage of CPUs being changed to a range between 0 and 100:

boinc/lib/prefs.cpp

Lines 509 to 513 in 3fc6c02

if (xp.parse_double("max_ncpus_pct", max_ncpus_pct)) {
if (max_ncpus_pct < 0) max_ncpus_pct = 0;
if (max_ncpus_pct > 100) max_ncpus_pct = 100;
mask.max_ncpus_pct = true;
continue;

However, if suspend_cpu_usage were accidentally edited as a negative number, that negative number would be stored, and BOINC would never crunch any tasks.

Describe the solution you'd like
I feel this can be resolved with two steps:

  1. For any double variables that don't have limits set already, add them. These limits are likely to be simple, such as setting a negative number to 0. This will have to be evaluated on a case-by-case basis.
  2. The user should be aware that BOINC had to modify one of their values. I think the best thing would be to create a message in the notices tab. I would think this would be similar to how a message appears when there is incorrect data in an app_config file. The message doesn't have to be too specific, perhaps which preference was changed. I would assume if the user is editing their global_prefs_override file, they will know how to read through it and find the error.

Additional context
I have started to work on this solution, but with #4871 being in development, I stopped so I didn't have to redo large sections of code. I would be happy to continue developing it after that PR is merged. In the meantime, I'm looking for any feedback.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions