Skip to content

CFE-2815: Added isnewerthantime function #5799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jakub-nt
Copy link
Contributor

@jakub-nt jakub-nt commented May 8, 2025

corresponding docs PR: cfengine/documentation#3430

@CLAassistant
Copy link

CLAassistant commented May 8, 2025

CLA assistant check
All committers have signed the CLA.

int exit_code = stat(arg_file, &file_buf);

if (exit_code == -1)
{

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 162 lines.

time_t file_mtime = file_buf.st_mtime;

bool result = file_mtime > arg_mtime;

Check notice

Code scanning / CodeQL

Pointer argument is dereferenced without checking for NULL Note

Parameter finalargs in FnCallSelectServers() is dereferenced without an explicit null-check
time_t file_mtime = file_buf.st_mtime;

bool result = file_mtime > arg_mtime;

Check notice

Code scanning / CodeQL

Pointer argument is dereferenced without checking for NULL Note

Parameter finalargs in FnCallSelectServers() is dereferenced without an explicit null-check

bool result = file_mtime > arg_mtime;

return FnReturnContext(result);

Check notice

Code scanning / CodeQL

Pointer argument is dereferenced without checking for NULL Note

Parameter finalargs in FnCallSelectServers() is dereferenced without an explicit null-check
bool result = file_mtime > arg_mtime;

return FnReturnContext(result);
}

Check notice

Code scanning / CodeQL

Pointer argument is dereferenced without checking for NULL Note

Parameter finalargs in FnCallSelectServers() is dereferenced without an explicit null-check

return FnReturnContext(result);
}

Check notice

Code scanning / CodeQL

Pointer argument is dereferenced without checking for NULL Note

Parameter finalargs in FnCallSelectServers() is dereferenced without an explicit null-check
@larsewi larsewi requested review from victormlg and larsewi May 8, 2025 17:53
Copy link
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

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

Great work!

Since the title will be part of the changelog you can make it a little bit more specific. E.g., "Added isnewerthantime() policy function". Also backticks in the changelog can cause som issues later on. So better omit them in the case of changelog entries.

It would also be nice if you included an acceptance test. Here you can add more test cases that are not suitable in an example. E.g., what happens if the timestamp is not a string, what happens in the timestamp is CF_NOINT, what happens if timestamp is CF_INFINITY etc.

@larsewi
Copy link
Contributor

larsewi commented May 12, 2025

You will also have to sign the CLA #5799 (comment)

jakub-nt added 2 commits May 16, 2025 16:34
Changelog: None
Signed-off-by: jakub-nt <[email protected]>
Ticket: CFE-2815

Changelog: Title
Signed-off-by: jakub-nt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants