A few bug fixes related to exec and initialization.#1204
Merged
Conversation
Contributor
There was a problem hiding this comment.
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);
xuyao0127
approved these changes
Apr 30, 2025
Collaborator
xuyao0127
left a comment
There was a problem hiding this comment.
Just a small typo. Otherwise LGTM.
Also call tzset during DMTCP init.
41b0d57 to
013b8e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.