Skip to content

Fixed process_select and file_select time ranges on Windows - #6298

Open
larsewi wants to merge 1 commit into
cfengine:masterfrom
larsewi:win-time-range-bounds
Open

Fixed process_select and file_select time ranges on Windows#6298
larsewi wants to merge 1 commit into
cfengine:masterfrom
larsewi:win-time-range-bounds

Conversation

@larsewi

@larsewi larsewi commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

ttime_range, stime_range, ctime, atime and mtime store their bounds in time_t, but parsed them through a (long *) cast. On Windows, long is narrower than time_t. Hence, only the lower half of each bound was written and the rest kept whatever garbage value the struct initializer left there. This caused the bounds to come out as large negative numbers and ttime_range matched no processes at all.

ttime_range, stime_range, ctime, atime and mtime store their bounds in
time_t, but parsed them through a (long *) cast. On Windows, long is
narrower than time_t. Hence, only the lower half of each bound was
written and the rest kept whatever garbage value the struct initializer
left there. This caused the bounds to come out as large negative numbers
and ttime_range matched no processes at all.

Changelog: Title
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@larsewi larsewi added the cherry-pick? Fixes which may need to be cherry-picked to LTS branches label Aug 17, 2026
@larsewi

larsewi commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@cf-bottom Jenkins please :)

@cf-bottom

Copy link
Copy Markdown

Comment thread libpromises/conversion.c
split = SplitString(intrange, ',');

sscanf(split->name, "%ld", &lmin);
sscanf(split->name, "%" SCNd64, &lmin);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you need to check if this format is supported with autotools?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick? Fixes which may need to be cherry-picked to LTS branches

Development

Successfully merging this pull request may close these issues.

3 participants