Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for the new --restartdir flag by updating the test harness and internal restart logic, and adjusts the filesystem layer to handle 64-bit directory entries on additional architectures.
- Extend
testRestart()to detect and pass a checkpoint directory via--restartdirand add a corresponding test invocation. - Restructure
DmtcpRestartso it either consumes explicit checkpoint image arguments or lists a directory for images. - Enhance
jalib::Filesystemto definelinux_direntfor 64-bit architectures and callSYS_getdents64where appropriate.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/autotest.py | Add --restartdir branch inside testRestart() and invoke it. |
| src/dmtcprestartinternal.cpp | Enforce mutual exclusion of image args vs. --restartdir and list directory on that flag. |
| jalib/jfilesystem.h | Define a 64-bit linux_dirent struct for __aarch64__, __riscv, and __x86_64__. |
| jalib/jfilesystem.cpp | Switch to SYS_getdents64 on architectures with 64-bit dirents. |
Comments suppressed due to low confidence (2)
test/autotest.py:645
- The variable
nameis not defined withintestRestart(), which will raise a NameError at runtime. Consider passingnameas an argument totestRestartor deriving it from the test framework context.
if name == "restartdir":
test/autotest.py:645
- [nitpick] Indentation here uses 4 spaces but the project standard is 2 spaces. Please align the new block to match existing indentation.
if name == "restartdir":
Comment on lines
813
to
+842
| // Can't specify ckpt images with --restartdir flag. | ||
| if (restartDir.empty() ^ (ckptImages.size() > 0)) { | ||
| JASSERT_STDERR << theUsage; | ||
| exit(DMTCP_FAIL_RC); | ||
| } | ||
|
|
||
| if (ckptImages.size() > 0) { // Explicit ckpt images are provided | ||
| for (; argc > 0; shift) { |
There was a problem hiding this comment.
This XOR check runs before ckptImages is populated, causing valid explicit-image invocations to be rejected. Either move this validation after the image-listing logic or invert the condition so it only errors when both or neither option is specified.
Suggested change
| // Can't specify ckpt images with --restartdir flag. | |
| if (restartDir.empty() ^ (ckptImages.size() > 0)) { | |
| JASSERT_STDERR << theUsage; | |
| exit(DMTCP_FAIL_RC); | |
| } | |
| if (ckptImages.size() > 0) { // Explicit ckpt images are provided | |
| for (; argc > 0; shift) { | |
| if (ckptImages.size() > 0) { // Explicit ckpt images are provided | |
| for (; argc > 0; shift) { | |
| string restorename(argv[0]); | |
| struct stat buf; | |
| JASSERT(stat(restorename.c_str(), &buf) != -1); | |
| if (Util::strEndsWith(restorename.c_str(), "_files")) { | |
| continue; | |
| } else if (!Util::strEndsWith(restorename.c_str(), ".dmtcp")) { | |
| JNOTE("File doesn't have .dmtcp extension. Check Usage.") (restorename); | |
| // Don't test for --quiet here. We're aborting. We need to say why. | |
| JASSERT_STDERR << theUsage; | |
| exit(DMTCP_FAIL_RC); | |
| } else if (buf.st_uid != getuid() && !noStrictChecking) { | |
| /*Could also run if geteuid() matches*/ | |
| JASSERT(false) (getuid()) (buf.st_uid) (restorename) | |
| .Text("Process uid doesn't match uid of checkpoint image.\n" \ | |
| "This is dangerous. Aborting for security reasons.\n" \ | |
| "If you still want to do this, then re-run dmtcp_restart\n" \ | |
| " with the --no-strict-checking flag.\n"); | |
| } | |
| JTRACE("Will restart ckpt image") (argv[0]); | |
| ckptImages.push_back(argv[0]); | |
| } | |
| } else { // --restartdir is provided | |
| // Additional logic for --restartdir | |
| } | |
| // Can't specify ckpt images with --restartdir flag. | |
| if (restartDir.empty() ^ (ckptImages.size() > 0)) { | |
| JASSERT_STDERR << theUsage; | |
| exit(DMTCP_FAIL_RC); | |
| } |
karya0
approved these changes
Jun 3, 2025
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.
PR #1207 needs to be merged before this PR.