Skip to content

cron: scheduler does not parse script arguments (e.g. memory-ttl.py expire) #20300

@hd599056377-bot

Description

@hd599056377-bot

Bug Description

The cron script field supports a path that includes arguments (e.g. memory-ttl.py expire), but _run_job_script() in cron/scheduler.py treats the entire string as a filename rather than parsing it into "script path + arguments".

Steps to Reproduce

  1. Create a cron job with script: "memory-ttl.py expire" (or any script that accepts CLI arguments)
  2. Run the cron job
  3. Observe that subprocess.run([sys.executable, str(path)]) receives the full string as the path argument — the script runs but without expire as an argument, so it executes in its default mode instead

Expected Behavior

Use shlex.split() to separate the script filename from its arguments, then append the arguments to the subprocess call: subprocess.run([sys.executable, str(path)] + script_args).

Actual Behavior

The entire string including whitespace-separated arguments is treated as a single filename. Scripts that rely on CLI arguments silently run in the wrong mode.

Impact

Any cron job using a script that requires arguments (like --report-only, expire, --check-only) silently runs with the wrong behavior. The job still returns ok status, masking the incorrect execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cronCron scheduler and job managementtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions