Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-10992

Implement testutil functions for directory copy and remove

    • v7.0

      Summary

      We should create testutil functions for recursive file copy and remove. We copy and remove files and directories frequently throughout our tests, we should properly encapsulate this functionality within functions instead of calling cp and rm directly using system().

      Rationale

      Even though cp and rm are standard commands, they do not handle all necessary corner cases, and they have bugs and incompatibilities between OS versions.

      • In certain rare cases, file copy can fail and needs to be retried (WT-10117).
      • Older versions of macOS don't support "cp -l" (WT-10914); newer versions have a bug (WT-10921).
      • There is a race condition between directory copy and remove in our _abort tests, e.g., where a child's rm sub-process continues to execute after the child is killed, which then races with the parent's cp sub-process (WT-11075).
      • Performing file operations via system() is inherently unsafe; for example, it may not be able to properly handle file names with spaces, semicolons, and other special characters.
      • Some of our uses of system() hard-code the commands instead of using the macros for Linux and Windows versions, which makes their use non-portable.

      We should be able to handle all of these issues within our own utility functions.

            Assignee:
            peter.macko@mongodb.com Peter Macko
            Reporter:
            peter.macko@mongodb.com Peter Macko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: