Skip to content

Pass tv_sec and tv_nsec to LxtLogError in CheckTime#40494

Merged
benhillis merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-lxtfs-logerror-args
May 12, 2026
Merged

Pass tv_sec and tv_nsec to LxtLogError in CheckTime#40494
benhillis merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-lxtfs-logerror-args

Conversation

@benhillis
Copy link
Copy Markdown
Member

Split out from #40489.

When LxtFsTimestampDiff indicates that Timestamp1 is not strictly greater than Timestamp2, the failure path called LxtLogError with a format string expecting four scalars (sec, nsec, sec, nsec) but only passed the two struct timespec* pointers. The diagnostic therefore printed garbage on test failure, and the call relies on undefined varargs behavior.

Change

  • test/linux/unit_tests/lxtfs.c: pass Timestamp{1,2}->tv_sec and ->tv_nsec with (long long) / (long) casts so the format string matches the arguments.

Validation

  • Diagnostic-only fix: only affects the message printed on a test failure path, not whether the test passes.

The format string takes four scalars (sec, nsec, sec, nsec) but only two
struct timespec pointers were being passed, so the diagnostic on failure
printed garbage. Pass the four scalar fields with explicit casts to
match the format specifiers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 17:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes undefined varargs usage in a unit test failure diagnostic by passing timespec scalar fields (tv_sec, tv_nsec) to LxtLogError in the expected types.

Changes:

  • Update LxtLogError call in CheckTime to pass Timestamp{1,2}->tv_sec and ->tv_nsec with casts matching the format string.

@benhillis benhillis merged commit 1934118 into microsoft:master May 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants