Skip to content

A few bug fixes related to exec and initialization.#1204

Merged
karya0 merged 2 commits intomainfrom
dev/karya0/logging3
Apr 30, 2025
Merged

A few bug fixes related to exec and initialization.#1204
karya0 merged 2 commits intomainfrom
dev/karya0/logging3

Conversation

@karya0
Copy link
Copy Markdown
Member

@karya0 karya0 commented Apr 26, 2025

  • Exec error handling.
  • getTimestampStr deadlock handling.

@karya0 karya0 requested review from Copilot, gc00 and xuyao0127 April 26, 2025 13:28
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

This PR addresses a few bug fixes related to exec behavior and initialization routines. Key changes include:

  • Adding a test in forkexec.c to trigger an execve failure.
  • Replacing the UTC timestamp functionality in util_misc.cpp with a local time implementation using gettimeofday/localtime_r.
  • Adjusting the ordering of errno restoration in execwrappers.cpp.
  • Initializing the timezone earlier in dmtcpworker.cpp via tzset to avoid potential malloc calls during later time conversions.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/forkexec.c Introduces a test to trigger an execve failure using assert.
src/util_misc.cpp Updates timestamp generation to use local time instead of UTC.
src/execwrappers.cpp Reorders the restoration of errno after closing a protected FD.
src/dmtcpworker.cpp Calls tzset during initialization to preempt malloc during time functions.
Comments suppressed due to low confidence (2)

test/forkexec.c:57

  • [nitpick] Consider adding an explanatory comment or error message with the assert to clarify that the failure is expected and possibly verify errno to ensure the failure is due to the anticipated cause.
assert(execve("/some/random/binary", t, env) != 0);

src/util_misc.cpp:705

  • The revised implementation now formats the timestamp using local time rather than UTC. Please confirm that this change in behavior is intentional and acceptable for the system.
snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03ld", localTime.tm_year + 1900, localTime.tm_mon + 1, localTime.tm_mday, localTime.tm_hour, localTime.tm_min, localTime.tm_sec, tv.tv_usec / 1000);

Copy link
Copy Markdown
Collaborator

@xuyao0127 xuyao0127 left a comment

Choose a reason for hiding this comment

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

Just a small typo. Otherwise LGTM.

@karya0 karya0 force-pushed the dev/karya0/logging3 branch from 41b0d57 to 013b8e8 Compare April 30, 2025 19:10
@karya0 karya0 merged commit 26d82c6 into main Apr 30, 2025
1 check passed
@karya0 karya0 deleted the dev/karya0/logging3 branch April 30, 2025 19:33
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