mirror of
https://github.com/clearlinux/clr-debug-info.git
synced 2026-09-03 12:21:49 +00:00
For easier parallelization, I opted to replace the C program with a bash
script that uses GNU Parallel, find, and GAWK for the core control flow.
For compatibility, running the shell script without arguments has the
same general behavior as the C program. Some bugs have been fixed as
well, so the end result should be an improvement over the original.
Bugs fixed:
- A race condition in the C program with the "unsymlink" operation has
been addressed: instead of replacing the valid symlinks within
debuginfo.raw, the symlink targets are added directly to the automatic
tarballs, and tar's "transform" feature is used to rewrite the filename.
- Running system("tar ... &") to create the tarballs often had the side
effect of bogging down the system, since the number of active tar
processes had no upper bound. The shell script rewrite uses GNU
Parallel, which limits (by default) the number of parallel jobs.
- Directory tarballs were unintentionally re-created whenever content
within the directories were modified, due to the stat() mtime changing.
With the new script, directory tarball creation only occurs for those
directories that do not already exist at the destination.
Once the script begins to create tarballs, performance is largely the
same as the C program. The script has a "precompute" phase where it
determines the list of needed tarball creations up-front, which is
different (and probably a bit slower) than the on-the-fly stat()s used
by the C program, but the runtime cost of this new precompute phase is
negligible compared to the tarball creation phase.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>