Branch: refs/heads/master
Revision: 074cb1c
Author: lydia-duncan
Log Message:
Merge pull request #17636 from lydia-duncan/fixChpldocTmpDir
Fix issues with chpldoc temporary directory
[reviewed by @ronawho]
We started encountering problems in nightly testing where we'd accidentally put
chpldoc temporary files in a folder that already had old chpldoc error files, causing
us to encounter sporadic failures that matched the old error files. This was because
we were failing to clean up old temporary directories after a failure. This change
accomplishes two things:
- It ensures that we clean up the temporary directory for chpldoc, even when we
encounter an error - It stops using a homegrown strategy to create the temporary directory, instead
relying on mkdtemp. We do still perform some computation to determine the start
of the temporary directory's name (involving getting the username and attaching
the program name and "deleteme" to it) but we no longer use the PID to differentiate,
instead relying on mkdtemp's randomization for us.
Resolves Cray/chapel-private#1932
Resolves Cray/chapel-private#1678
With this change, I was no longer seeing leftover chpldoc directories in my temp folder,
and did not see additional chpl directories (because this does alter how we compute the
temporary directory name for chpl compilations, since they share a code path)
At Elliot's suggestion, use mkdtemp to make a temporary directory, for both
chpldoc and chpl programs. Because mkdtemp requires its strings end in six Xs,
alter the name we use from "tmpdirloc/chpl[doc]-username-pid.deleteme" to
"tmpdirloc/chpl[doc]-username.deleteme-XXXXXX" and remove all references to the
PID in this setup. The username stuff seems reasonable to keep and the Xs will
be replaced with a unique enough set of characters for our purposes.
Testing:
Passed a full paratest with futures and a spot check on my Mac with hello.chpl and
a chpldoc test that had triggered the leftover directory before
Modified Files:
A compiler/include/tmpdirname.h
R compiler/util/tmpdirname.h
M compiler/passes/docs.cpp
M compiler/util/files.cpp
M compiler/util/tmpdirname.cpp
Compare: https://github.com/chapel-lang/chapel/compare/431f40627257...074cb1cba08d