Skip to content

Make timestamp formatting consistent#6042

Merged
larsewi merged 1 commit into
cfengine:masterfrom
amousset:time_t_32_arm
Feb 13, 2026
Merged

Make timestamp formatting consistent#6042
larsewi merged 1 commit into
cfengine:masterfrom
amousset:time_t_32_arm

Conversation

@amousset

@amousset amousset commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Use %jd + intmax_t to format the timestamp (like other time_t formats do) in file backup code.

On ARMv7 (which is, understandably, unsupported) it segfaults at runtime. But formatting a (signed) time_t as unsigned is, AFAIK, undefined behavior annyway.

@craigcomstock craigcomstock left a comment

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.

Seems reasonable. Thanks for the contribution. Hope your ARMv7 systems are doing well.

@amousset amousset marked this pull request as draft February 11, 2026 19:47
@amousset

amousset commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

Fixed other similar warnings (although less serious) with the same change for consistency.

locks.c:356:79: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Wformat=]
  356 |         Log(LOG_LEVEL_DEBUG, "Giving time to process '%d' (holding lock for %ld s)", entry->pid, (now - entry->time));
      |                                                                             ~~^                  ~~~~~~~~~~~~~~~~~~~
      |                                                                               |                       |
      |                                                                               long int                time_t {aka long long int}
      |                                                                             %lld

@amousset amousset marked this pull request as ready for review February 11, 2026 19:57
Comment thread libpromises/evalfunction.c Fixed
@larsewi

larsewi commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

@cf-bottom Jenkins please :)

@cfengine cfengine deleted a comment from cf-bottom Feb 12, 2026
@cf-bottom

Copy link
Copy Markdown

@craigcomstock

Copy link
Copy Markdown
Contributor

sequential-tests failure was a flake, looks good.

@craigcomstock craigcomstock left a comment

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.

@amousset please squash all commits into one or separate into issue fix and code quality fix.

A few cases did not use %jd + intmax_t. Make these consistent.
Also prevents a segfault on ARMv7 when %lu was used.
@amousset

Copy link
Copy Markdown
Contributor Author

Squashed.

@larsewi larsewi merged commit 0130e1d into cfengine:master Feb 13, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants